diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-12-17 12:59:49 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-12-17 12:59:49 +0000 |
commit | 76042b1eb4a8163c6b0cd24b102e704a417ed35a (patch) | |
tree | b6b201e6f0b7b3631193608bfb3fdaad38cce9e0 /res/ari | |
parent | 744556c01d6e28d4ae46c347f77edfb71778d924 (diff) |
ari/resource_channels: When creating a channel, specify a default format (SLIN)
When creating channels via ARI, the current code fails to provide any default
format capabilities. For non-virtual channels this isn't really a problem -
the channels typically receive their capabilities as a result of the
underlying channel driver configuration. For virtual channels (such as Local
channels), the lack of any format capabilities causes the Asterisk core to
make some 'odd' choices with respect to the translation paths. The issue
reporter had some paths that had 3 hops on each channel leg, causing multiple
transcodings and some really crappy audio/performance.
By specifying a baseline of SLIN, we prevent that from occurring. Note that
this is what AMI does when it performs an Originate, as does res_clioriginate.
Review: https://reviewboard.asterisk.org/r/3068/
(issue ASTERISK-22962)
Reported by: Matt DiMeo
........
Merged revisions 403993 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@403994 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ari')
-rw-r--r-- | res/ari/resource_channels.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c index 6d85781da..08ef15408 100644 --- a/res/ari/resource_channels.c +++ b/res/ari/resource_channels.c @@ -735,11 +735,20 @@ void ast_ari_channels_originate(struct ast_variable *headers, char *cid_num = NULL; char *cid_name = NULL; int timeout = 30000; + RAII_VAR(struct ast_format_cap *, cap, + ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_NOLOCK), ast_format_cap_destroy); + struct ast_format tmp_fmt; char *stuff; struct ast_channel *chan; RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup); + if (!cap) { + ast_ari_response_alloc_failed(response); + return; + } + ast_format_cap_add(cap, ast_format_set(&tmp_fmt, AST_FORMAT_SLINEAR, 0)); + if (ast_strlen_zero(args->endpoint)) { ast_ari_response_error(response, 400, "Bad Request", "Endpoint must be specified"); @@ -789,13 +798,13 @@ void ast_ari_channels_originate(struct ast_variable *headers, } /* originate a channel, putting it into an application */ - if (ast_pbx_outgoing_app(dialtech, NULL, dialdevice, timeout, app, ast_str_buffer(appdata), NULL, 0, cid_num, cid_name, NULL, NULL, &chan)) { + if (ast_pbx_outgoing_app(dialtech, cap, dialdevice, timeout, app, ast_str_buffer(appdata), NULL, 0, cid_num, cid_name, NULL, NULL, &chan)) { ast_ari_response_alloc_failed(response); return; } } else if (!ast_strlen_zero(args->extension)) { /* originate a channel, sending it to an extension */ - if (ast_pbx_outgoing_exten(dialtech, NULL, dialdevice, timeout, S_OR(args->context, "default"), args->extension, args->priority ? args->priority : 1, NULL, 0, cid_num, cid_name, NULL, NULL, &chan, 0)) { + if (ast_pbx_outgoing_exten(dialtech, cap, dialdevice, timeout, S_OR(args->context, "default"), args->extension, args->priority ? args->priority : 1, NULL, 0, cid_num, cid_name, NULL, NULL, &chan, 0)) { ast_ari_response_alloc_failed(response); return; } |