Author: rmudgett Date: Thu Aug 14 11:33:27 2014 New Revision: 421012 URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=421012 Log: 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 ........ Merged revisions 421010 from http://svn.asterisk.org/svn/asterisk/branches/13 Modified: trunk/ (props changed) trunk/res/ari/resource_channels.c Propchange: trunk/ ------------------------------------------------------------------------------ --- branch-13-merged (original) +++ branch-13-merged Thu Aug 14 11:33:27 2014 @@ -1,1 +1,1 @@ -/branches/13:1-420494,420514,420534,420536,420538,420562,420577,420592,420609,420624,420639,420657,420717,420742,420758,420779,420796,420803,420808,420837,420856,420879,420881,420899,420919,420940,420950,420957,420992 +/branches/13:1-420494,420514,420534,420536,420538,420562,420577,420592,420609,420624,420639,420657,420717,420742,420758,420779,420796,420803,420808,420837,420856,420879,420881,420899,420919,420940,420950,420957,420992,421010 Modified: trunk/res/ari/resource_channels.c URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_channels.c?view=diff&rev=421012&r1=421011&r2=421012 ============================================================================== --- trunk/res/ari/resource_channels.c (original) +++ trunk/res/ari/resource_channels.c Thu Aug 14 11:33:27 2014 @@ -746,7 +746,6 @@ 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 @@ 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 @@ 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, -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- svn-commits mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/svn-commits