[asterisk-commits] rmudgett: branch 12 r401424 - in /branches/12: include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Oct 22 12:05:16 CDT 2013


Author: rmudgett
Date: Tue Oct 22 12:05:14 2013
New Revision: 401424

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401424
Log:
Bridging: Fix orphaned bridge if neither of the joining channels can join.

The original issue noted that the bridge is orphaned when res_parking.so
is not loaded and a call uses the dial kK flags.

A similar issue happens when only one of the park flags is used.  In this
case you have the bridge with one or the other channel left in it.  The
channel and bridge will stay around until the channel hangs up.

* Fixed the initial bridge channel push failure to act as if the channel
were kicked out of the bridge.  The bridge then decides if it needs to be
dissolved.

(closes issue ASTERISK-22629)
Reported by: Kevin Harwell

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

Modified:
    branches/12/include/asterisk/bridge_channel_internal.h
    branches/12/main/bridge.c
    branches/12/main/bridge_channel.c

Modified: branches/12/include/asterisk/bridge_channel_internal.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/include/asterisk/bridge_channel_internal.h?view=diff&rev=401424&r1=401423&r2=401424
==============================================================================
--- branches/12/include/asterisk/bridge_channel_internal.h (original)
+++ branches/12/include/asterisk/bridge_channel_internal.h Tue Oct 22 12:05:14 2013
@@ -107,6 +107,9 @@
  *
  * \retval 0 on success.
  * \retval -1 on failure.  The channel did not get pushed.
+ *
+ * \note On failure the caller must call
+ * ast_bridge_features_remove(bridge_channel->features, AST_BRIDGE_HOOK_REMOVE_ON_PULL);
  */
 int bridge_channel_internal_push(struct ast_bridge_channel *bridge_channel);
 

Modified: branches/12/main/bridge.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/bridge.c?view=diff&rev=401424&r1=401423&r2=401424
==============================================================================
--- branches/12/main/bridge.c (original)
+++ branches/12/main/bridge.c Tue Oct 22 12:05:14 2013
@@ -1791,6 +1791,8 @@
 		bridge_channel_change_bridge(bridge_channel, dst_bridge);
 
 		if (bridge_channel_internal_push(bridge_channel)) {
+			ast_bridge_features_remove(bridge_channel->features,
+				AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 			ast_bridge_channel_leave_bridge(bridge_channel,
 				BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, bridge_channel->bridge->cause);
 		}
@@ -2036,11 +2038,15 @@
 
 	if (bridge_channel_internal_push(bridge_channel)) {
 		/* Try to put the channel back into the original bridge. */
+		ast_bridge_features_remove(bridge_channel->features,
+			AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 		if (attempt_recovery && was_in_bridge) {
 			/* Point back to original bridge. */
 			bridge_channel_change_bridge(bridge_channel, orig_bridge);
 
 			if (bridge_channel_internal_push(bridge_channel)) {
+				ast_bridge_features_remove(bridge_channel->features,
+					AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 				ast_bridge_channel_leave_bridge(bridge_channel,
 					BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, bridge_channel->bridge->cause);
 				bridge_channel_settle_owed_events(orig_bridge, bridge_channel);

Modified: branches/12/main/bridge_channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/bridge_channel.c?view=diff&rev=401424&r1=401423&r2=401424
==============================================================================
--- branches/12/main/bridge_channel.c (original)
+++ branches/12/main/bridge_channel.c Tue Oct 22 12:05:14 2013
@@ -1566,7 +1566,6 @@
 		|| ast_bridge_channel_establish_roles(bridge_channel)) {
 		ast_debug(1, "Bridge %s: pushing %p(%s) into bridge failed\n",
 			bridge->uniqueid, bridge_channel, ast_channel_name(bridge_channel->chan));
-		ast_bridge_features_remove(bridge_channel->features, AST_BRIDGE_HOOK_REMOVE_ON_PULL);
 		return -1;
 	}
 	bridge_channel->in_bridge = 1;
@@ -1969,8 +1968,7 @@
 	 */
 	ast_bridge_lock(bridge_channel->bridge);
 
-	/* Make sure we're still good to be put into a bridge
-	 */
+	/* Make sure we're still good to be put into a bridge */
 	ast_channel_lock(bridge_channel->chan);
 	if (ast_channel_internal_bridge(bridge_channel->chan)
 		|| ast_test_flag(ast_channel_flags(bridge_channel->chan), AST_FLAG_ZOMBIE)) {
@@ -1993,8 +1991,14 @@
 	}
 
 	if (bridge_channel_internal_push(bridge_channel)) {
-		ast_bridge_channel_leave_bridge(bridge_channel,
-			BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE, bridge_channel->bridge->cause);
+		int cause = bridge_channel->bridge->cause;
+
+		ast_bridge_unlock(bridge_channel->bridge);
+		ast_bridge_channel_kick(bridge_channel, cause);
+		ast_bridge_channel_lock_bridge(bridge_channel);
+		ast_bridge_features_remove(bridge_channel->features,
+			AST_BRIDGE_HOOK_REMOVE_ON_PULL);
+		bridge_channel_dissolve_check(bridge_channel);
 		res = -1;
 	}
 	bridge_reconfigured(bridge_channel->bridge, !bridge_channel->inhibit_colp);




More information about the asterisk-commits mailing list