[asterisk-commits] mmichelson: branch mmichelson/more_transfer r389352 - in /team/mmichelson/mor...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 21 09:30:14 CDT 2013


Author: mmichelson
Date: Tue May 21 09:30:11 2013
New Revision: 389352

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389352
Log:
Address the latest review feedback from Richard.

I also fixed a compilation error in chan_mgcp since it was continuing
to use the version of ast_bridge_transfer_attended() that used three
parameters instead of two.


Modified:
    team/mmichelson/more_transfer/channels/chan_mgcp.c
    team/mmichelson/more_transfer/main/bridging.c

Modified: team/mmichelson/more_transfer/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/channels/chan_mgcp.c?view=diff&rev=389352&r1=389351&r2=389352
==============================================================================
--- team/mmichelson/more_transfer/channels/chan_mgcp.c (original)
+++ team/mmichelson/more_transfer/channels/chan_mgcp.c Tue May 21 09:30:11 2013
@@ -3236,7 +3236,7 @@
 
 	ast_mutex_unlock(&p->sub->next->lock);
 	ast_mutex_unlock(&p->sub->lock);
-	res = ast_bridge_transfer_attended(sub->owner, sub->next->owner, NULL);
+	res = ast_bridge_transfer_attended(sub->owner, sub->next->owner);
 
 	/* Subs are only freed when the endpoint itself is destroyed, so they will continue to exist
 	 * after ast_bridge_transfer_attended returns making this safe without reference counting

Modified: team/mmichelson/more_transfer/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/more_transfer/main/bridging.c?view=diff&rev=389352&r1=389351&r2=389352
==============================================================================
--- team/mmichelson/more_transfer/main/bridging.c (original)
+++ team/mmichelson/more_transfer/main/bridging.c Tue May 21 09:30:11 2013
@@ -4008,23 +4008,24 @@
  *
  * \param chan_bridge First bridge being tested
  * \param peer_bridge Second bridge being tested
+ * \param num_kick_channels The number of channels to remove from the bridges during merging
  * \param[out] merge Indicates the recommended direction for the bridge merge
  */
 static enum bridge_allow_merge bridges_allow_merge_optimization(struct ast_bridge *chan_bridge,
-		struct ast_bridge *peer_bridge, struct merge_direction *merge)
+		struct ast_bridge *peer_bridge, int num_kick_channels, struct merge_direction *merge)
 {
 	*merge = bridge_merge_determine_direction(chan_bridge, peer_bridge);
 	if (!merge->dest) {
-		MERGE_PROHIBITED;
+		return MERGE_PROHIBITED;
 	}
 	if (merge->src->num_channels < 2) {
 		return MERGE_NOT_ENOUGH_CHANNELS;
-	} else if ((2 + 2) < merge->dest->num_channels + merge->src->num_channels
+	} else if ((2 + num_kick_channels) < merge->dest->num_channels + merge->src->num_channels
 		&& !(merge->dest->technology->capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX)
 		&& (!ast_test_flag(&merge->dest->feature_flags, AST_BRIDGE_FLAG_SMART)
 			|| !(merge->dest->allowed_capabilities & AST_BRIDGE_CAPABILITY_MULTIMIX))) {
 		return MERGE_NO_MULTIMIX;
-	} 
+	}
 
 	return MERGE_ALLOWED;
 }
@@ -4052,7 +4053,7 @@
 		peer_bridge_channel,
 	};
 
-	switch (bridges_allow_merge_optimization(chan_bridge, peer_bridge, &merge)) {
+	switch (bridges_allow_merge_optimization(chan_bridge, peer_bridge, 2, &merge)) {
 	case MERGE_ALLOWED:
 		break;
 	case MERGE_PROHIBITED:
@@ -4138,7 +4139,7 @@
 		break;
 	}
 
-	if (bridges_allow_merge_optimization(chan_bridge, peer_bridge, &merge) != MERGE_ALLOWED) {
+	if (bridges_allow_merge_optimization(chan_bridge, peer_bridge, 2, &merge) != MERGE_ALLOWED) {
 		return AST_BRIDGE_OPTIMIZE_PROHIBITED;
 	}
 
@@ -5501,7 +5502,7 @@
 	struct ast_bridge_channel *bridged_to_source;
 
 	bridged_to_source = ast_bridge_channel_peer(source_bridge_channel);
-	if (bridged_to_source) {
+	if (bridged_to_source && bridged_to_source->state == AST_BRIDGE_CHANNEL_STATE_WAIT) {
 		bridged_to_source->swap = swap_channel;
 		return bridge_move_do(dest_bridge, bridged_to_source, 1) ?
 			AST_BRIDGE_TRANSFER_FAIL : AST_BRIDGE_TRANSFER_SUCCESS;
@@ -5535,7 +5536,7 @@
 		struct ast_bridge_channel *to_target_bridge_channel,
 		struct ast_bridge *to_transferee_bridge, struct ast_bridge *to_target_bridge)
 {
-	struct ast_bridge_channel *kick_me[2] = {
+	struct ast_bridge_channel *kick_me[] = {
 			to_transferee_bridge_channel,
 			to_target_bridge_channel,
 	};
@@ -5546,10 +5547,10 @@
 	case AST_BRIDGE_OPTIMIZE_SWAP_TO_PEER_BRIDGE:
 		return bridge_swap_attended_transfer(to_target_bridge, to_transferee_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, 2);
+		bridge_merge_do(to_transferee_bridge, to_target_bridge, kick_me, ARRAY_LEN(kick_me));
 		return AST_BRIDGE_TRANSFER_SUCCESS;
 	case AST_BRIDGE_OPTIMIZE_MERGE_TO_PEER_BRIDGE:
-		bridge_merge_do(to_target_bridge, to_transferee_bridge, kick_me, 2);
+		bridge_merge_do(to_target_bridge, to_transferee_bridge, kick_me, ARRAY_LEN(kick_me));
 		return AST_BRIDGE_TRANSFER_SUCCESS;
 	case AST_BRIDGE_OPTIMIZE_PROHIBITED:
 	default:




More information about the asterisk-commits mailing list