[svn-commits] file: branch 12 r410904 - in /branches/12: ./ res/ res/ari/ rest-api/api-docs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 19 07:53:10 CDT 2014


Author: file
Date: Wed Mar 19 07:52:55 2014
New Revision: 410904

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=410904
Log:
res_stasis: Extend bridge type to be a comma separated list of bridge attributes.

This change turns the bridge type field into a comma separated list of attributes.
These attributes include: mixing, holding, dtmf_events, and proxy_media. By setting
the various attributes a user can control the type of bridge created with the
behavior they need for their application.

(closes issue ASTERISK-23437)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/3359/

Modified:
    branches/12/CHANGES
    branches/12/res/ari/resource_bridges.h
    branches/12/res/res_stasis.c
    branches/12/rest-api/api-docs/bridges.json

Modified: branches/12/CHANGES
URL: http://svnview.digium.com/svn/asterisk/branches/12/CHANGES?view=diff&rev=410904&r1=410903&r2=410904
==============================================================================
--- branches/12/CHANGES (original)
+++ branches/12/CHANGES Wed Mar 19 07:52:55 2014
@@ -21,6 +21,9 @@
 ------------------
  * The live recording object on recording events now contains a target_uri
    field which contains the URI of what is being recorded.
+ * The bridge type used when creating a bridge is now a comma separated list of
+   bridge properties. Valid options are: mixing, holding, dtmf_events, and
+   proxy_media.
 
  * A channelId can now be provided when creating a channel, either in the
    uri (POST channels/my-channel-id) or as query parameter.  A local channel

Modified: branches/12/res/ari/resource_bridges.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/ari/resource_bridges.h?view=diff&rev=410904&r1=410903&r2=410904
==============================================================================
--- branches/12/res/ari/resource_bridges.h (original)
+++ branches/12/res/ari/resource_bridges.h Wed Mar 19 07:52:55 2014
@@ -52,7 +52,7 @@
 void ast_ari_bridges_list(struct ast_variable *headers, struct ast_ari_bridges_list_args *args, struct ast_ari_response *response);
 /*! \brief Argument struct for ast_ari_bridges_create() */
 struct ast_ari_bridges_create_args {
-	/*! \brief Type of bridge to create. */
+	/*! \brief Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media). */
 	const char *type;
 	/*! \brief Unique ID to give to the bridge being created. */
 	const char *bridge_id;
@@ -82,7 +82,7 @@
 void ast_ari_bridges_create(struct ast_variable *headers, struct ast_ari_bridges_create_args *args, struct ast_ari_response *response);
 /*! \brief Argument struct for ast_ari_bridges_create_or_update_with_id() */
 struct ast_ari_bridges_create_or_update_with_id_args {
-	/*! \brief Set the type of bridge. */
+	/*! \brief Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media) to set. */
 	const char *type;
 	/*! \brief Unique ID to give to the bridge being created. */
 	const char *bridge_id;

Modified: branches/12/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/res/res_stasis.c?view=diff&rev=410904&r1=410903&r2=410904
==============================================================================
--- branches/12/res/res_stasis.c (original)
+++ branches/12/res/res_stasis.c Wed Mar 19 07:52:55 2014
@@ -588,19 +588,29 @@
 struct ast_bridge *stasis_app_bridge_create(const char *type, const char *name, const char *id)
 {
 	struct ast_bridge *bridge;
-	int capabilities;
+	char *requested_type, *requested_types = ast_strdupa(type);
+	int capabilities = 0;
 	int flags = AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM | AST_BRIDGE_FLAG_MERGE_INHIBIT_TO
 		| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_SWAP_INHIBIT_TO
 		| AST_BRIDGE_FLAG_TRANSFER_BRIDGE_ONLY;
 
-	if (ast_strlen_zero(type) || !strcmp(type, "mixing")) {
-		capabilities = AST_BRIDGE_CAPABILITY_1TO1MIX |
-			AST_BRIDGE_CAPABILITY_MULTIMIX |
-			AST_BRIDGE_CAPABILITY_NATIVE;
-		flags |= AST_BRIDGE_FLAG_SMART;
-	} else if (!strcmp(type, "holding")) {
-		capabilities = AST_BRIDGE_CAPABILITY_HOLDING;
-	} else {
+	while ((requested_type = strsep(&requested_types, ","))) {
+		requested_type = ast_strip(requested_type);
+
+		if (!strcmp(requested_type, "mixing")) {
+			capabilities |= AST_BRIDGE_CAPABILITY_1TO1MIX |
+				AST_BRIDGE_CAPABILITY_MULTIMIX |
+				AST_BRIDGE_CAPABILITY_NATIVE;
+			flags |= AST_BRIDGE_FLAG_SMART;
+		} else if (!strcmp(requested_type, "holding")) {
+			capabilities |= AST_BRIDGE_CAPABILITY_HOLDING;
+		} else if (!strcmp(requested_type, "dtmf_events") ||
+			!strcmp(requested_type, "proxy_media")) {
+			capabilities &= ~AST_BRIDGE_CAPABILITY_NATIVE;
+		}
+	}
+
+	if (!capabilities) {
 		return NULL;
 	}
 

Modified: branches/12/rest-api/api-docs/bridges.json
URL: http://svnview.digium.com/svn/asterisk/branches/12/rest-api/api-docs/bridges.json?view=diff&rev=410904&r1=410903&r2=410904
==============================================================================
--- branches/12/rest-api/api-docs/bridges.json (original)
+++ branches/12/rest-api/api-docs/bridges.json Wed Mar 19 07:52:55 2014
@@ -26,18 +26,11 @@
 					"parameters": [
 						{
 							"name": "type",
-							"description": "Type of bridge to create.",
-							"paramType": "query",
-							"required": false,
-							"allowMultiple": false,
-							"dataType": "string",
-							"allowableValues": {
-								"valueType": "LIST",
-								"values": [
-									"mixing",
-									"holding"
-								]
-							}
+							"description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media).",
+							"paramType": "query",
+							"required": false,
+							"allowMultiple": false,
+							"dataType": "string"
 						},
 						{
 							"name": "bridgeId",
@@ -72,18 +65,11 @@
 					"parameters": [
 						{
 							"name": "type",
-							"description": "Set the type of bridge.",
-							"paramType": "query",
-							"required": false,
-							"allowMultiple": false,
-							"dataType": "string",
-							"allowableValues": {
-								"valueType": "LIST",
-								"values": [
-									"mixing",
-									"holding"
-								]
-							}
+							"description": "Comma separated list of bridge type attributes (mixing, holding, dtmf_events, proxy_media) to set.",
+							"paramType": "query",
+							"required": false,
+							"allowMultiple": false,
+							"dataType": "string"
 						},
 						{
 							"name": "bridgeId",




More information about the svn-commits mailing list