[asterisk-commits] mmichelson: branch mmichelson/atxfer_features r394716 - /team/mmichelson/atxf...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 18 11:03:51 CDT 2013


Author: mmichelson
Date: Thu Jul 18 11:03:49 2013
New Revision: 394716

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394716
Log:
Address the lion's share of Richard's comments on the review.

This does not address the fact that hooks are disappearing improperly.
That will happen with the next commit.


Modified:
    team/mmichelson/atxfer_features/main/bridging_basic.c

Modified: team/mmichelson/atxfer_features/main/bridging_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/atxfer_features/main/bridging_basic.c?view=diff&rev=394716&r1=394715&r2=394716
==============================================================================
--- team/mmichelson/atxfer_features/main/bridging_basic.c (original)
+++ team/mmichelson/atxfer_features/main/bridging_basic.c Thu Jul 18 11:03:49 2013
@@ -31,12 +31,12 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-#include "asterisk/astobj2.h"
 #include "asterisk/channel.h"
 #include "asterisk/utils.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/bridging.h"
 #include "asterisk/bridging_basic.h"
+#include "asterisk/astobj2.h"
 #include "asterisk/features_config.h"
 #include "asterisk/pbx.h"
 #include "asterisk/file.h"
@@ -998,7 +998,7 @@
 static void clear_stimulus_queue(struct attended_transfer_properties *props)
 {
 	struct stimulus_list *list;
-	SCOPED_MUTEX(lock, ao2_object_get_lockaddr(props));
+	SCOPED_AO2LOCK(lock, props);
 
 	while ((list = AST_LIST_REMOVE_HEAD(&props->stimulus_queue, next))) {
 		ast_free(list);
@@ -1228,7 +1228,8 @@
 {
 	int res;
 	RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);
-	SCOPED_LOCK(lock, dest, ast_bridge_lock, ast_bridge_unlock);
+
+	ast_bridge_lock_both(src, dest);
 
 	ast_channel_lock(channel);
 	bridge_channel = ast_channel_get_bridge_channel(channel);
@@ -1238,8 +1239,12 @@
 
 	ao2_lock(bridge_channel);
 	bridge_channel->swap = swap;
+	ao2_unlock(bridge_channel);
+
 	res = bridge_move_do(dest, bridge_channel, 1, 0);
-	ao2_unlock(bridge_channel);
+	
+	ast_bridge_unlock(dest);
+	ast_bridge_unlock(src);
 
 	return res;
 }
@@ -2113,27 +2118,27 @@
 	swap_dtmf = ast_channel_get_role_option(bridge_channel->chan, TRANSFERER_ROLE_NAME, "swap");
 
 	if (!ast_strlen_zero(abort_dtmf) && ast_bridge_dtmf_hook(bridge_channel->features,
-				abort_dtmf, atxfer_abort, personality->details[personality->current].pvt, NULL,
-				AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE | AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
+			abort_dtmf, atxfer_abort, personality->details[personality->current].pvt, NULL,
+			AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE | AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
 		return -1;
 	}
 	if (!ast_strlen_zero(complete_dtmf) && ast_bridge_dtmf_hook(bridge_channel->features,
-				complete_dtmf, atxfer_complete, personality->details[personality->current].pvt, NULL,
-				AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE | AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
+			complete_dtmf, atxfer_complete, personality->details[personality->current].pvt, NULL,
+			AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE | AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
 		return -1;
 	}
 	if (!ast_strlen_zero(threeway_dtmf) && ast_bridge_dtmf_hook(bridge_channel->features,
-				threeway_dtmf, atxfer_threeway, personality->details[personality->current].pvt, NULL,
-				AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE | AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
+			threeway_dtmf, atxfer_threeway, personality->details[personality->current].pvt, NULL,
+			AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE | AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
 		return -1;
 	}
 	if (!ast_strlen_zero(swap_dtmf) && ast_bridge_dtmf_hook(bridge_channel->features,
-				swap_dtmf, atxfer_swap, personality->details[personality->current].pvt, NULL,
-				AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE | AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
+			swap_dtmf, atxfer_swap, personality->details[personality->current].pvt, NULL,
+			AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE | AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
 		return -1;
 	}
 	if (ast_bridge_hangup_hook(bridge_channel->features, atxfer_transferer_hangup,
-				personality->details[personality->current].pvt, NULL,
+			personality->details[personality->current].pvt, NULL,
 			AST_BRIDGE_HOOK_REMOVE_ON_PERSONALITY_CHANGE | AST_BRIDGE_HOOK_REMOVE_ON_PULL)) {
 		return -1;
 	}
@@ -2665,8 +2670,8 @@
 	personality->current = type;
 	if (user_data) {
 		ao2_ref(user_data, +1);
-		personality->details[personality->current].pvt = user_data;
-	}
+	}
+	personality->details[personality->current].pvt = user_data;
 	ast_set_flag(&bridge->feature_flags, personality->details[personality->current].bridge_flags);
 	remove_hooks_on_personality_change(bridge);
 }




More information about the asterisk-commits mailing list