[asterisk-commits] jrose: trunk r404043 - in /trunk: ./ apps/ doc/ include/asterisk/ main/ res/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 17 17:25:51 CST 2013


Author: jrose
Date: Tue Dec 17 17:25:49 2013
New Revision: 404043

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404043
Log:
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

Modified:
    trunk/   (props changed)
    trunk/apps/app_agent_pool.c
    trunk/apps/app_bridgewait.c
    trunk/apps/app_confbridge.c
    trunk/doc/appdocsxml.xslt
    trunk/include/asterisk/bridge.h
    trunk/include/asterisk/bridge_internal.h
    trunk/include/asterisk/stasis_app.h
    trunk/include/asterisk/stasis_bridges.h
    trunk/main/bridge.c
    trunk/main/bridge_basic.c
    trunk/main/manager_bridges.c
    trunk/main/stasis_bridges.c
    trunk/res/ari/ari_model_validators.c
    trunk/res/ari/ari_model_validators.h
    trunk/res/ari/resource_bridges.c
    trunk/res/ari/resource_bridges.h
    trunk/res/parking/parking_bridge.c
    trunk/res/res_ari_bridges.c
    trunk/res/res_stasis.c
    trunk/rest-api/api-docs/bridges.json

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Tue Dec 17 17:25:49 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-403290,403292-403778,403781-404006,404027,404029
+/branches/12:1-398558,398560-398577,398579-399305,399307-401390,401392-403290,403292-403778,403781-404006,404027,404029,404042

Modified: trunk/apps/app_agent_pool.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_agent_pool.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/apps/app_agent_pool.c (original)
+++ trunk/apps/app_agent_pool.c Tue Dec 17 17:25:49 2013
@@ -1366,7 +1366,8 @@
 	bridge = bridge_alloc(sizeof(struct ast_bridge), &bridge_agent_hold_v_table);
 	bridge = bridge_base_init(bridge, AST_BRIDGE_CAPABILITY_HOLDING,
 		AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
-			| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_TRANSFER_PROHIBITED);
+			| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_TRANSFER_PROHIBITED,
+		"AgentPool", NULL);
 	bridge = bridge_register(bridge);
 	return bridge;
 }

Modified: trunk/apps/app_bridgewait.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_bridgewait.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/apps/app_bridgewait.c (original)
+++ trunk/apps/app_bridgewait.c Tue Dec 17 17:25:49 2013
@@ -360,7 +360,8 @@
 	bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_HOLDING,
 		AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
 		| AST_BRIDGE_FLAG_SWAP_INHIBIT_TO | AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM
-		| AST_BRIDGE_FLAG_TRANSFER_PROHIBITED | AST_BRIDGE_FLAG_DISSOLVE_EMPTY);
+		| AST_BRIDGE_FLAG_TRANSFER_PROHIBITED | AST_BRIDGE_FLAG_DISSOLVE_EMPTY,
+		APP_NAME, bridge_name);
 
 	if (!bridge) {
 		return NULL;

Modified: trunk/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_confbridge.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/apps/app_confbridge.c (original)
+++ trunk/apps/app_confbridge.c Tue Dec 17 17:25:49 2013
@@ -1218,7 +1218,8 @@
 
 		/* Create an actual bridge that will do the audio mixing */
 		conference->bridge = ast_bridge_base_new(AST_BRIDGE_CAPABILITY_MULTIMIX,
-			AST_BRIDGE_FLAG_MASQUERADE_ONLY | AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY);
+			AST_BRIDGE_FLAG_MASQUERADE_ONLY | AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY,
+			app, conference_name);
 		if (!conference->bridge) {
 			ao2_ref(conference, -1);
 			conference = NULL;

Modified: trunk/doc/appdocsxml.xslt
URL: http://svnview.digium.com/svn/asterisk/trunk/doc/appdocsxml.xslt?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/doc/appdocsxml.xslt (original)
+++ trunk/doc/appdocsxml.xslt Tue Dec 17 17:25:49 2013
@@ -120,6 +120,18 @@
         </xsl:element>
         <xsl:element name="parameter">
             <xsl:attribute name="name">
+                <xsl:value-of select="concat(@prefix, 'BridgeCreator')"/>
+            </xsl:attribute>
+            <para>Entity that created the bridge if applicable</para>
+        </xsl:element>
+        <xsl:element name="parameter">
+            <xsl:attribute name="name">
+                <xsl:value-of select="concat(@prefix, 'BridgeName')"/>
+            </xsl:attribute>
+            <para>Name used to refer to the bridge by its BridgeCreator if applicable</para>
+        </xsl:element>
+        <xsl:element name="parameter">
+            <xsl:attribute name="name">
                 <xsl:value-of select="concat(@prefix,'BridgeNumChannels')"/>
             </xsl:attribute>
             <para>Number of channels in the bridge</para>

Modified: trunk/include/asterisk/bridge.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/bridge.h?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/include/asterisk/bridge.h (original)
+++ trunk/include/asterisk/bridge.h Tue Dec 17 17:25:49 2013
@@ -312,8 +312,15 @@
 	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 @@
  *
  * \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 @@
  * 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.

Modified: trunk/include/asterisk/bridge_internal.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/bridge_internal.h?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/include/asterisk/bridge_internal.h (original)
+++ trunk/include/asterisk/bridge_internal.h Tue Dec 17 17:25:49 2013
@@ -87,6 +87,8 @@
  * \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 @@
  * \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

Modified: trunk/include/asterisk/stasis_app.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/stasis_app.h?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/include/asterisk/stasis_app.h (original)
+++ trunk/include/asterisk/stasis_app.h Tue Dec 17 17:25:49 2013
@@ -597,11 +597,12 @@
  * \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.

Modified: trunk/include/asterisk/stasis_bridges.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/stasis_bridges.h?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/include/asterisk/stasis_bridges.h (original)
+++ trunk/include/asterisk/stasis_bridges.h Tue Dec 17 17:25:49 2013
@@ -42,6 +42,10 @@
 		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() */

Modified: trunk/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/bridge.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/main/bridge.c (original)
+++ trunk/main/bridge.c Tue Dec 17 17:25:49 2013
@@ -533,9 +533,11 @@
 	struct ast_bridge dummy_bridge = {
 		.technology = deferred->tech,
 		.tech_pvt = deferred->tech_pvt,
+		.creator = bridge->creator,
+		.name = bridge->name,
+		.uniqueid = bridge->uniqueid,
 		};
 
-	ast_copy_string(dummy_bridge.uniqueid, bridge->uniqueid, sizeof(dummy_bridge.uniqueid));
 	ast_debug(1, "Bridge %s: calling %s technology destructor (deferred, dummy)\n",
 		dummy_bridge.uniqueid, dummy_bridge.technology->name);
 	dummy_bridge.technology->destroy(&dummy_bridge);
@@ -679,6 +681,8 @@
 	cleanup_video_mode(bridge);
 
 	stasis_cp_single_unsubscribe(bridge->topics);
+
+	ast_string_field_free_memory(bridge);
 }
 
 struct ast_bridge *bridge_register(struct ast_bridge *bridge)
@@ -714,19 +718,35 @@
 	}
 
 	bridge = ao2_alloc(size, destroy_bridge);
-	if (bridge) {
-		bridge->v_table = v_table;
-	}
+	if (!bridge) {
+		return NULL;
+	}
+
+	if (ast_string_field_init(bridge, 80)) {
+		ao2_cleanup(bridge);
+		return NULL;
+	}
+
+	bridge->v_table = v_table;
+
 	return bridge;
 }
 
-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)
+{
+	char uuid_hold[AST_UUID_STR_LEN];
+
 	if (!self) {
 		return NULL;
 	}
 
-	ast_uuid_generate_str(self->uniqueid, sizeof(self->uniqueid));
+	ast_uuid_generate_str(uuid_hold, AST_UUID_STR_LEN);
+	ast_string_field_set(self, uniqueid, uuid_hold);
+	ast_string_field_set(self, creator, creator);
+	if (!ast_strlen_zero(creator)) {
+		ast_string_field_set(self, name, name);
+	}
+
 	ast_set_flag(&self->feature_flags, flags);
 	self->allowed_capabilities = capabilities;
 
@@ -881,12 +901,12 @@
 	.get_merge_priority = bridge_base_get_merge_priority,
 };
 
-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)
 {
 	void *bridge;
 
 	bridge = bridge_alloc(sizeof(struct ast_bridge), &ast_bridge_base_v_table);
-	bridge = bridge_base_init(bridge, capabilities, flags);
+	bridge = bridge_base_init(bridge, capabilities, flags, creator, name);
 	bridge = bridge_register(bridge);
 	return bridge;
 }
@@ -991,6 +1011,9 @@
 	struct ast_bridge dummy_bridge = {
 		.technology = bridge->technology,
 		.tech_pvt = bridge->tech_pvt,
+		.creator = bridge->creator,
+		.name = bridge->name,
+		.uniqueid = bridge->uniqueid,
 	};
 
 	if (bridge->dissolved) {
@@ -1042,8 +1065,6 @@
 		ast_module_unref(old_technology->mod);
 		return 0;
 	}
-
-	ast_copy_string(dummy_bridge.uniqueid, bridge->uniqueid, sizeof(dummy_bridge.uniqueid));
 
 	if (old_technology->destroy) {
 		struct tech_deferred_destroy deferred_tech_destroy = {

Modified: trunk/main/bridge_basic.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/bridge_basic.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/main/bridge_basic.c (original)
+++ trunk/main/bridge_basic.c Tue Dec 17 17:25:49 2013
@@ -3239,7 +3239,7 @@
 	bridge = bridge_alloc(sizeof(struct ast_bridge), &ast_bridge_basic_v_table);
 	bridge = bridge_base_init(bridge,
 		AST_BRIDGE_CAPABILITY_NATIVE | AST_BRIDGE_CAPABILITY_1TO1MIX
-			| AST_BRIDGE_CAPABILITY_MULTIMIX, NORMAL_FLAGS);
+			| AST_BRIDGE_CAPABILITY_MULTIMIX, NORMAL_FLAGS, NULL, NULL);
 	bridge = bridge_basic_personality_alloc(bridge);
 	bridge = bridge_register(bridge);
 	return bridge;

Modified: trunk/main/manager_bridges.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager_bridges.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/main/manager_bridges.c (original)
+++ trunk/main/manager_bridges.c Tue Dec 17 17:25:49 2013
@@ -156,10 +156,14 @@
 		"%sBridgeUniqueid: %s\r\n"
 		"%sBridgeType: %s\r\n"
 		"%sBridgeTechnology: %s\r\n"
+		"%sBridgeCreator: %s\r\n"
+		"%sBridgeName: %s\r\n"
 		"%sBridgeNumChannels: %d\r\n",
 		prefix, snapshot->uniqueid,
 		prefix, snapshot->subclass,
 		prefix, snapshot->technology,
+		prefix, ast_strlen_zero(snapshot->creator) ? "<unknown>": snapshot->creator,
+		prefix, ast_strlen_zero(snapshot->name) ? "<unknown>": snapshot->name,
 		prefix, snapshot->num_channels);
 	if (!res) {
 		ast_free(out);

Modified: trunk/main/stasis_bridges.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stasis_bridges.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/main/stasis_bridges.c (original)
+++ trunk/main/stasis_bridges.c Tue Dec 17 17:25:49 2013
@@ -242,6 +242,8 @@
 	ast_string_field_set(snapshot, uniqueid, bridge->uniqueid);
 	ast_string_field_set(snapshot, technology, bridge->technology->name);
 	ast_string_field_set(snapshot, subclass, bridge->v_table->name);
+	ast_string_field_set(snapshot, creator, bridge->creator);
+	ast_string_field_set(snapshot, name, bridge->name);
 
 	snapshot->feature_flags = bridge->feature_flags;
 	snapshot->capabilities = bridge->technology->capabilities;
@@ -548,11 +550,13 @@
 		return NULL;
 	}
 
-	json_bridge = ast_json_pack("{s: s, s: s, s: s, s: s, s: o}",
+	json_bridge = ast_json_pack("{s: s, s: s, s: s, s: s, s: s, s: s, s: o}",
 		"id", snapshot->uniqueid,
 		"technology", snapshot->technology,
 		"bridge_type", capability2str(snapshot->capabilities),
 		"bridge_class", snapshot->subclass,
+		"creator", snapshot->creator,
+		"name", snapshot->name,
 		"channels", json_channels);
 	if (!json_bridge) {
 		return NULL;

Modified: trunk/res/ari/ari_model_validators.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/ari_model_validators.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/res/ari/ari_model_validators.c (original)
+++ trunk/res/ari/ari_model_validators.c Tue Dec 17 17:25:49 2013
@@ -891,7 +891,9 @@
 	int has_bridge_class = 0;
 	int has_bridge_type = 0;
 	int has_channels = 0;
+	int has_creator = 0;
 	int has_id = 0;
+	int has_name = 0;
 	int has_technology = 0;
 
 	for (iter = ast_json_object_iter(json); iter; iter = ast_json_object_iter_next(json, iter)) {
@@ -926,6 +928,16 @@
 				res = 0;
 			}
 		} else
+		if (strcmp("creator", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_creator = 1;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI Bridge field creator failed validation\n");
+				res = 0;
+			}
+		} else
 		if (strcmp("id", ast_json_object_iter_key(iter)) == 0) {
 			int prop_is_valid;
 			has_id = 1;
@@ -933,6 +945,16 @@
 				ast_json_object_iter_value(iter));
 			if (!prop_is_valid) {
 				ast_log(LOG_ERROR, "ARI Bridge field id failed validation\n");
+				res = 0;
+			}
+		} else
+		if (strcmp("name", ast_json_object_iter_key(iter)) == 0) {
+			int prop_is_valid;
+			has_name = 1;
+			prop_is_valid = ast_ari_validate_string(
+				ast_json_object_iter_value(iter));
+			if (!prop_is_valid) {
+				ast_log(LOG_ERROR, "ARI Bridge field name failed validation\n");
 				res = 0;
 			}
 		} else
@@ -969,8 +991,18 @@
 		res = 0;
 	}
 
+	if (!has_creator) {
+		ast_log(LOG_ERROR, "ARI Bridge missing required field creator\n");
+		res = 0;
+	}
+
 	if (!has_id) {
 		ast_log(LOG_ERROR, "ARI Bridge missing required field id\n");
+		res = 0;
+	}
+
+	if (!has_name) {
+		ast_log(LOG_ERROR, "ARI Bridge missing required field name\n");
 		res = 0;
 	}
 

Modified: trunk/res/ari/ari_model_validators.h
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/ari_model_validators.h?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/res/ari/ari_model_validators.h (original)
+++ trunk/res/ari/ari_model_validators.h Tue Dec 17 17:25:49 2013
@@ -1083,7 +1083,9 @@
  * - bridge_class: string (required)
  * - bridge_type: string (required)
  * - channels: List[string] (required)
+ * - creator: string (required)
  * - id: string (required)
+ * - name: string (required)
  * - technology: string (required)
  * LiveRecording
  * - cause: string

Modified: trunk/res/ari/resource_bridges.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_bridges.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/res/ari/resource_bridges.c (original)
+++ trunk/res/ari/resource_bridges.c Tue Dec 17 17:25:49 2013
@@ -695,7 +695,7 @@
 	struct ast_ari_bridges_create_args *args,
 	struct ast_ari_response *response)
 {
-	RAII_VAR(struct ast_bridge *, bridge, stasis_app_bridge_create(args->type), ao2_cleanup);
+	RAII_VAR(struct ast_bridge *, bridge, stasis_app_bridge_create(args->type, args->name), ao2_cleanup);
 	RAII_VAR(struct ast_bridge_snapshot *, snapshot, NULL, ao2_cleanup);
 
 	if (!bridge) {

Modified: trunk/res/ari/resource_bridges.h
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_bridges.h?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/res/ari/resource_bridges.h (original)
+++ trunk/res/ari/resource_bridges.h Tue Dec 17 17:25:49 2013
@@ -54,6 +54,8 @@
 struct ast_ari_bridges_create_args {
 	/*! \brief Type of bridge to create. */
 	const char *type;
+	/*! \brief Name to give to the bridge being created. */
+	const char *name;
 };
 /*!
  * \brief Create a new bridge.

Modified: trunk/res/parking/parking_bridge.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/parking/parking_bridge.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/res/parking/parking_bridge.c (original)
+++ trunk/res/parking/parking_bridge.c Tue Dec 17 17:25:49 2013
@@ -456,7 +456,7 @@
 	bridge = bridge_alloc(sizeof(struct ast_bridge_parking), &ast_bridge_parking_v_table);
 	bridge = bridge_base_init(bridge, AST_BRIDGE_CAPABILITY_HOLDING,
 		AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
-		| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM);
+		| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM,  "Parking", bridge_lot->name);
 	bridge = ast_bridge_parking_init(bridge, bridge_lot);
 	bridge = bridge_register(bridge);
 	return bridge;

Modified: trunk/res/res_ari_bridges.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_ari_bridges.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/res/res_ari_bridges.c (original)
+++ trunk/res/res_ari_bridges.c Tue Dec 17 17:25:49 2013
@@ -127,6 +127,9 @@
 		if (strcmp(i->name, "type") == 0) {
 			args.type = (i->value);
 		} else
+		if (strcmp(i->name, "name") == 0) {
+			args.name = (i->value);
+		} else
 		{}
 	}
 	/* Look for a JSON request entity */
@@ -148,6 +151,10 @@
 	field = ast_json_object_get(body, "type");
 	if (field) {
 		args.type = ast_json_string_get(field);
+	}
+	field = ast_json_object_get(body, "name");
+	if (field) {
+		args.name = ast_json_string_get(field);
 	}
 	ast_ari_bridges_create(headers, &args, response);
 #if defined(AST_DEVMODE)

Modified: trunk/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_stasis.c?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/res/res_stasis.c (original)
+++ trunk/res/res_stasis.c Tue Dec 17 17:25:49 2013
@@ -585,7 +585,7 @@
 	ao2_cleanup(control);
 }
 
-struct ast_bridge *stasis_app_bridge_create(const char *type)
+struct ast_bridge *stasis_app_bridge_create(const char *type, const char *name)
 {
 	struct ast_bridge *bridge;
 	int capabilities;
@@ -604,7 +604,7 @@
 		return NULL;
 	}
 
-	bridge = ast_bridge_base_new(capabilities, flags);
+	bridge = ast_bridge_base_new(capabilities, flags, "Stasis", name);
 	if (bridge) {
 		if (!ao2_link(app_bridges, bridge)) {
 			ast_bridge_destroy(bridge, 0);

Modified: trunk/rest-api/api-docs/bridges.json
URL: http://svnview.digium.com/svn/asterisk/trunk/rest-api/api-docs/bridges.json?view=diff&rev=404043&r1=404042&r2=404043
==============================================================================
--- trunk/rest-api/api-docs/bridges.json (original)
+++ trunk/rest-api/api-docs/bridges.json Tue Dec 17 17:25:49 2013
@@ -38,6 +38,14 @@
 									"holding"
 								]
 							}
+						},
+						{
+							"name": "name",
+							"description": "Name to give to the bridge being created.",
+							"paramType": "query",
+							"required": false,
+							"allowMultiple": false,
+							"dataType": "string"
 						}
 					]
 				}
@@ -502,6 +510,16 @@
 					"description": "Bridging class",
 					"required": true
 				},
+				"creator": {
+					"type": "string",
+					"description": "Entity that created the bridge",
+					"required": true
+				},
+				"name": {
+					"type": "string",
+					"description": "Name the creator gave the bridge",
+					"required": true
+				},
 				"channels": {
 					"type": "List[string]",
 					"description": "Ids of channels participating in this bridge",




More information about the asterisk-commits mailing list