diff options
author | Kevin Harwell <kharwell@digium.com> | 2013-12-13 17:19:23 +0000 |
---|---|---|
committer | Kevin Harwell <kharwell@digium.com> | 2013-12-13 17:19:23 +0000 |
commit | f425c4a086526d8f4da91d62a5e02121c09609b8 (patch) | |
tree | 9c7c9ca6947d63c5037287e7bbbe4d074c7e777e /res/res_ari_channels.c | |
parent | ce18946de46a6f16463391a9c07af02b8ee4e925 (diff) |
ARI: Allow specifying channel variables during a POST /channels
Added the ability to specify channel variables when creating/originating a
channel in ARI. The variables are sent in the body of the request and should
be formatted as a single level JSON object. No nested objects allowed.
For example: {"variable1": "foo", "variable2": "bar"}.
(closes issue ASTERISK-22872)
Reported by: Matt Jordan
Review: https://reviewboard.asterisk.org/r/3052/
........
Merged revisions 403752 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_ari_channels.c')
-rw-r--r-- | res/res_ari_channels.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/res/res_ari_channels.c b/res/res_ari_channels.c index 40ad32b2b..6b741b04c 100644 --- a/res/res_ari_channels.c +++ b/res/res_ari_channels.c @@ -117,7 +117,6 @@ static void ast_ari_channels_originate_cb( 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; @@ -165,39 +164,7 @@ static void ast_ari_channels_originate_cb( goto fin; } } - /* 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); - } + args.variables = ast_json_ref(body); ast_ari_channels_originate(headers, &args, response); #if defined(AST_DEVMODE) code = response->response_code; |