[Asterisk-code-review] resource_channels.c: Fix wrong external media parameter parse (asterisk[master])

sungtae kim asteriskteam at digium.com
Tue Aug 31 02:53:17 CDT 2021


sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16404 )


Change subject: resource_channels.c: Fix wrong external media parameter parse
......................................................................

resource_channels.c: Fix wrong external media parameter parse

Fixed ARI channels/externalMedia handler to accept body parameters.

ASTERISK-29622

Change-Id: I49509c48a6cbc0fb4165bfa4f834b5e8b9ace20d
---
M res/ari/resource_channels.c
1 file changed, 12 insertions(+), 11 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/04/16404/1

diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index a3d0f31..e792a2a 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -2188,6 +2188,18 @@
 
 	ast_assert(response != NULL);
 
+	/* Parse any query parameters out of the body parameter */
+	if (args->variables) {
+		struct ast_json *json_variables;
+
+		ast_ari_channels_external_media_parse_body(args->variables, args);
+		json_variables = ast_json_object_get(args->variables, "variables");
+		if (json_variables
+			&& json_to_ast_variables(response, json_variables, &variables)) {
+			return;
+		}
+	}
+
 	if (ast_strlen_zero(args->app)) {
 		ast_ari_response_error(response, 400, "Bad Request", "app cannot be empty");
 		return;
@@ -2222,17 +2234,6 @@
 		args->direction = "both";
 	}
 
-	if (args->variables) {
-		struct ast_json *json_variables;
-
-		ast_ari_channels_external_media_parse_body(args->variables, args);
-		json_variables = ast_json_object_get(args->variables, "variables");
-		if (json_variables
-			&& json_to_ast_variables(response, json_variables, &variables)) {
-			return;
-		}
-	}
-
 	if (strcasecmp(args->encapsulation, "rtp") == 0 && strcasecmp(args->transport, "udp") == 0) {
 		external_media_rtp_udp(args, variables, response);
 	} else if (strcasecmp(args->encapsulation, "audiosocket") == 0 && strcasecmp(args->transport, "tcp") == 0) {

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16404
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I49509c48a6cbc0fb4165bfa4f834b5e8b9ace20d
Gerrit-Change-Number: 16404
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210831/705fc19d/attachment.html>


More information about the asterisk-code-review mailing list