[asterisk-commits] dlee: trunk r404512 - in /trunk: ./ res/ res/ari/ rest-api/api-docs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 20 16:04:17 CST 2013


Author: dlee
Date: Fri Dec 20 16:04:15 2013
New Revision: 404512

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=404512
Log:
ari: Remove support for specifying channel vars during origination.

When we added support for specifying channel variables for an
origination, we didn't consider how that would interact with another
feature, namely specifying request parameters in a JSON request body.

The method of specifying channel variables (as a flat JSON object passed
in the JSON body) interferes with parsing parameters out of the request
body.

Unfortunately, fixing this would be a backward incompatible change. In
the interest of keeping the API sane and keeping our release schedule,
we're dropping the feature for specifying channel variables in the
origination request.

We will bring the feature back soon, as a backward compatible addition
to the API.

(closes issue ASTERISK-23051)
Review: https://reviewboard.asterisk.org/r/3088
........

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

Modified:
    trunk/   (props changed)
    trunk/res/ari/resource_channels.c
    trunk/res/ari/resource_channels.h
    trunk/res/res_ari_channels.c
    trunk/rest-api/api-docs/applications.json
    trunk/rest-api/api-docs/channels.json

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/res/ari/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_channels.c?view=diff&rev=404512&r1=404511&r2=404512
==============================================================================
--- trunk/res/ari/resource_channels.c (original)
+++ trunk/res/ari/resource_channels.c Fri Dec 20 16:04:15 2013
@@ -687,43 +687,6 @@
 	ast_ari_response_ok(response, ast_json_ref(json));
 }
 
-static int ari_channels_set_channel_var(struct ast_channel *chan,
-	const char *variable, const char *value, struct ast_ari_response *response)
-{
-	if (pbx_builtin_setvar_helper(chan, variable, value)) {
-		ast_ari_response_error(
-			response, 400, "Bad Request",
-			"Unable to set channel variable %s=%s", variable, value);
-		return -1;
-	}
-
-	return 0;
-}
-
-static int ari_channels_set_channel_vars(struct ast_channel *chan,
-	struct ast_json *variables, struct ast_ari_response *response)
-{
-	struct ast_json_iter *i;
-
-	if (!variables) {
-		/* nothing to do */
-		return 0;
-	}
-
-	for (i = ast_json_object_iter(variables); i;
-	     i = ast_json_object_iter_next(variables, i)) {
-		if (ari_channels_set_channel_var(
-			chan, ast_json_object_iter_key(i),
-			ast_json_string_get(ast_json_object_iter_value(i)),
-			response)) {
-			/* response filled in by called function */
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
 void ast_ari_channels_originate(struct ast_variable *headers,
 	struct ast_ari_channels_originate_args *args,
 	struct ast_ari_response *response)
@@ -813,11 +776,6 @@
 		return;
 	}
 
-	if (ari_channels_set_channel_vars(chan, args->variables, response)) {
-		/* response filled in by called function */
-		return;
-	}
-
 	snapshot = ast_channel_snapshot_create(chan);
 	ast_channel_unlock(chan);
 

Modified: trunk/res/ari/resource_channels.h
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_channels.h?view=diff&rev=404512&r1=404511&r2=404512
==============================================================================
--- trunk/res/ari/resource_channels.h (original)
+++ trunk/res/ari/resource_channels.h Fri Dec 20 16:04:15 2013
@@ -68,8 +68,6 @@
 	const char *caller_id;
 	/*! \brief Timeout (in seconds) before giving up dialing, or -1 for no timeout. */
 	int timeout;
-	/*! \brief Variables to be set on the channel. */
-	struct ast_json *variables;
 };
 /*!
  * \brief Create a new channel (originate).

Modified: trunk/res/res_ari_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_ari_channels.c?view=diff&rev=404512&r1=404511&r2=404512
==============================================================================
--- trunk/res/res_ari_channels.c (original)
+++ trunk/res/res_ari_channels.c Fri Dec 20 16:04:15 2013
@@ -117,6 +117,7 @@
 	struct ast_ari_channels_originate_args args = {};
 	struct ast_variable *i;
 	RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
+	struct ast_json *field;
 #if defined(AST_DEVMODE)
 	int is_valid;
 	int code;
@@ -164,7 +165,39 @@
 			goto fin;
 		}
 	}
-	args.variables = ast_json_ref(body);
+	/* Parse query parameters out of it */
+	field = ast_json_object_get(body, "endpoint");
+	if (field) {
+		args.endpoint = ast_json_string_get(field);
+	}
+	field = ast_json_object_get(body, "extension");
+	if (field) {
+		args.extension = ast_json_string_get(field);
+	}
+	field = ast_json_object_get(body, "context");
+	if (field) {
+		args.context = ast_json_string_get(field);
+	}
+	field = ast_json_object_get(body, "priority");
+	if (field) {
+		args.priority = ast_json_integer_get(field);
+	}
+	field = ast_json_object_get(body, "app");
+	if (field) {
+		args.app = ast_json_string_get(field);
+	}
+	field = ast_json_object_get(body, "appArgs");
+	if (field) {
+		args.app_args = ast_json_string_get(field);
+	}
+	field = ast_json_object_get(body, "callerId");
+	if (field) {
+		args.caller_id = ast_json_string_get(field);
+	}
+	field = ast_json_object_get(body, "timeout");
+	if (field) {
+		args.timeout = ast_json_integer_get(field);
+	}
 	ast_ari_channels_originate(headers, &args, response);
 #if defined(AST_DEVMODE)
 	code = response->response_code;

Modified: trunk/rest-api/api-docs/applications.json
URL: http://svnview.digium.com/svn/asterisk/trunk/rest-api/api-docs/applications.json?view=diff&rev=404512&r1=404511&r2=404512
==============================================================================
--- trunk/rest-api/api-docs/applications.json (original)
+++ trunk/rest-api/api-docs/applications.json Fri Dec 20 16:04:15 2013
@@ -107,7 +107,7 @@
 						},
 						{
 							"name": "eventSource",
-							"description": "URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}/{resource}, device_state:{deviceName}",
+							"description": "URI for event source (channel:{channelId}, bridge:{bridgeId}, endpoint:{tech}/{resource}, deviceState:{deviceName}",
 							"paramType": "query",
 							"required": true,
 							"allowMultiple": true,

Modified: trunk/rest-api/api-docs/channels.json
URL: http://svnview.digium.com/svn/asterisk/trunk/rest-api/api-docs/channels.json?view=diff&rev=404512&r1=404511&r2=404512
==============================================================================
--- trunk/rest-api/api-docs/channels.json (original)
+++ trunk/rest-api/api-docs/channels.json Fri Dec 20 16:04:15 2013
@@ -88,14 +88,6 @@
 							"allowMultiple": false,
 							"dataType": "int",
 							"defaultValue": 30
-						},
-						{
-							"name": "variables",
-							"description": "Variables to be set on the channel.",
-							"paramType": "body",
-							"required": false,
-							"allowMultiple": false,
-							"dataType": "containers"
 						}
 					],
 					"errorResponses": [




More information about the asterisk-commits mailing list