Fix crash from bridge channel hangup race condition in ConfBridge

This patch addresses two issues in ConfBridge and the channel bridge layer:
1. It fixes a race condition wherein the bridge channel could be hung up
2. It removes the deadlock avoidance from the bridging layer and makes the
   bridge_pvt an ao2 ref counted object

Patch by David Vossel (mjordan was merely the commit monkey)

(issue ASTERISK-18988)
(closes issue ASTERISK-18885)
Reported by: Dmitry Melekhov
Tested by: Matt Jordan
Patches: chan_bridge_cleanup_v.diff uploaded by David Vossel (license 5628)

(closes issue ASTERISK-19100)
Reported by: Matt Jordan
Tested by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/1654/
........

Merged revisions 350550 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@350551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2012-01-13 16:48:06 +00:00
parent 19a9761084
commit a8276fe8ef
5 changed files with 44 additions and 73 deletions

View File

@@ -874,7 +874,9 @@ static void destroy_conference_bridge(void *obj)
if (conference_bridge->playback_chan) {
struct ast_channel *underlying_channel = conference_bridge->playback_chan->tech->bridged_channel(conference_bridge->playback_chan, NULL);
ast_hangup(underlying_channel);
if (underlying_channel) {
ast_hangup(underlying_channel);
}
ast_hangup(conference_bridge->playback_chan);
conference_bridge->playback_chan = NULL;
}
@@ -1155,7 +1157,7 @@ static int play_sound_helper(struct conference_bridge *conference_bridge, const
} else {
/* Channel was already available so we just need to add it back into the bridge */
underlying_channel = conference_bridge->playback_chan->tech->bridged_channel(conference_bridge->playback_chan, NULL);
ast_bridge_impart(conference_bridge->bridge, underlying_channel, NULL, NULL);
ast_bridge_impart(conference_bridge->bridge, underlying_channel, NULL, NULL, 0);
}
/* The channel is all under our control, in goes the prompt */