diff options
author | David M. Lee <dlee@digium.com> | 2013-04-08 13:27:45 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-04-08 13:27:45 +0000 |
commit | a2a53cc306ea5fec65daf3630716a7c6ee13adad (patch) | |
tree | 4e59f10e2c6ab044ac307466bf921bbf1ceca7d3 /include/asterisk/json.h | |
parent | 426095bc5503391eabb3e5ce0fbbfec8b4752f2d (diff) |
Stasis application WebSocket support
This is the API that binds the Stasis dialplan application to external
Stasis applications. It also adds the beginnings of WebSocket
application support.
This module registers a dialplan function named Stasis, which is used
to put a channel into the named Stasis app. As a channel enters and
leaves the Stasis diaplan application, the Stasis app receives a
'stasis-start' and 'stasis-end' events.
Stasis apps register themselves using the stasis_app_register and
stasis_app_unregister functions. Messages are sent to an application
using stasis_app_send.
Finally, Stasis apps control channels through the use of the
stasis_app_control object, and the family of stasis_app_control_*
functions.
Other changes along for the ride are:
* An ast_frame_dtor function that's RAII_VAR safe
* Some common JSON encoders for name/number, timeval, and
context/extension/priority
Review: https://reviewboard.asterisk.org/r/2361/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384879 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/json.h')
-rw-r--r-- | include/asterisk/json.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/asterisk/json.h b/include/asterisk/json.h index d8cf98ece..64a1e7b7a 100644 --- a/include/asterisk/json.h +++ b/include/asterisk/json.h @@ -764,4 +764,48 @@ struct ast_json *ast_json_deep_copy(const struct ast_json *value); /*!@}*/ +/*!@{*/ + +/*! + * \brief Common JSON rendering functions for common 'objects'. + */ + +/*! + * \brief Simple name/number pair. + * \param name Name + * \param number Number + * \return NULL if error (non-UTF8 characters, NULL inputs, etc.) + * \return JSON object with name and number fields + */ +struct ast_json *ast_json_name_number(const char *name, const char *number); + +/*! + * \brief Construct a timeval as JSON. + * + * JSON does not define a standard date format (boo), but the de facto standard + * is to use ISO 8601 formatted string. We build a millisecond resolution string + * from the \c timeval + * + * \param tv \c timeval to encode. + * \param zone Text string of a standard system zoneinfo file. If NULL, the system localtime will be used. + * \return JSON string with ISO 8601 formatted date/time. + * \return \c NULL on error. + */ +struct ast_json *ast_json_timeval(const struct timeval *tv, const char *zone); + +/*! + * \brief Construct a context/exten/priority as JSON. + * + * If a \c NULL is passed for \c context or \c exten, or -1 for \c priority, + * the fields is set to ast_json_null(). + * + * \param context Context name. + * \param exten Extension. + * \param priority Dialplan priority. + * \return JSON object with \c context, \c exten and \c priority fields + */ +struct ast_json *ast_json_dialplan_cep(const char *context, const char *exten, int priority); + +/*!@}*/ + #endif /* _ASTERISK_JSON_H */ |