Stasis-HTTP: Flesh out bridge-related capabilities

This adds support for Stasis applications to receive bridge-related
messages when the application shows interest in a given bridge.

To supplement this work and test it, this also adds support for the
following bridge-related Stasis-HTTP functionality:
* GET stasis/bridges
* GET stasis/bridges/{bridgeId}
* POST stasis/bridges
* DELETE stasis/bridges/{bridgeId}
* POST stasis/bridges/{bridgeId}/addChannel
* POST stasis/bridges/{bridgeId}/removeChannel

Review: https://reviewboard.asterisk.org/r/2572/
(closes issue ASTERISK-21711)
(closes issue ASTERISK-21621)
(closes issue ASTERISK-21622)
(closes issue ASTERISK-21623)
(closes issue ASTERISK-21624)
(closes issue ASTERISK-21625)
(closes issue ASTERISK-21626)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391199 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore
2013-06-10 13:07:11 +00:00
parent 0cec7dcdcd
commit a5bbc790e7
16 changed files with 825 additions and 42 deletions

View File

@@ -186,6 +186,56 @@ void stasis_app_control_publish(
int stasis_app_control_queue_control(struct stasis_app_control *control,
enum ast_control_frame_type frame_type);
/*!
* \brief Create a bridge of the specified type.
*
* \param type The type of bridge to be created
*
* \return New bridge.
* \return \c NULL on error.
*/
struct ast_bridge *stasis_app_bridge_create(const char *type);
/*!
* \brief Returns the bridge with the given id.
* \param bridge_id Uniqueid of the bridge.
* \return NULL bridge not created by a Stasis application, or bridge does not exist.
* \return Pointer to bridge.
*/
struct ast_bridge *stasis_app_bridge_find_by_id(
const char *bridge_id);
/*!
* \brief Add a channel to the bridge.
*
* \param control Control whose channel should be added to the bridge
* \param bridge Pointer to the bridge
*/
void stasis_app_control_add_channel_to_bridge(
struct stasis_app_control *control, struct ast_bridge *bridge);
/*!
* \brief Remove a channel from the bridge.
*
* \param control Control whose channel should be removed from the bridge
* \param bridge Pointer to the bridge
*
* \retval non-zero on failure
* \retval zero on success
*/
int stasis_app_control_remove_channel_from_bridge(
struct stasis_app_control *control, struct ast_bridge *bridge);
/*!
* \brief Destroy the bridge.
*
* \param bridge_id Uniqueid of bridge to be destroyed
*
* \retval non-zero on failure
* \retval zero on success
*/
void stasis_app_bridge_destroy(const char *bridge_id);
/*!
* \brief Increment the res_stasis reference count.
*

View File

@@ -206,6 +206,18 @@ void ast_bridge_publish_leave(struct ast_bridge *bridge, struct ast_channel *cha
*/
struct ast_json *ast_bridge_snapshot_to_json(const struct ast_bridge_snapshot *snapshot);
/*!
* \brief Returns the most recent snapshot for the bridge.
*
* The returned pointer is AO2 managed, so ao2_cleanup() when you're done.
*
* \param bridge_id Uniqueid of the bridge for which to get the snapshot.
* \return Most recent snapshot. ao2_cleanup() when done.
* \return \c NULL if channel isn't in cache.
*/
struct ast_bridge_snapshot *ast_bridge_snapshot_get_latest(
const char *bridge_id);
/*!
* \brief Initialize the stasis bridging topic and message types
* \retval 0 on success