summaryrefslogtreecommitdiff
path: root/res/ari/resource_channels.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2014-08-14 16:32:04 +0000
committerRichard Mudgett <rmudgett@digium.com>2014-08-14 16:32:04 +0000
commitee93b5a3148929422f2d77d5ca29ff9e148e0281 (patch)
tree5d6a37e32f56b5a15e87e43f436d750f54c9d8b7 /res/ari/resource_channels.c
parent7eb4ee9b2f991cd269d2ae5b8432690407796f43 (diff)
ARI: Originate to app local channel subscription code optimization.
Reduce the scope of local_peer and only get it if the ARI originate is subscribing to the channels. Review: https://reviewboard.asterisk.org/r/3905/ ........ Merged revisions 421009 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@421010 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ari/resource_channels.c')
-rw-r--r--res/ari/resource_channels.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index 729eeec67..0ac53dd73 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -746,7 +746,6 @@ static void ari_channels_handle_originate_with_id(const char *args_endpoint,
ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT), ao2_cleanup);
char *stuff;
struct ast_channel *chan;
- struct ast_channel *local_peer;
RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
struct ast_assigned_ids assignedids = {
.uniqueid = args_channel_id,
@@ -831,13 +830,16 @@ static void ari_channels_handle_originate_with_id(const char *args_endpoint,
return;
}
- /* See if this is a Local channel and if so, get the peer */
- local_peer = ast_local_get_peer(chan);
-
if (!ast_strlen_zero(args_app)) {
+ struct ast_channel *local_peer;
+
stasis_app_subscribe_channel(args_app, chan);
+
+ /* Subscribe to the Local channel peer also. */
+ local_peer = ast_local_get_peer(chan);
if (local_peer) {
stasis_app_subscribe_channel(args_app, local_peer);
+ ast_channel_unref(local_peer);
}
}
@@ -846,9 +848,6 @@ static void ari_channels_handle_originate_with_id(const char *args_endpoint,
ast_ari_response_ok(response, ast_channel_snapshot_to_json(snapshot, NULL));
ast_channel_unref(chan);
- if (local_peer) {
- ast_channel_unref(local_peer);
- }
}
void ast_ari_channels_originate_with_id(struct ast_variable *headers,