[asterisk-commits] file: branch file/bridging_colp r392143 - /team/file/bridging_colp/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 18 11:17:01 CDT 2013


Author: file
Date: Tue Jun 18 11:16:59 2013
New Revision: 392143

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392143
Log:
Reduce the number of COLP updates when swapping.

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

Modified: team/file/bridging_colp/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/file/bridging_colp/main/bridging.c?view=diff&rev=392143&r1=392142&r2=392143
==============================================================================
--- team/file/bridging_colp/main/bridging.c (original)
+++ team/file/bridging_colp/main/bridging.c Tue Jun 18 11:16:59 2013
@@ -490,10 +490,11 @@
 * \brief Clear connected line information on channels within bridge.
 *
 * \param bridge_channel Channel being pulled.
+* \param swap Whether a swap operation is occurring.
 *
 * \return Nothing
 */
-static void bridge_channel_pull_connected_line_update(struct ast_bridge_channel *bridge_channel)
+static void bridge_channel_pull_connected_line_update(struct ast_bridge_channel *bridge_channel, unsigned int swap)
 {
 	struct ast_bridge *bridge = bridge_channel->bridge;
 	struct ast_party_connected_line connected;
@@ -507,7 +508,8 @@
 	ast_party_connected_line_init(&connected);
 	ast_channel_update_connected_line(bridge_channel->chan, &connected, NULL);
 
-	if ((peer = ast_bridge_channel_peer(bridge_channel))) {
+	/* Only update the peer if this is not a swap, this reduces the number of COLP updates */
+	if (!swap && (peer = ast_bridge_channel_peer(bridge_channel))) {
 		ast_channel_update_connected_line(peer->chan, &connected, NULL);
 	}
 
@@ -521,12 +523,13 @@
  *
  * \param bridge_channel Channel to pull.
  * \param optimized Whether this pull is the result of an optimization.
+ * \param swap Whether this pull is the result of a swap.
  *
  * \note On entry, bridge_channel->bridge is already locked.
  *
  * \return Nothing
  */
-static void bridge_channel_pull(struct ast_bridge_channel *bridge_channel, unsigned int optimized)
+static void bridge_channel_pull(struct ast_bridge_channel *bridge_channel, unsigned int optimized, unsigned int swap)
 {
 	struct ast_bridge *bridge = bridge_channel->bridge;
 
@@ -551,7 +554,7 @@
 	}
 
 	if (!optimized) {
-		bridge_channel_pull_connected_line_update(bridge_channel);
+		bridge_channel_pull_connected_line_update(bridge_channel, swap);
 	}
 
 	/* Remove channel from the bridge */
@@ -656,7 +659,7 @@
 	}
 	if (swap) {
 		ast_bridge_change_state(swap, AST_BRIDGE_CHANNEL_STATE_HANGUP);
-		bridge_channel_pull(swap, optimized);
+		bridge_channel_pull(swap, optimized, 1);
 	}
 
 	if (!optimized) {
@@ -2941,7 +2944,7 @@
 		ast_bridge_channel_lock_bridge(bridge_channel);
 	}
 
-	bridge_channel_pull(bridge_channel, 0);
+	bridge_channel_pull(bridge_channel, 0, 0);
 	bridge_reconfigured(bridge_channel->bridge);
 
 	ast_bridge_unlock(bridge_channel->bridge);
@@ -3890,7 +3893,7 @@
 				}
 			}
 		}
-		bridge_channel_pull(bridge_channel, optimized);
+		bridge_channel_pull(bridge_channel, optimized, 0);
 		if (bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_WAIT) {
 			/*
 			 * The channel died as a result of being pulled or it was
@@ -3918,7 +3921,7 @@
 			ast_bridge_channel_lock(bridge_channel);
 			if (bridge_channel->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
 				ast_bridge_change_state_nolock(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
-				bridge_channel_pull(bridge_channel, optimized);
+				bridge_channel_pull(bridge_channel, optimized, 0);
 			}
 			ast_bridge_channel_unlock(bridge_channel);
 		}
@@ -4145,7 +4148,7 @@
 	orig_bridge = bridge_channel->bridge;
 	was_in_bridge = bridge_channel->in_bridge;
 
-	bridge_channel_pull(bridge_channel, optimized);
+	bridge_channel_pull(bridge_channel, optimized, 0);
 	if (bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_WAIT) {
 		/*
 		 * The channel died as a result of being pulled.  Leave it




More information about the asterisk-commits mailing list