summaryrefslogtreecommitdiff
path: root/res/res_stasis.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2015-01-07 21:26:48 +0000
committerKinsey Moore <kmoore@digium.com>2015-01-07 21:26:48 +0000
commitf8c4909eb7b1b614a0726d35c7c5b6ab00774cd0 (patch)
treeea1441315f83a095c82ae2c4286d556e87507923 /res/res_stasis.c
parent7f836c1c15ce521bf01ab86db27fdfc84967e615 (diff)
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 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@430356 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_stasis.c')
-rw-r--r--res/res_stasis.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/res/res_stasis.c b/res/res_stasis.c
index ad081d412..0bf7b5871 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -1373,13 +1373,26 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc,
control_unlink(control);
control = NULL;
- if (!ast_check_hangup_locked(chan) && !ast_channel_pbx(chan)) {
- struct ast_pbx_args pbx_args;
+ if (!ast_channel_pbx(chan)) {
+ int chan_hungup;
- memset(&pbx_args, 0, sizeof(pbx_args));
- pbx_args.no_hangup_chan = 1;
+ /* 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);
- res = ast_pbx_run_args(chan, &pbx_args);
+ 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;