From 24c56515b1f3b99654cfaff5cc58a2c5aa88dc2b Mon Sep 17 00:00:00 2001 From: Matthew Jordan <mjordan@digium.com> Date: Mon, 26 Aug 2013 23:48:56 +0000 Subject: [PATCH] Better handle clearing the OUTGOING flag when a channel leaves a bridge When a channel with the OUTGOING flag leaves a bridge, and it will survive being pulled from the bridge (either because it will execute dialplan, go into another bridge, or live in a friendly autoloop), we have to clear the OUTGOING flag. This is the signal to the CDR engine that this channel is no longer a second class citizen, i.e., it is not "dialed". The soft hangup flags are only half the picture. If a channel is being moved from one bridge to another, the soft hangup flags aren't set; however, the state of the bridge_channel will not be hung up. Since the channel does not have one of the two hang up states, that implies that the channel is still technically alive. This patch modifies the check so that it checks both the soft hangup flags as well as the bridge_channel state. If either suggests that the channel is going to persist, we clear the OUTGOING flag. ........ Merged revisions 397690 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397691 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/bridge_channel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/bridge_channel.c b/main/bridge_channel.c index 92ad660eac..1aa82abfca 100644 --- a/main/bridge_channel.c +++ b/main/bridge_channel.c @@ -1527,8 +1527,9 @@ void bridge_channel_internal_pull(struct ast_bridge_channel *bridge_channel) * outgoing channel, clear the outgoing flag. */ if (ast_test_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_OUTGOING) - && (ast_channel_softhangup_internal_flag(bridge_channel->chan) & - (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE))) { + && (ast_channel_softhangup_internal_flag(bridge_channel->chan) & (AST_SOFTHANGUP_ASYNCGOTO | AST_SOFTHANGUP_UNBRIDGE) + || bridge_channel->state == BRIDGE_CHANNEL_STATE_WAIT)) { + ast_debug(2, "Channel %s will survive this bridge; clearing outgoing (dialed) flag\n", ast_channel_name(bridge_channel->chan)); ast_clear_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_OUTGOING); } -- GitLab