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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 26 11:17:46 CDT 2013


Author: mmichelson
Date: Wed Jun 26 11:17:44 2013
New Revision: 392969

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392969
Log:
Get blond transfers working properly.

This change involves changing the BLOND state to a terminal
one. The idea originally was for this state to not be terminal
so that it could transition in case we need to re-call any of
the parties involved. However, I am instead going to create
a different state to be used for that scenario.


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=392969&r1=392968&r2=392969
==============================================================================
--- team/mmichelson/atxfer_features/main/bridging_basic.c (original)
+++ team/mmichelson/atxfer_features/main/bridging_basic.c Wed Jun 26 11:17:44 2013
@@ -514,6 +514,19 @@
 	ast_bridge_channel_write_unhold(bridge_channel);
 }
 
+static void ringing(struct ast_channel *chan)
+{
+	RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);
+
+	ast_channel_lock(chan);
+	bridge_channel = ast_channel_get_bridge_channel(chan);
+	ast_channel_unlock(chan);
+	
+	ast_assert(bridge_channel != NULL);
+
+	ast_bridge_channel_write_control_data(bridge_channel, AST_CONTROL_RINGING, NULL, 0);
+}
+
 static void bridge_unhold(struct ast_bridge *bridge)
 {
 	struct ast_frame unhold = {
@@ -590,11 +603,7 @@
 		return TRANSFER_FAIL;
 	case STIMULUS_DTMF_ATXFER_COMPLETE:
 	case STIMULUS_TRANSFERER_HANGUP:
-		/* XXX For this state change, I need to take the
-		 * transferee off hold, but the transferer is not in the
-		 * bridge. Can I just write directly to the bridge?
-		 * Queue it on the bridge?
-		 */
+		bridge_unhold(props->transferee_bridge);
 		return TRANSFER_BLOND;
 	case STIMULUS_TARGET_ANSWER:
 		return TRANSFER_CONSULTING;
@@ -773,49 +782,24 @@
 
 static int complete_enter(struct attended_transfer_properties *props)
 {
-	if (props->transferer) {
+	if (ast_check_hangup(props->transferer)) {
+		bridge_merge(props->transferee_bridge, props->target_bridge, NULL, 0);
+	} else {
 		bridge_merge(props->transferee_bridge, props->target_bridge, &props->transferer, 1);
+	}
+
+	return 0;
+}
+
+static int blond_enter(struct attended_transfer_properties *props)
+{
+	if (ast_check_hangup(props->transferer)) {
+		bridge_merge(props->transferee_bridge, props->target_bridge, NULL, 0);
 	} else {
-		bridge_merge(props->transferee_bridge, props->target_bridge, NULL, 0);
-	}
-
-	return 0;
-}
-
-static int blond_enter(struct attended_transfer_properties *props)
-{
-	if (ast_check_hangup(props->transferer)) {
-		return 0;
-	}
-	ast_softhangup(props->transferer, AST_SOFTHANGUP_EXPLICIT);
-	props->transferer = ast_channel_unref(props->transferer);
-	return 0;
-}
-
-static enum attended_transfer_state blond_next(struct attended_transfer_properties *props,
-		enum attended_transfer_stimulus stimulus)
-{
-	switch (stimulus) {
-	default:
-	case STIMULUS_NONE:
-	case STIMULUS_DTMF_ATXFER_ABORT:
-	case STIMULUS_DTMF_ATXFER_COMPLETE:
-	case STIMULUS_DTMF_ATXFER_THREEWAY:
-	case STIMULUS_DTMF_ATXFER_SWAP:
-	case STIMULUS_TRANSFERER_HANGUP:
-	case STIMULUS_TRANSFERER_ANSWER:
-		ast_assert(0);
-	case STIMULUS_TRANSFEREE_HANGUP:
-		return TRANSFER_FAIL;
-	case STIMULUS_TARGET_ANSWER:
-		return TRANSFER_COMPLETE;
-	case STIMULUS_TARGET_HANGUP:
-	case STIMULUS_TIMEOUT:
-		if (props->atxferdropcall) {
-			return TRANSFER_FAIL;
-		}
-		return TRANSFER_RECALLING;
-	}
+		bridge_merge(props->transferee_bridge, props->target_bridge, &props->transferer, 1);
+	}
+	ringing(props->transfer_target);
+	return 0;
 }
 
 static int recalling_enter(struct attended_transfer_properties *props)
@@ -871,6 +855,7 @@
 static enum attended_transfer_state retransfer_next(struct attended_transfer_properties *props,
 		enum attended_transfer_stimulus stimulus)
 {
+	/* XXX This is no longer correct */
 	return TRANSFER_BLOND;
 }
 
@@ -938,8 +923,7 @@
 	[TRANSFER_BLOND] = {
 		.state_name = "Blond",
 		.enter = blond_enter,
-		.next = blond_next,
-		.flags = TRANSFER_STATE_IS_TIMED,
+		.flags = TRANSFER_STATE_IS_TERMINAL,
 	},
 	[TRANSFER_RECALLING] = {
 		.state_name = "Recalling",




More information about the asterisk-commits mailing list