struct ast_ari_channels_create_args *args,
struct ast_ari_response *response)
{
+ struct ast_variable *variables = NULL;
struct ast_assigned_ids assignedids = {
.uniqueid = args->channel_id,
.uniqueid2 = args->other_channel_id,
return;
}
+ /* Parse any query parameters out of the body parameter */
+ if (args->variables) {
+ struct ast_json *json_variables;
+
+ ast_ari_channels_create_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;
+ }
+ }
+
chan_data = ast_calloc(1, sizeof(*chan_data));
if (!chan_data) {
ast_ari_response_alloc_failed(response);
stasis_app_subscribe_channel(args->app, chan_data->chan);
}
+ if (variables) {
+ ast_set_variables(chan_data->chan, variables);
+ }
+
ast_channel_cleanup(originator);
if (save_dialstring(chan_data->chan, stuff)) {
const char *originator;
/*! The format name capability list to use if originator is not specified. Ex. "ulaw,slin16". Format names can be found with "core show codecs". */
const char *formats;
+ /*! The "variables" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { "endpoint": "SIP/Alice", "variables": { "CALLERID(name)": "Alice" } } */
+ struct ast_json *variables;
};
/*!
* \brief Body parsing function for /channels/create.
} else
{}
}
- if (ast_ari_channels_create_parse_body(body, &args)) {
- ast_ari_response_alloc_failed(response);
- goto fin;
- }
+ args.variables = body;
ast_ari_channels_create(headers, &args, response);
#if defined(AST_DEVMODE)
code = response->response_code;
"required": false,
"allowMultiple": false,
"dataType": "string"
+ },
+ {
+ "name": "variables",
+ "description": "The \"variables\" key in the body object holds variable key/value pairs to set on the channel on creation. Other keys in the body object are interpreted as query parameters. Ex. { \"endpoint\": \"SIP/Alice\", \"variables\": { \"CALLERID(name)\": \"Alice\" } }",
+ "paramType": "body",
+ "required": false,
+ "dataType": "containers",
+ "allowMultiple": false
}
],
"errorResponses": [