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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 18 17:30:45 CDT 2013


Author: mmichelson
Date: Thu Jul 18 17:30:43 2013
New Revision: 394789

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


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=394789&r1=394788&r2=394789
==============================================================================
--- team/mmichelson/atxfer_features/main/bridging_basic.c (original)
+++ team/mmichelson/atxfer_features/main/bridging_basic.c Thu Jul 18 17:30:43 2013
@@ -177,6 +177,13 @@
 	struct personality_details details[BRIDGE_BASIC_PERSONALITY_END];
 };
 
+static int add_normal_hooks(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+{
+	return ast_bridge_hangup_hook(bridge_channel->features, basic_hangup_hook,
+			NULL, NULL, AST_BRIDGE_HOOK_REMOVE_ON_PULL)
+		|| ast_bridge_channel_setup_features(bridge_channel);
+}
+
 /*!
  * \internal
  * \brief ast_bridge basic push method.
@@ -193,8 +200,7 @@
  */
 static int bridge_personality_normal_push(struct ast_bridge *self, struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap)
 {
-	if (ast_bridge_hangup_hook(bridge_channel->features, basic_hangup_hook, NULL, NULL, AST_BRIDGE_HOOK_REMOVE_ON_PULL)
-		|| ast_bridge_channel_setup_features(bridge_channel)) {
+	if (add_normal_hooks(self, bridge_channel)) {
 		return -1;
 	}
 
@@ -1244,7 +1250,7 @@
 	ao2_unlock(bridge_channel);
 
 	res = bridge_move_do(dest, bridge_channel, 1, 0);
-	
+
 	ast_bridge_unlock(dest);
 	ast_bridge_unlock(src);
 
@@ -2666,10 +2672,11 @@
 	struct bridge_basic_personality *personality = bridge->personality;
 	SCOPED_LOCK(lock, bridge, ast_bridge_lock, ast_bridge_unlock);
 
+	remove_hooks_on_personality_change(bridge);
+
 	ao2_cleanup(personality->details[personality->current].pvt);
 	personality->details[personality->current].pvt = NULL;
 	ast_clear_flag(&bridge->feature_flags, AST_FLAGS_ALL);
-	remove_hooks_on_personality_change(bridge);
 
 	personality->current = type;
 	if (user_data) {
@@ -2697,9 +2704,7 @@
 	struct ast_bridge_channel *iter;
 
 	AST_LIST_TRAVERSE(&bridge->channels, iter, entry) {
-		if (ast_bridge_hangup_hook(iter->features, basic_hangup_hook, NULL,
-				NULL, AST_BRIDGE_HOOK_REMOVE_ON_PULL) ||
-				ast_bridge_channel_setup_features(iter)) {
+		if (add_normal_hooks(bridge, iter)) {
 			ast_log(LOG_WARNING, "Unable to set up bridge hooks for channel %s. Features may not work properly\n",
 					ast_channel_name(iter->chan));
 		}




More information about the asterisk-commits mailing list