summaryrefslogtreecommitdiff
path: root/main/bridge_channel.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-08-26 23:48:56 +0000
committerMatthew Jordan <mjordan@digium.com>2013-08-26 23:48:56 +0000
commit24c56515b1f3b99654cfaff5cc58a2c5aa88dc2b (patch)
treea5a7bb919349d731244ca6f15973e3407608f183 /main/bridge_channel.c
parent6c410d00d10a1b81bf7009cd10806f9638badef3 (diff)
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
Diffstat (limited to 'main/bridge_channel.c')
-rw-r--r--main/bridge_channel.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/main/bridge_channel.c b/main/bridge_channel.c
index 92ad660ea..1aa82abfc 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);
}