[asterisk-commits] file: branch file/bridging r92616 - /team/file/bridging/main/bridging.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 12 15:12:56 CST 2007


Author: file
Date: Wed Dec 12 15:12:56 2007
New Revision: 92616

URL: http://svn.digium.com/view/asterisk?view=rev&rev=92616
Log:
Move the code responsible for dissolving a bridge to a separate function. It will get used elsewhere soon... oh yes.

Modified:
    team/file/bridging/main/bridging.c

Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=92616&r1=92615&r2=92616
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Wed Dec 12 15:12:56 2007
@@ -177,6 +177,22 @@
 	return frame;
 }
 
+/*! \brief Internal function to see whether a bridge should dissolve, and if so do it */
+static void bridge_check_dissolve(struct ast_bridge *bridge)
+{
+	struct ast_bridge_channel *bridge_channel = NULL;
+
+	if (!ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_DISSOLVE))
+		return;
+
+	AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, list) {
+		if (bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_END && bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_DEPART)
+			ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+	}
+
+	return;
+}
+
 /*! \brief Internal function to handle when a channel or bridge needs servicing */
 static void bridge_handle_trip(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_channel *chan, int outfd)
 {
@@ -192,14 +208,8 @@
 		if (!frame || (frame->frametype == AST_FRAME_CONTROL && frame->subclass == AST_CONTROL_HANGUP)) {
 			/* Signal the thread that is handling the bridged channel that it should be ended */
 			ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
-			/* If the bridge is set to dissolve hang up everyone */
-			if (ast_test_flag(&bridge->feature_flags, AST_BRIDGE_FLAG_DISSOLVE)) {
-				struct ast_bridge_channel *bridge_channel2 = NULL;
-				AST_LIST_TRAVERSE(&bridge->channels, bridge_channel2, list) {
-					if (bridge_channel2 != bridge_channel)
-						ast_bridge_change_state(bridge_channel2, AST_BRIDGE_CHANNEL_STATE_HANGUP);
-				}
-			}
+			/* Perform bridge dissolving stuff if needed */
+			bridge_check_dissolve(bridge);
 		} else {
 			/* If this is DTMF pass it off to the feature handling code so it can determine whether to withhold it or let it through */
 			if (frame->frametype == AST_FRAME_DTMF_BEGIN || frame->frametype == AST_FRAME_DTMF_END)




More information about the asterisk-commits mailing list