[asterisk-commits] kmoore: trunk r430356 - in /trunk: ./ res/res_stasis.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 7 15:26:52 CST 2015


Author: kmoore
Date: Wed Jan  7 15:26:48 2015
New Revision: 430356

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=430356
Log:
ARI: Allow usage of ASYNCGOTO with Stasis()

When the AMI Redirect action is used with a channel bridged inside
Stasis() and not running a pbx, the channel is hung up instead of
proceeding to the desired location in dialplan. This change allows
such channels to be Redirected properly by detecting the operation
used by Redirect (ASYNCGOTO) and using the code already established
for functionality of the ARI channel continue operation.

ASTERISK-24591 #close
Review: https://reviewboard.asterisk.org/r/4271/
........

Merged revisions 430355 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    trunk/   (props changed)
    trunk/res/res_stasis.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/res/res_stasis.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_stasis.c?view=diff&rev=430356&r1=430355&r2=430356
==============================================================================
--- trunk/res/res_stasis.c (original)
+++ trunk/res/res_stasis.c Wed Jan  7 15:26:48 2015
@@ -1373,13 +1373,26 @@
 	control_unlink(control);
 	control = NULL;
 
-	if (!ast_check_hangup_locked(chan) && !ast_channel_pbx(chan)) {
-		struct ast_pbx_args pbx_args;
-
-		memset(&pbx_args, 0, sizeof(pbx_args));
-		pbx_args.no_hangup_chan = 1;
-
-		res = ast_pbx_run_args(chan, &pbx_args);
+	if (!ast_channel_pbx(chan)) {
+		int chan_hungup;
+
+		/* The ASYNCGOTO softhangup flag may have broken the channel out of
+		 * its bridge to run dialplan, so if there's no pbx on the channel
+		 * let it run dialplan here. Otherwise, it will run when this
+		 * application exits. */
+		ast_channel_lock(chan);
+		ast_channel_clear_softhangup(chan, AST_SOFTHANGUP_ASYNCGOTO);
+		chan_hungup = ast_check_hangup(chan);
+		ast_channel_unlock(chan);
+
+		if (!chan_hungup) {
+			struct ast_pbx_args pbx_args;
+
+			memset(&pbx_args, 0, sizeof(pbx_args));
+			pbx_args.no_hangup_chan = 1;
+
+			res = ast_pbx_run_args(chan, &pbx_args);
+		}
 	}
 
 	return res;




More information about the asterisk-commits mailing list