summaryrefslogtreecommitdiff
path: root/include/asterisk/stasis_app.h
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-04-22 14:58:53 +0000
committerDavid M. Lee <dlee@digium.com>2013-04-22 14:58:53 +0000
commit1c21b8575bfd70b98b1102fd3dd09fc0bc335e14 (patch)
tree9a6ef6074e545ad2768bc1994e1a233fc1443729 /include/asterisk/stasis_app.h
parent1871017cc6bd2e2ce7c638eeb6813e982377a521 (diff)
This patch adds a RESTful HTTP interface to Asterisk.
The API itself is documented using Swagger, a lightweight mechanism for documenting RESTful API's using JSON. This allows us to use swagger-ui to provide executable documentation for the API, generate client bindings in different languages, and generate a lot of the boilerplate code for implementing the RESTful bindings. The API docs live in the rest-api/ directory. The RESTful bindings are generated from the Swagger API docs using a set of Mustache templates. The code generator is written in Python, and uses Pystache. Pystache has no dependencies, and be installed easily using pip. Code generation code lives in rest-api-templates/. The generated code reduces a lot of boilerplate when it comes to handling HTTP requests. It also helps us have greater consistency in the REST API. (closes issue ASTERISK-20891) Review: https://reviewboard.asterisk.org/r/2376/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386232 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/stasis_app.h')
-rw-r--r--include/asterisk/stasis_app.h44
1 files changed, 36 insertions, 8 deletions
diff --git a/include/asterisk/stasis_app.h b/include/asterisk/stasis_app.h
index caec19bbc..a789e4012 100644
--- a/include/asterisk/stasis_app.h
+++ b/include/asterisk/stasis_app.h
@@ -66,7 +66,7 @@ struct ast_channel_snapshot;
* \param argv Arguments for the application.
*/
int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
- char *argv[]);
+ char *argv[]);
/*! @} */
@@ -126,22 +126,50 @@ int stasis_app_send(const char *app_name, struct ast_json *message);
struct stasis_app_control;
/*!
- * \brief Returns the handler for the given channel
+ * \brief Returns the handler for the given channel.
* \param chan Channel to handle.
- * \return NULL channel not in Stasis application
- * \return Pointer to stasis handler.
+ * \return NULL channel not in Stasis application.
+ * \return Pointer to \c res_stasis handler.
*/
struct stasis_app_control *stasis_app_control_find_by_channel(
const struct ast_channel *chan);
/*!
- * \brief Exit \c app_stasis and continue execution in the dialplan.
+ * \brief Returns the handler for the channel with the given id.
+ * \param channel_id Uniqueid of the channel.
+ * \return NULL channel not in Stasis application, or channel does not exist.
+ * \return Pointer to \c res_stasis handler.
+ */
+struct stasis_app_control *stasis_app_control_find_by_channel_id(
+ const char *channel_id);
+
+/*!
+ * \brief Exit \c res_stasis and continue execution in the dialplan.
*
- * If the channel is no longer in \c app_stasis, this function does nothing.
+ * If the channel is no longer in \c res_stasis, this function does nothing.
*
- * \param handler Handler for \c app_stasis
+ * \param control Control for \c res_stasis
+ */
+void stasis_app_control_continue(struct stasis_app_control *control);
+
+/*!
+ * \brief Answer the channel associated with this control.
+ * \param control Control for \c res_stasis.
+ * \return 0 for success.
+ * \return -1 for error.
+ */
+int stasis_app_control_answer(struct stasis_app_control *control);
+
+/*! @} */
+
+/*! @{ */
+
+/*!
+ * \brief Build a JSON object from a \ref ast_channel_snapshot.
+ * \return JSON object representing channel snapshot.
+ * \return \c NULL on error
*/
-void stasis_app_control_continue(struct stasis_app_control *handler);
+struct ast_json *ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot);
/*! @} */