From b0bb03e916da4b4a37aa65b694e3aa1cecee8648 Mon Sep 17 00:00:00 2001 From: Jonathan Rose Date: Tue, 17 Dec 2013 23:25:49 +0000 Subject: 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 --- include/asterisk/bridge.h | 15 ++++++++++++--- include/asterisk/bridge_internal.h | 6 ++++-- include/asterisk/stasis_app.h | 3 ++- include/asterisk/stasis_bridges.h | 4 ++++ 4 files changed, 22 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/asterisk/bridge.h b/include/asterisk/bridge.h index fdb3803ad..0706b3aed 100644 --- a/include/asterisk/bridge.h +++ b/include/asterisk/bridge.h @@ -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. diff --git a/include/asterisk/bridge_internal.h b/include/asterisk/bridge_internal.h index 871abb8c5..e9726a1ab 100644 --- a/include/asterisk/bridge_internal.h +++ b/include/asterisk/bridge_internal.h @@ -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 diff --git a/include/asterisk/stasis_app.h b/include/asterisk/stasis_app.h index 56e039b43..ac5c64893 100644 --- a/include/asterisk/stasis_app.h +++ b/include/asterisk/stasis_app.h @@ -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. diff --git a/include/asterisk/stasis_bridges.h b/include/asterisk/stasis_bridges.h index 9412bf0b7..2d15a3332 100644 --- a/include/asterisk/stasis_bridges.h +++ b/include/asterisk/stasis_bridges.h @@ -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() */ -- cgit v1.2.3