summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2014-05-18 20:38:02 +0000
committerMatthew Jordan <mjordan@digium.com>2014-05-18 20:38:02 +0000
commit17ff4d92823264e0db1902747d0b1ffcf5a7c26e (patch)
treed20c18838f54b00ce3458ffe874caddc76379ae9 /bridges
parent4c252096ef90d79a0da69daedaf09898b47a675b (diff)
bridge_native_rtp/bridge_channel: Fix direct media issues due to frame hook
This patch fixes issues with direct media bridges that occur after a blind transfer. These issues were caught by the (currently failing) pjsip/transfers/blind_transfer/caller_direct_media test. The test currently fails primarily for two reasons: (1) When Bob and Charlie (the transfer target and the transfer destination) enter a bridge together, the framehook remains on the transfer target channel until both channels are in the bridge. As it consumes voice frames, the initial bridge type is a simple bridge. The framehook is removed when both channels are in the bridge; however, this does not currently cause the bridging framework to re-evaluate the bridge. This patch adds a AST_SOFTHANGUP_UNBRIDGE poke to the transfer target channel when a framehook is removed so the bridge can re-evaluate itself. (2) When a channel leaves a native RTP bridge, it may be leaving due to being hung up. Sending a re-INVITE to a channel that is about to be hung up is not nice - in fact, there's a good chance we'll send the BYE request before the channel has had a chance to send back a 200 OK. To be somewhat nicer, this patch adds a function to channel.h that allows the bridging framework to query for exactly why a channel is leaving a bridge via the channel's soft hangup flags. This allows it to only send the re-INVITE if there's a chance the channel will survive the native bridging experience. Review: https://reviewboard.asterisk.org/r/3535/ ........ Merged revisions 414122 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414123 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'bridges')
-rw-r--r--bridges/bridge_native_rtp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c
index 7e48ab92f..aa5299c24 100644
--- a/bridges/bridge_native_rtp.c
+++ b/bridges/bridge_native_rtp.c
@@ -230,8 +230,10 @@ static void native_rtp_bridge_stop(struct ast_bridge *bridge, struct ast_channel
break;
case AST_RTP_GLUE_RESULT_REMOTE:
if (!target) {
- glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
- if (glue1) {
+ if (ast_channel_is_leaving_bridge(c0->chan)) {
+ glue0->update_peer(c0->chan, NULL, NULL, NULL, NULL, 0);
+ }
+ if (glue1 && ast_channel_is_leaving_bridge(c1->chan)) {
glue1->update_peer(c1->chan, NULL, NULL, NULL, NULL, 0);
}
} else {
@@ -485,8 +487,9 @@ static void native_rtp_bridge_leave(struct ast_bridge *bridge, struct ast_bridge
}
/* Direct RTP may have occurred, tear it down */
- glue->update_peer(bridge_channel->chan, NULL, NULL, NULL, NULL, 0);
-
+ if (ast_channel_is_leaving_bridge(bridge_channel->chan)) {
+ glue->update_peer(bridge_channel->chan, NULL, NULL, NULL, NULL, 0);
+ }
native_rtp_bridge_stop(bridge, NULL);
}