bridging: Give bridges a name and a known creator

Bridges have two new optional properties, a creator and a name.
Certain consumers of bridges will automatically provide bridges that
they create with these properties. Examples include app_bridgewait,
res_parking, app_confbridge, and app_agent_pool. In addition, a name
may now be provided as an argument to the POST function for creating
new bridges via ARI.

(closes issue AFS-47)
Review: https://reviewboard.asterisk.org/r/3070/
........

Merged revisions 404042 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Jonathan Rose
2013-12-17 23:25:49 +00:00
parent 91d0f30506
commit b0bb03e916
20 changed files with 145 additions and 24 deletions

View File

@@ -312,8 +312,15 @@ struct ast_bridge {
unsigned int dissolved:1;
/*! TRUE if the bridge construction was completed. */
unsigned int construction_completed:1;
/*! Immutable bridge UUID. */
char uniqueid[AST_UUID_STR_LEN];
AST_DECLARE_STRING_FIELDS(
/*! Immutable name of the creator for the bridge */
AST_STRING_FIELD(creator);
/*! Immutable name given to the bridge by its creator */
AST_STRING_FIELD(name);
/*! Immutable bridge UUID. */
AST_STRING_FIELD(uniqueid);
);
};
/*! \brief Bridge base class virtual method table. */
@@ -324,6 +331,8 @@ extern struct ast_bridge_methods ast_bridge_base_v_table;
*
* \param capabilities The capabilities that we require to be used on the bridge
* \param flags Flags that will alter the behavior of the bridge
* \param creator Entity that created the bridge (optional)
* \param name Name given to the bridge by its creator (optional, requires named creator)
*
* \retval a pointer to a new bridge on success
* \retval NULL on failure
@@ -338,7 +347,7 @@ extern struct ast_bridge_methods ast_bridge_base_v_table;
* This creates a no frills two party bridge that will be
* destroyed once one of the channels hangs up.
*/
struct ast_bridge *ast_bridge_base_new(uint32_t capabilities, unsigned int flags);
struct ast_bridge *ast_bridge_base_new(uint32_t capabilities, unsigned int flags, const char *creator, const char *name);
/*!
* \brief Try locking the bridge.

View File

@@ -87,6 +87,8 @@ struct ast_bridge *bridge_alloc(size_t size, const struct ast_bridge_methods *v_
* \param self Bridge to operate upon. (Tolerates a NULL pointer)
* \param capabilities The capabilities that we require to be used on the bridge
* \param flags Flags that will alter the behavior of the bridge
* \param creator Entity that created the bridge (optional)
* \param name Name given to the bridge by its creator (optional, requires named creator)
*
* \retval self on success
* \retval NULL on failure, self is already destroyed
@@ -96,13 +98,13 @@ struct ast_bridge *bridge_alloc(size_t size, const struct ast_bridge_methods *v_
* \code
* struct ast_bridge *bridge;
* bridge = bridge_alloc(sizeof(*bridge), &ast_bridge_base_v_table);
* bridge = bridge_base_init(bridge, AST_BRIDGE_CAPABILITY_1TO1MIX, AST_BRIDGE_FLAG_DISSOLVE_HANGUP);
* bridge = bridge_base_init(bridge, AST_BRIDGE_CAPABILITY_1TO1MIX, AST_BRIDGE_FLAG_DISSOLVE_HANGUP, NULL, NULL);
* \endcode
*
* This creates a no frills two party bridge that will be
* destroyed once one of the channels hangs up.
*/
struct ast_bridge *bridge_base_init(struct ast_bridge *self, uint32_t capabilities, unsigned int flags);
struct ast_bridge *bridge_base_init(struct ast_bridge *self, uint32_t capabilities, unsigned int flags, const char *creator, const char *name);
/*!
* \internal

View File

@@ -597,11 +597,12 @@ int stasis_app_control_queue_control(struct stasis_app_control *control,
* \brief Create a bridge of the specified type.
*
* \param type The type of bridge to be created
* \param name Optional name to give to the bridge
*
* \return New bridge.
* \return \c NULL on error.
*/
struct ast_bridge *stasis_app_bridge_create(const char *type);
struct ast_bridge *stasis_app_bridge_create(const char *type, const char *name);
/*!
* \brief Returns the bridge with the given id.

View File

@@ -42,6 +42,10 @@ struct ast_bridge_snapshot {
AST_STRING_FIELD(technology);
/*! Bridge subclass that is handling the bridge */
AST_STRING_FIELD(subclass);
/*! Creator of the bridge */
AST_STRING_FIELD(creator);
/*! Name given to the bridge by its creator */
AST_STRING_FIELD(name);
);
/*! AO2 container of bare channel uniqueid strings participating in the bridge.
* Allocated from ast_str_container_alloc() */