Publish a bridge enter before pulling on a push-and-swap operation.
authorMark Michelson <mmichelson@digium.com>
Wed, 3 Jul 2013 20:41:00 +0000 (20:41 +0000)
committerMark Michelson <mmichelson@digium.com>
Wed, 3 Jul 2013 20:41:00 +0000 (20:41 +0000)
Prior to this patch, the order of procedures on a bridge push was

* Add new bridge channel to bridge's array.
* Pull the swap channel out of the bridge
* Publish a bridge enter event.

The problem is that when the swap channel was pulled from the bridge,
a bridge leave event would be published. The bridge snapshot
published during the bridge leave showed the new channel that had
been added to the bridge, but there had been no bridge enter event
for that channel.

The fix provided here was to change the order a bit

* Add new bridge channel to bridge's array.
* Publish bridge enter event.
* Pull the swap channel out of the bridge.

This makes it so that the bridge snapshots during the stasis
events are accurate.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393586 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/bridging.c

index 2dc2ec1..dc84c41 100644 (file)
@@ -710,6 +710,9 @@ static int bridge_channel_push(struct ast_bridge_channel *bridge_channel)
        bridge_channel->just_joined = 1;
        AST_LIST_INSERT_TAIL(&bridge->channels, bridge_channel, entry);
        ++bridge->num_channels;
+
+       ast_bridge_publish_enter(bridge, bridge_channel->chan);
+
        if (!bridge_channel->suspended) {
                ++bridge->num_active;
        }
@@ -722,7 +725,6 @@ static int bridge_channel_push(struct ast_bridge_channel *bridge_channel)
        pbx_builtin_setvar_helper(bridge_channel->chan, "BLINDTRANSFER", NULL);
 
        bridge->reconfigured = 1;
-       ast_bridge_publish_enter(bridge, bridge_channel->chan);
        return 0;
 }