[asterisk-commits] jrose: branch jrose/bridge_projects r380966 - in /team/jrose/bridge_projects:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 6 09:51:37 CST 2013


Author: jrose
Date: Wed Feb  6 09:51:35 2013
New Revision: 380966

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380966
Log:
Add a depart_end state and don't change to hangup when the bridge is already ended/departed

Modified:
    team/jrose/bridge_projects/include/asterisk/bridging.h
    team/jrose/bridge_projects/main/bridging.c
    team/jrose/bridge_projects/main/features.c

Modified: team/jrose/bridge_projects/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/include/asterisk/bridging.h?view=diff&rev=380966&r1=380965&r2=380966
==============================================================================
--- team/jrose/bridge_projects/include/asterisk/bridging.h (original)
+++ team/jrose/bridge_projects/include/asterisk/bridging.h Wed Feb  6 09:51:35 2013
@@ -93,6 +93,8 @@
 	AST_BRIDGE_CHANNEL_STATE_HANGUP,
 	/*! Bridged channel was ast_bridge_depart() from the bridge without being hung up */
 	AST_BRIDGE_CHANNEL_STATE_DEPART,
+	/*! Bridged channel was ast_bridge_depart() from the bridge during AST_BRIDGE_CHANNEL_STATE_END without being hung up */
+	AST_BRIDGE_CHANNEL_STATE_DEPART_END,
 };
 
 /*! \brief Return values for bridge technology write function */

Modified: team/jrose/bridge_projects/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/main/bridging.c?view=diff&rev=380966&r1=380965&r2=380966
==============================================================================
--- team/jrose/bridge_projects/main/bridging.c (original)
+++ team/jrose/bridge_projects/main/bridging.c Wed Feb  6 09:51:35 2013
@@ -1387,8 +1387,13 @@
 	ast_channel_internal_bridge_set(bridge_channel->chan, NULL);
 
 	/* See if we need to dissolve the bridge itself if they hung up */
-	if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_END) {
+	switch (bridge_channel->state) {
+	case AST_BRIDGE_CHANNEL_STATE_END:
+	case AST_BRIDGE_CHANNEL_STATE_DEPART_END:
 		bridge_check_dissolve(bridge_channel->bridge, bridge_channel);
+		break;
+	default:
+		break;
 	}
 
 	/* Tell the bridge technology we are leaving so they tear us down */
@@ -1404,7 +1409,8 @@
 	AST_LIST_REMOVE(&bridge_channel->bridge->channels, bridge_channel, entry);
 
 	if (bridge_channel->depart_wait
-		&& bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_DEPART) {
+		&& bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_DEPART
+		&& bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_DEPART_END) {
 		/* Put the channel into the ast_bridge_depart wait list. */
 		AST_LIST_INSERT_TAIL(&bridge_channel->bridge->depart_wait, bridge_channel, entry);
 	}
@@ -1626,7 +1632,16 @@
 				ao2_unlock(bridge);
 				return -1;
 			}
-			ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_DEPART);
+			ao2_lock(bridge_channel);
+			switch (bridge_channel->state) {
+			case AST_BRIDGE_CHANNEL_STATE_END:
+				ast_bridge_change_state_nolock(bridge_channel, AST_BRIDGE_CHANNEL_STATE_DEPART_END);
+				break;
+			default:
+				ast_bridge_change_state_nolock(bridge_channel, AST_BRIDGE_CHANNEL_STATE_DEPART);
+				break;
+			}
+			ao2_unlock(bridge_channel);
 			break;
 		}
 
@@ -1964,7 +1979,13 @@
 		ast_stream_and_wait(bridge_channel->chan, limits->duration_sound, "");
 	}
 
-	ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+	ao2_lock(bridge_channel);
+
+	if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT){
+		ast_bridge_change_state_nolock(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+	}
+
+	ao2_unlock(bridge_channel);
 
 	return -1;
 }

Modified: team/jrose/bridge_projects/main/features.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/main/features.c?view=diff&rev=380966&r1=380965&r2=380966
==============================================================================
--- team/jrose/bridge_projects/main/features.c (original)
+++ team/jrose/bridge_projects/main/features.c Wed Feb  6 09:51:35 2013
@@ -4419,6 +4419,7 @@
 	}
 
 	caller_limits->duration = callee_limits->duration = config->timelimit;
+	callee_limits->duration += 250;
 }
 
 /*!




More information about the asterisk-commits mailing list