[svn-commits] mmichelson: branch mmichelson/atxfer_features r393369 - /team/mmichelson/atxf...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 1 17:09:24 CDT 2013


Author: mmichelson
Date: Mon Jul  1 17:09:23 2013
New Revision: 393369

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393369
Log:
Change certain transitions between CONSULTING and DOUBLECHECKING.

Rather than putting conditional logic in the enter callbacks for these
states, I instead placed the logic when transitioning to these states.
It's easier to make sure that preconditions are satisfied from the previous
state than to not have preconditions and try to guess the current conditions
in the new state.


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=393369&r1=393368&r2=393369
==============================================================================
--- team/mmichelson/atxfer_features/main/bridging_basic.c (original)
+++ team/mmichelson/atxfer_features/main/bridging_basic.c Mon Jul  1 17:09:23 2013
@@ -1445,22 +1445,6 @@
 
 static int consulting_enter(struct attended_transfer_properties *props)
 {
-	RAII_VAR(struct ast_bridge *, transferer_bridge, NULL, ao2_cleanup);
-
-	ast_channel_lock(props->transferer);
-	transferer_bridge = ast_channel_get_bridge(props->transferer);
-	ast_channel_unlock(props->transferer);
-
-	ast_assert(transferer_bridge != NULL);
-
-	if (transferer_bridge == props->target_bridge) {
-		return 0;
-	}
-
-	if (bridge_move(props->target_bridge, props->transferee_bridge, props->transferer, NULL)) {
-		return -1;
-	}
-	unhold(props->transferer);
 	return 0;
 }
 
@@ -1484,6 +1468,8 @@
 		return TRANSFER_THREEWAY;
 	case STIMULUS_DTMF_ATXFER_SWAP:
 		hold(props->transferer);
+		bridge_move(props->transferee_bridge, props->target_bridge, props->transferer, NULL);
+		unhold(props->transferer);
 		return TRANSFER_DOUBLECHECKING;
 	case STIMULUS_NONE:
 	case STIMULUS_TIMEOUT:
@@ -1499,21 +1485,6 @@
 
 static int double_checking_enter(struct attended_transfer_properties *props)
 {
-	struct ast_bridge *transferer_bridge;
-
-	ast_channel_lock(props->transferer);
-	transferer_bridge = ast_channel_internal_bridge(props->transferer);
-	ast_channel_unlock(props->transferer);
-
-	ast_assert(transferer_bridge != NULL);
-
-	if (transferer_bridge == props->transferee_bridge) {
-		return 0;
-	}
-	if (bridge_move(props->transferee_bridge, props->target_bridge, props->transferer, NULL)) {
-		return -1;
-	}
-	unhold(props->transferer);
 	return 0;
 }
 
@@ -1536,6 +1507,8 @@
 		return TRANSFER_THREEWAY;
 	case STIMULUS_DTMF_ATXFER_SWAP:
 		hold(props->transferer);
+		bridge_move(props->target_bridge, props->transferee_bridge, props->transferer, NULL);
+		unhold(props->transferer);
 		return TRANSFER_CONSULTING;
 	case STIMULUS_NONE:
 	case STIMULUS_TIMEOUT:




More information about the svn-commits mailing list