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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 17 10:39:56 CDT 2013


Author: file
Date: Mon Jun 17 10:39:54 2013
New Revision: 392028

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392028
Log:
Only update connected line information from non-unreal and non-Local channels and also don't update when merging or swapping due to optimization.

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=392028&r1=392027&r2=392028
==============================================================================
--- team/file/bridging_colp/main/bridging.c (original)
+++ team/file/bridging_colp/main/bridging.c Mon Jun 17 10:39:54 2013
@@ -61,6 +61,7 @@
 #include "asterisk/cli.h"
 #include "asterisk/parking.h"
 #include "asterisk/core_local.h"
+#include "asterisk/core_unreal.h"
 #include "asterisk/features_config.h"
 
 /*! All bridges container. */
@@ -498,7 +499,8 @@
 	struct ast_party_connected_line connected;
 	struct ast_bridge_channel *peer;
 
-	if (!(bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX)) {
+	if (!(bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX) ||
+		(ast_channel_tech(bridge_channel->chan)->write == ast_unreal_write)) {
 		return;
 	}
 
@@ -518,12 +520,13 @@
  * \since 12.0.0
  *
  * \param bridge_channel Channel to pull.
+ * \param optimized Whether this pull is the result of an optimization.
  *
  * \note On entry, bridge_channel->bridge is already locked.
  *
  * \return Nothing
  */
-static void bridge_channel_pull(struct ast_bridge_channel *bridge_channel)
+static void bridge_channel_pull(struct ast_bridge_channel *bridge_channel, unsigned int optimized)
 {
 	struct ast_bridge *bridge = bridge_channel->bridge;
 
@@ -547,7 +550,9 @@
 		}
 	}
 
-	bridge_channel_pull_connected_line_update(bridge_channel);
+	if (!optimized) {
+		bridge_channel_pull_connected_line_update(bridge_channel);
+	}
 
 	/* Remove channel from the bridge */
 	if (!bridge_channel->suspended) {
@@ -580,7 +585,8 @@
 	struct ast_party_connected_line connected;
 
 	if (!(bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_1TO1MIX) ||
-		!(peer = ast_bridge_channel_peer(bridge_channel))) {
+		!(peer = ast_bridge_channel_peer(bridge_channel)) ||
+		(ast_channel_tech(bridge_channel->chan)->write == ast_unreal_write)) {
 		return;
 	}
 
@@ -605,13 +611,14 @@
  * \since 12.0.0
  *
  * \param bridge_channel Channel to push.
+ * \param optimized Whether this push is the result of an optimization.
  *
  * \note On entry, bridge_channel->bridge is already locked.
  *
  * \retval 0 on success.
  * \retval -1 on failure.  The channel did not get pushed.
  */
-static int bridge_channel_push(struct ast_bridge_channel *bridge_channel)
+static int bridge_channel_push(struct ast_bridge_channel *bridge_channel, unsigned int optimized)
 {
 	struct ast_bridge *bridge = bridge_channel->bridge;
 	struct ast_bridge_channel *swap;
@@ -649,10 +656,12 @@
 	}
 	if (swap) {
 		ast_bridge_change_state(swap, AST_BRIDGE_CHANNEL_STATE_HANGUP);
-		bridge_channel_pull(swap);
-	}
-
-	bridge_channel_push_connected_line_update(bridge_channel);
+		bridge_channel_pull(swap, optimized);
+	}
+
+	if (!optimized) {
+		bridge_channel_push_connected_line_update(bridge_channel);
+	}
 
 	/* Clear any BLINDTRANSFER since the transfer has completed. */
 	pbx_builtin_setvar_helper(bridge_channel->chan, "BLINDTRANSFER", NULL);
@@ -2908,7 +2917,7 @@
 		bridge_channel->bridge->callid = ast_read_threadstorage_callid();
 	}
 
-	if (bridge_channel_push(bridge_channel)) {
+	if (bridge_channel_push(bridge_channel, 0)) {
 		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
 	}
 	bridge_reconfigured(bridge_channel->bridge);
@@ -2934,7 +2943,7 @@
 		ast_bridge_channel_lock_bridge(bridge_channel);
 	}
 
-	bridge_channel_pull(bridge_channel);
+	bridge_channel_pull(bridge_channel, 0);
 	bridge_reconfigured(bridge_channel->bridge);
 
 	ast_bridge_unlock(bridge_channel->bridge);
@@ -3845,7 +3854,8 @@
  * This moves the channels in src_bridge into the bridge pointed
  * to by dst_bridge.
  */
-static void bridge_merge_do(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_bridge_channel **kick_me, unsigned int num_kick)
+static void bridge_merge_do(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_bridge_channel **kick_me, unsigned int num_kick,
+	unsigned int optimized)
 {
 	struct ast_bridge_channel *bridge_channel;
 	unsigned int idx;
@@ -3882,7 +3892,7 @@
 				}
 			}
 		}
-		bridge_channel_pull(bridge_channel);
+		bridge_channel_pull(bridge_channel, optimized);
 		if (bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_WAIT) {
 			/*
 			 * The channel died as a result of being pulled or it was
@@ -3894,7 +3904,7 @@
 		/* Point to new bridge.*/
 		bridge_channel_change_bridge(bridge_channel, dst_bridge);
 
-		if (bridge_channel_push(bridge_channel)) {
+		if (bridge_channel_push(bridge_channel, optimized)) {
 			ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
 		}
 	}
@@ -3910,7 +3920,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);
+				bridge_channel_pull(bridge_channel, optimized);
 			}
 			ast_bridge_channel_unlock(bridge_channel);
 		}
@@ -4085,7 +4095,7 @@
 		}
 	}
 
-	bridge_merge_do(merge.dest, merge.src, kick_them, num_kick);
+	bridge_merge_do(merge.dest, merge.src, kick_them, num_kick, 0);
 	return 0;
 }
 
@@ -4117,7 +4127,8 @@
  * \retval 0 on success.
  * \retval -1 on failure.
  */
-static int bridge_move_do(struct ast_bridge *dst_bridge, struct ast_bridge_channel *bridge_channel, int attempt_recovery)
+static int bridge_move_do(struct ast_bridge *dst_bridge, struct ast_bridge_channel *bridge_channel, int attempt_recovery,
+	unsigned int optimized)
 {
 	struct ast_bridge *orig_bridge;
 	int was_in_bridge;
@@ -4136,7 +4147,7 @@
 	orig_bridge = bridge_channel->bridge;
 	was_in_bridge = bridge_channel->in_bridge;
 
-	bridge_channel_pull(bridge_channel);
+	bridge_channel_pull(bridge_channel, optimized);
 	if (bridge_channel->state != AST_BRIDGE_CHANNEL_STATE_WAIT) {
 		/*
 		 * The channel died as a result of being pulled.  Leave it
@@ -4150,13 +4161,13 @@
 	ao2_ref(orig_bridge, +1);/* Keep a ref in case the push fails. */
 	bridge_channel_change_bridge(bridge_channel, dst_bridge);
 
-	if (bridge_channel_push(bridge_channel)) {
+	if (bridge_channel_push(bridge_channel, optimized)) {
 		/* Try to put the channel back into the original bridge. */
 		if (attempt_recovery && was_in_bridge) {
 			/* Point back to original bridge. */
 			bridge_channel_change_bridge(bridge_channel, orig_bridge);
 
-			if (bridge_channel_push(bridge_channel)) {
+			if (bridge_channel_push(bridge_channel, optimized)) {
 				ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
 			}
 		} else {
@@ -4245,7 +4256,7 @@
 	}
 
 	bridge_channel->swap = swap;
-	return bridge_move_do(dst_bridge, bridge_channel, attempt_recovery);
+	return bridge_move_do(dst_bridge, bridge_channel, attempt_recovery, 0);
 }
 
 int ast_bridge_move(struct ast_bridge *dst_bridge, struct ast_bridge *src_bridge, struct ast_channel *chan, struct ast_channel *swap, int attempt_recovery)
@@ -4481,7 +4492,7 @@
 			ast_channel_name(other->chan));
 
 		other->swap = dst_bridge_channel->chan;
-		if (!bridge_move_do(dst_bridge, other, 1)) {
+		if (!bridge_move_do(dst_bridge, other, 1, 1)) {
 			ast_bridge_change_state(src_bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
 			res = -1;
 		}
@@ -4581,7 +4592,7 @@
 		ast_channel_name(chan_bridge_channel->chan),
 		ast_channel_name(peer_bridge_channel->chan));
 
-	bridge_merge_do(merge.dest, merge.src, kick_me, ARRAY_LEN(kick_me));
+	bridge_merge_do(merge.dest, merge.src, kick_me, ARRAY_LEN(kick_me), 1);
 
 	return -1;
 }
@@ -6019,7 +6030,7 @@
 		&& !ast_test_flag(&bridged_to_source->features->feature_flags,
 			AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE)) {
 		bridged_to_source->swap = swap_channel;
-		if (bridge_move_do(dest_bridge, bridged_to_source, 1)) {
+		if (bridge_move_do(dest_bridge, bridged_to_source, 1, 0)) {
 			return AST_BRIDGE_TRANSFER_FAIL;
 		}
 		/* Must kick the source channel out of its bridge. */
@@ -6066,10 +6077,10 @@
 	case AST_BRIDGE_OPTIMIZE_SWAP_TO_PEER_BRIDGE:
 		return bridge_swap_attended_transfer(to_target_bridge, to_transferee_bridge_channel, to_transfer_target);
 	case AST_BRIDGE_OPTIMIZE_MERGE_TO_CHAN_BRIDGE:
-		bridge_merge_do(to_transferee_bridge, to_target_bridge, kick_me, ARRAY_LEN(kick_me));
+		bridge_merge_do(to_transferee_bridge, to_target_bridge, kick_me, ARRAY_LEN(kick_me), 0);
 		return AST_BRIDGE_TRANSFER_SUCCESS;
 	case AST_BRIDGE_OPTIMIZE_MERGE_TO_PEER_BRIDGE:
-		bridge_merge_do(to_target_bridge, to_transferee_bridge, kick_me, ARRAY_LEN(kick_me));
+		bridge_merge_do(to_target_bridge, to_transferee_bridge, kick_me, ARRAY_LEN(kick_me), 0);
 		return AST_BRIDGE_TRANSFER_SUCCESS;
 	case AST_BRIDGE_OPTIMIZE_PROHIBITED:
 	default:




More information about the asterisk-commits mailing list