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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 17 17:16:52 CDT 2013


Author: mmichelson
Date: Mon Jun 17 17:16:51 2013
New Revision: 392114

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392114
Log:
Fill in CALLING_TARGET and HESITANT state callbacks.


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=392114&r1=392113&r2=392114
==============================================================================
--- team/mmichelson/atxfer_features/main/bridging_basic.c (original)
+++ team/mmichelson/atxfer_features/main/bridging_basic.c Mon Jun 17 17:16:51 2013
@@ -452,6 +452,10 @@
 struct attended_transfer_properties {
 	ast_mutex_t lock;
 	ast_cond_t cond;
+	struct ast_bridge *transferee_bridge;
+	struct ast_bridge *target_bridge;
+	struct ast_channel *transferer;
+	struct ast_channel *transfer_target;
 	struct timeval start;
 	struct timeval timeout;
 	enum attended_transfer_stimulus stimulus;
@@ -460,28 +464,68 @@
 	int atxfercallbackretries;
 };
 
-static int calling_target_enter(struct attended_transfer_properties *properties)
-{
-	/* XXX STUB */
-	return 0;
-}
-
-static enum attended_transfer_state calling_target_next(struct attended_transfer_properties *properties)
-{
-	/* XXX STUB */
-	return TRANSFER_FAIL;
-}
-
-static int hesitant_enter(struct attended_transfer_properties *properties)
-{
-	/* XXX STUB */
-	return 0;
-}
-
-static enum attended_transfer_state hesitant_next(struct attended_transfer_properties *properties)
-{
-	/* XXX STUB */
-	return TRANSFER_FAIL;
+/*!
+ * \brief enter callback for TRANSFER_CALLING_TARGET state
+ *
+ * This is the opening state when performing an attended transfer. The goal
+ * of this callback is simply to place the transferer into the target bridge.
+ */
+static int calling_target_enter(struct attended_transfer_properties *props)
+{
+	return ast_bridge_move(props->target_bridge, props->transferee_bridge, props->transferer, NULL, 1);
+}
+
+static enum attended_transfer_state calling_target_next(struct attended_transfer_properties *props)
+{
+	switch (props->stimulus) {
+	default:
+	case STIMULUS_NONE:
+		ast_assert(0);
+	case STIMULUS_TRANSFEREE_HANGUP:
+		return TRANSFER_FAIL;
+	case STIMULUS_DTMF_ATXFER_COMPLETE:
+	case STIMULUS_TRANSFERER_HANGUP:
+		return TRANSFER_BLOND;
+	case STIMULUS_TARGET_ANSWER:
+		return TRANSFER_CONSULTING;
+	case STIMULUS_TARGET_HANGUP:
+	case STIMULUS_TIMEOUT:
+	case STIMULUS_DTMF_ATXFER_ABORT:
+		return TRANSFER_REBRIDGE;
+	case STIMULUS_DTMF_ATXFER_THREEWAY:
+		return TRANSFER_THREEWAY;
+	case STIMULUS_DTMF_ATXFER_SWAP:
+		return TRANSFER_HESITANT;
+	}
+}
+
+static int hesitant_enter(struct attended_transfer_properties *props)
+{
+	return ast_bridge_move(props->transferee_bridge, props->target_bridge, props->transferer, NULL, 1);
+}
+
+static enum attended_transfer_state hesitant_next(struct attended_transfer_properties *props)
+{
+	switch (props->stimulus) {
+	default:
+	case STIMULUS_NONE:
+		ast_assert(0);
+	case STIMULUS_TRANSFEREE_HANGUP:
+		return TRANSFER_FAIL;
+	case STIMULUS_DTMF_ATXFER_COMPLETE:
+	case STIMULUS_TRANSFERER_HANGUP:
+		return TRANSFER_BLOND;
+	case STIMULUS_TARGET_ANSWER:
+		return TRANSFER_CONSULTING;
+	case STIMULUS_TARGET_HANGUP:
+	case STIMULUS_TIMEOUT:
+	case STIMULUS_DTMF_ATXFER_ABORT:
+		return TRANSFER_RESUME;
+	case STIMULUS_DTMF_ATXFER_THREEWAY:
+		return TRANSFER_THREEWAY;
+	case STIMULUS_DTMF_ATXFER_SWAP:
+		return TRANSFER_HESITANT;
+	}
 }
 
 static int rebridge_enter(struct attended_transfer_properties *properties)




More information about the asterisk-commits mailing list