diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-10-04 16:01:48 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-10-04 16:01:48 +0000 |
commit | 8d7873b836999b09caad87abec27579f1f065b84 (patch) | |
tree | cdf683ab18142553b42102de6c5ca52fc71b22a2 /res/stasis/app.h | |
parent | b52c972b172087d27178c0e60127d486d4e500f8 (diff) |
ARI: Add subscription support
This patch adds an /applications API to ARI, allowing explicit management of
Stasis applications.
* GET /applications - list current applications
* GET /applications/{applicationName} - get details of a specific application
* POST /applications/{applicationName}/subscription - explicitly subscribe to
a channel, bridge or endpoint
* DELETE /applications/{applicationName}/subscription - explicitly unsubscribe
from a channel, bridge or endpoint
Subscriptions work by a reference counting mechanism: if you subscript to an
event source X number of times, you must unsubscribe X number of times to stop
receiveing events for that event source.
Review: https://reviewboard.asterisk.org/r/2862
(issue ASTERISK-22451)
Reported by: Matt Jordan
........
Merged revisions 400522 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/stasis/app.h')
-rw-r--r-- | res/stasis/app.h | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/res/stasis/app.h b/res/stasis/app.h index 5f9f1d7e7..4db9db97d 100644 --- a/res/stasis/app.h +++ b/res/stasis/app.h @@ -114,6 +114,8 @@ void app_send(struct app *app, struct ast_json *message); struct app_forwards; +struct ast_json *app_to_json(const struct app *app); + /*! * \brief Subscribes an application to a channel. * @@ -128,11 +130,33 @@ int app_subscribe_channel(struct app *app, struct ast_channel *chan); * \brief Cancel the subscription an app has for a channel. * * \param app Subscribing application. - * \param forwards Returned object from app_subscribe_channel(). + * \param chan Channel to unsubscribe from. + * \return 0 on success. + * \return Non-zero on error. */ int app_unsubscribe_channel(struct app *app, struct ast_channel *chan); /*! + * \brief Cancel the subscription an app has for a channel. + * + * \param app Subscribing application. + * \param channel_id Id of channel to unsubscribe from. + * \return 0 on success. + * \return Non-zero on error. + */ +int app_unsubscribe_channel_id(struct app *app, const char *channel_id); + +/*! + * \brief Test if an app is subscribed to a channel. + * + * \param app Subscribing application. + * \param channel_id Id of channel to check. + * \return True (non-zero) if channel is subscribed to \a app. + * \return False (zero) if channel is not subscribed. + */ +int app_is_subscribed_channel_id(struct app *app, const char *channel_id); + +/*! * \brief Add a bridge subscription to an existing channel subscription. * * \param app Application. @@ -152,4 +176,54 @@ int app_subscribe_bridge(struct app *app, struct ast_bridge *bridge); */ int app_unsubscribe_bridge(struct app *app, struct ast_bridge *bridge); +/*! + * \brief Cancel the subscription an app has for a bridge. + * + * \param app Subscribing application. + * \param bridge_id Id of bridge to unsubscribe from. + * \return 0 on success. + * \return Non-zero on error. + */ +int app_unsubscribe_bridge_id(struct app *app, const char *bridge_id); + +/*! + * \brief Test if an app is subscribed to a bridge. + * + * \param app Subscribing application. + * \param bridge_id Id of bridge to check. + * \return True (non-zero) if bridge is subscribed to \a app. + * \return False (zero) if bridge is not subscribed. + */ +int app_is_subscribed_bridge_id(struct app *app, const char *bridge_id); + +/*! + * \brief Subscribes an application to a endpoint. + * + * \param app Application. + * \param chan Endpoint to subscribe to. + * \return 0 on success. + * \return Non-zero on error. + */ +int app_subscribe_endpoint(struct app *app, struct ast_endpoint *endpoint); + +/*! + * \brief Cancel the subscription an app has for a endpoint. + * + * \param app Subscribing application. + * \param endpoint_id Id of endpoint to unsubscribe from. + * \return 0 on success. + * \return Non-zero on error. + */ +int app_unsubscribe_endpoint_id(struct app *app, const char *endpoint_id); + +/*! + * \brief Test if an app is subscribed to a endpoint. + * + * \param app Subscribing application. + * \param endpoint_id Id of endpoint to check. + * \return True (non-zero) if endpoint is subscribed to \a app. + * \return False (zero) if endpoint is not subscribed. + */ +int app_is_subscribed_endpoint_id(struct app *app, const char *endpoint_id); + #endif /* _ASTERISK_RES_STASIS_APP_H */ |