summaryrefslogtreecommitdiff
path: root/res/stasis
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-08-21 21:36:00 +0000
committerMark Michelson <mmichelson@digium.com>2014-08-21 21:36:00 +0000
commit5de3fa2c6079f688b70ff5ad963053437379e21e (patch)
tree3b242fa3c7ac65b0a870b444ba9ac60d73a06077 /res/stasis
parenta9befb9eec3cb4082605692aec051cb2ca87915e (diff)
Ensure after-bridge behavior is correct when moving from Stasis to a non-Stasis bridge.
Because of the departable state of channels that enter Stasis bridges, Stasis has to take responsibility for directing the channel to its intended after-bridge destination if the channel moves from a Stasis bridge to a non-Stasis bridge. This change ensures that when such a move occurs, when the channel leaves the bridging system, any after bridge gotos are honored. Review: https://reviewboard.asterisk.org/r/3920 ........ Merged revisions 421792 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@421794 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/stasis')
-rw-r--r--res/stasis/control.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/res/stasis/control.c b/res/stasis/control.c
index e53d93c06..5c85b9ba1 100644
--- a/res/stasis/control.c
+++ b/res/stasis/control.c
@@ -810,6 +810,21 @@ static void bridge_after_cb(struct ast_channel *chan, void *data)
if (stasis_app_send_command_async(control, bridge_channel_depart, bridge_channel)) {
ao2_cleanup(bridge_channel);
}
+ if (stasis_app_channel_is_stasis_end_published(chan)) {
+ /* The channel has had a StasisEnd published on it, but until now had remained in
+ * the bridging system. This means that the channel moved from a Stasis bridge to a
+ * non-Stasis bridge and is now exiting the bridging system. Because of this, the
+ * channel needs to exit the Stasis application and go to wherever the non-Stasis
+ * bridge has directed it to go. If the non-Stasis bridge has not set up an after
+ * bridge destination, then the channel should be hung up.
+ */
+ int hangup_flag;
+
+ hangup_flag = ast_bridge_setup_after_goto(chan) ? AST_SOFTHANGUP_DEV : AST_SOFTHANGUP_ASYNCGOTO;
+ ast_channel_lock(chan);
+ ast_softhangup_nolock(chan, hangup_flag);
+ ast_channel_unlock(chan);
+ }
}
static void bridge_after_cb_failed(enum ast_bridge_after_cb_reason reason,