[asterisk-commits] mmichelson: branch mmichelson/transfer_stasis r392719 - /team/mmichelson/tran...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 24 09:30:27 CDT 2013


Author: mmichelson
Date: Mon Jun 24 09:30:25 2013
New Revision: 392719

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392719
Log:
Adjust attended transfer event based on review feedback.


Modified:
    team/mmichelson/transfer_stasis/main/stasis_bridging.c

Modified: team/mmichelson/transfer_stasis/main/stasis_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/stasis_bridging.c?view=diff&rev=392719&r1=392718&r2=392719
==============================================================================
--- team/mmichelson/transfer_stasis/main/stasis_bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/stasis_bridging.c Mon Jun 24 09:30:25 2013
@@ -121,17 +121,95 @@
 			<synopsis>Raised when an attended transfer is complete.</synopsis>
 			<syntax>
 				<xi:include xpointer="xpointer(docs/managerEvent[@name='BlindTransfer']/managerEventInstance/syntax/parameter[@name='Result'])" />
-				<parameter name="Transferer1">
+				<parameter name="OrigTransfererChannel">
 					<para>The original transferer channel that performed the attended transfer.</para>
 				</parameter>
-				<parameter name="Bridge1">
-					<para>The unique ID of the bridge that <replaceable>Transferer1</replaceable> was in, or <literal>None</literal> if Transferer1 was not bridged</para>
-				</parameter>
-				<parameter name="Transferer2">
+				<parameter name="OrigTransfererChannelState">
+					<para>A numeric code for the channel's current state, related to DestChannelStateDesc</para>
+				</parameter>
+				<parameter name="OrigTransfererChannelStateDesc">
+					<enumlist>
+						<enum name="Down"/>
+						<enum name="Rsrvd"/>
+						<enum name="OffHook"/>
+						<enum name="Dialing"/>
+						<enum name="Ring"/>
+						<enum name="Ringing"/>
+						<enum name="Up"/>
+						<enum name="Busy"/>
+						<enum name="Dialing Offhook"/>
+						<enum name="Pre-ring"/>
+						<enum name="Unknown"/>
+					</enumlist>
+				</parameter>
+				<parameter name="OrigTransfererCallerIDNum">
+				</parameter>
+				<parameter name="OrigTransfererCallerIDName">
+				</parameter>
+				<parameter name="OrigTransfererConnectedLineNum">
+				</parameter>
+				<parameter name="OrigTransfererConnectedLineName">
+				</parameter>
+				<parameter name="OrigTransfererAccountCode">
+				</parameter>
+				<parameter name="OrigTransfererContext">
+				</parameter>
+				<parameter name="OrigTransfererExten">
+				</parameter>
+				<parameter name="OrigTransfererPriority">
+				</parameter>
+				<parameter name="OrigTransfererUniqueid">
+				</parameter>
+				<parameter name="BridgeUniqueidOrig">
+					<para>The ID of the bridge where the Transferer performed the transfer</para>
+				</parameter>
+				<parameter name="BridgeTypeOrig">
+					<para>The type of the bridge where the Transferer performed the transfer</para>
+				</parameter>
+				<parameter name="SecondTransfererChannel">
 					<para>The second transferer channel involved in the attended transfer.</para>
 				</parameter>
-				<parameter name="Bridge2">
-					<para>The unique ID of the bridge that <replaceable>Transferer2</replaceable> was in, or <literal>None</literal> if Transferer2 was not bridged</para>
+				<parameter name="SecondTransfererChannelState">
+					<para>A numeric code for the channel's current state, related to SecondTransfererChannelStateDesc</para>
+				</parameter>
+				<parameter name="SecondTransfererChannelStateDesc">
+					<enumlist>
+						<enum name="Down"/>
+						<enum name="Rsrvd"/>
+						<enum name="OffHook"/>
+						<enum name="Dialing"/>
+						<enum name="Ring"/>
+						<enum name="Ringing"/>
+						<enum name="Up"/>
+						<enum name="Busy"/>
+						<enum name="Dialing Offhook"/>
+						<enum name="Pre-ring"/>
+						<enum name="Unknown"/>
+					</enumlist>
+				</parameter>
+				<parameter name="SecondTransfererCallerIDNum">
+				</parameter>
+				<parameter name="SecondTransfererCallerIDName">
+				</parameter>
+				<parameter name="SecondTransfererConnectedLineNum">
+				</parameter>
+				<parameter name="SecondTransfererConnectedLineName">
+				</parameter>
+				<parameter name="SecondTransfererAccountCode">
+				</parameter>
+				<parameter name="SecondTransfererContext">
+				</parameter>
+				<parameter name="SecondTransfererExten">
+				</parameter>
+				<parameter name="SecondTransfererPriority">
+				</parameter>
+				<parameter name="SecondTransfererUniqueid">
+				</parameter>
+				<parameter name="BridgeUniqueidSecond">
+					<para>The unique ID of the bridge that the second transferer channel was in, or <literal>None</literal> if the second transferer channel was not bridged</para>
+				</parameter>
+				<parameter name="BridgeTypeSecond">
+					<para>The type of the bridge where the Transferer performed the transfer</para>
 				</parameter>
 				<parameter name="DestType">
 					<para>Indicates the method by which the attended transfer completed.</para>
@@ -142,7 +220,7 @@
 						<enum name="Fail"><para>The transfer failed.</para></enum>
 					</enumlist>
 				</parameter>
-				<parameter name="DestBridge">
+				<parameter name="DestBridgeUniqueid">
 					<para>Indicates the surviving bridge when bridges were merged to complete the transfer</para>
 					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Bridge</literal></para></note>
 				</parameter>
@@ -150,12 +228,105 @@
 					<para>Indicates the application that is running when the transfer completes</para>
 					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>App</literal></para></note>
 				</parameter>
-				<parameter name="LocalChannel1">
-					<para>The local channel that is bridged with Bridge1 when forming a link between bridges</para>
-					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
-				</parameter>
-				<parameter name="LocalChannel2">
-					<para>The local channel that is bridged with Bridge2 when forming a link between bridges</para>
+				<parameter name="LocalOrigChannel">
+					<para>The local channel that is bridged with the original bridge when forming a link between bridges</para>
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigChannelState">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigChannelStateDesc">
+					<enumlist>
+						<enum name="Down"/>
+						<enum name="Rsrvd"/>
+						<enum name="OffHook"/>
+						<enum name="Dialing"/>
+						<enum name="Ring"/>
+						<enum name="Ringing"/>
+						<enum name="Up"/>
+						<enum name="Busy"/>
+						<enum name="Dialing Offhook"/>
+						<enum name="Pre-ring"/>
+						<enum name="Unknown"/>
+					</enumlist>
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigCallerIDNum">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigCallerIDName">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigConnectedLineNum">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigConnectedLineName">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigAccountCode">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigContext">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigExten">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigPriority">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalOrigUniqueid">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondChannel">
+					<para>The local channel that is bridged with the second bridge when forming a link between bridges</para>
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondChannelState">
+					<para>A numeric code for the channel's current state, related to LocalSecondChannelStateDesc</para>
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondChannelStateDesc">
+					<enumlist>
+						<enum name="Down"/>
+						<enum name="Rsrvd"/>
+						<enum name="OffHook"/>
+						<enum name="Dialing"/>
+						<enum name="Ring"/>
+						<enum name="Ringing"/>
+						<enum name="Up"/>
+						<enum name="Busy"/>
+						<enum name="Dialing Offhook"/>
+						<enum name="Pre-ring"/>
+						<enum name="Unknown"/>
+					</enumlist>
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondCallerIDNum">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondCallerIDName">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondConnectedLineNum">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondConnectedLineName">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondAccountCode">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondContext">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondExten">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondPriority">
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+				<parameter name="LocalSecondUniqueid">
 					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
 				</parameter>
 			</syntax>
@@ -163,16 +334,16 @@
 				<para>The headers in this event attempt to describe all the major details of the attended transfer. The two transferer channels
 				and the two bridges are determined based on their chronological establishment. So consider that Alice calls Bob, and then Alice
 				transfers the call to Voicemail. The transferer and bridge headers would be arranged as follows:</para>
-				<para>	<replaceable>Transferer1</replaceable>: Alice's channel in the bridge with Bob.</para>
-				<para>	<replaceable>Bridge1</replaceable>: The bridge between Alice and Bob.</para>
-				<para>	<replaceable>Transferer2</replaceable>: Alice's channel that called Voicemail.</para>
-				<para>	<replaceable>Bridge2</replaceable>: None, since a call to Voicemail has no bridge.</para>
+				<para>	<replaceable>OrigTransfererChannel</replaceable>: Alice's channel in the bridge with Bob.</para>
+				<para>	<replaceable>BridgeUniqueidOrig</replaceable>: The bridge between Alice and Bob.</para>
+				<para>	<replaceable>SecondTransfererChannel</replaceable>: Alice's channel that called Voicemail.</para>
+				<para>	<replaceable>BridgeUniqueidSecond</replaceable>: None, since a call to Voicemail has no bridge.</para>
 				<para>Now consider if the order were reversed; instead of having Alice call Bob and transfer him to Voicemail, Alice instead
 				calls her Voicemail and transfers that to Bob. The transferer and bridge headers would be arranged as follows:</para>
-				<para>	<replaceable>Transferer1</replaceable>: Alice's channel that called Voicemail.</para>
-				<para>	<replaceable>Bridge1</replaceable>: None, since a call to Voicemail has no bridge.</para>
-				<para>	<replaceable>Transferer2</replaceable>: Alice's channel in the bridge with Bob.</para>
-				<para>	<replaceable>Bridge2</replaceable>: The bridge between Alice and Bob.</para>
+				<para>	<replaceable>OrigTransfererChannel</replaceable>: Alice's channel that called Voicemail.</para>
+				<para>	<replaceable>BridgeUniqueidOrig</replaceable>: None, since a call to Voicemail has no bridge.</para>
+				<para>	<replaceable>SecondTransfererChannel</replaceable>: Alice's channel in the bridge with Bob.</para>
+				<para>	<replaceable>BridgeUniqueidSecond</replaceable>: The bridge between Alice and Bob.</para>
 			</description>
 		</managerEventInstance>
 	</managerEvent>
@@ -621,25 +792,57 @@
 static struct ast_manager_event_blob *attended_transfer_to_ami(struct stasis_message *msg)
 {
 	RAII_VAR(struct ast_str *, variable_data, ast_str_create(64), ast_free_ptr);
+	RAII_VAR(struct ast_str *, transferer1_state, NULL, ast_free_ptr);
+	RAII_VAR(struct ast_str *, bridge1_state, NULL, ast_free_ptr);
+	RAII_VAR(struct ast_str *, transferer2_state, NULL, ast_free_ptr);
+	RAII_VAR(struct ast_str *, bridge2_state, NULL, ast_free_ptr);
+	RAII_VAR(struct ast_str *, local1_state, NULL, ast_free_ptr);
+	RAII_VAR(struct ast_str *, local2_state, NULL, ast_free_ptr);
 	struct ast_attended_transfer_message *transfer_msg = stasis_message_data(msg);
 
 	if (!variable_data) {
 		return NULL;
+	}
+
+	transferer1_state = ast_manager_build_channel_state_string_prefix(transfer_msg->to_transferee.channel_snapshot, "OrigTransferer");
+	transferer2_state = ast_manager_build_channel_state_string_prefix(transfer_msg->to_transfer_target.channel_snapshot, "SecondTransferer");
+
+	if (!transferer1_state || !transferer2_state) {
+		return NULL;
+	}
+
+	if (transfer_msg->to_transferee.bridge_snapshot) {
+		bridge1_state = ast_manager_build_bridge_state_string(transfer_msg->to_transferee.bridge_snapshot, "Orig");
+		if (!bridge1_state) {
+			return NULL;
+		}
+	}
+
+	if (transfer_msg->to_transfer_target.bridge_snapshot) {
+		bridge2_state = ast_manager_build_bridge_state_string(transfer_msg->to_transfer_target.bridge_snapshot, "Second");
+		if (!bridge2_state) {
+			return NULL;
+		}
 	}
 
 	switch (transfer_msg->dest_type) {
 	case AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE:
 		ast_str_append(&variable_data, 0, "DestType: Bridge\r\n");
-		ast_str_append(&variable_data, 0, "DestBridge: %s\r\n", transfer_msg->dest.bridge);
+		ast_str_append(&variable_data, 0, "DestBridgeUniqueid: %s\r\n", transfer_msg->dest.bridge);
 		break;
 	case AST_ATTENDED_TRANSFER_DEST_APP:
 		ast_str_append(&variable_data, 0, "DestType: App\r\n");
 		ast_str_append(&variable_data, 0, "DestApp: %s\r\n", transfer_msg->dest.app);
 		break;
 	case AST_ATTENDED_TRANSFER_DEST_LINK:
+		local1_state = ast_manager_build_channel_state_string_prefix(transfer_msg->dest.links[0], "LocalOrig");
+		local2_state = ast_manager_build_channel_state_string_prefix(transfer_msg->dest.links[1], "LocalSecond");
+		if (!local1_state || !local2_state) {
+			return NULL;
+		}
 		ast_str_append(&variable_data, 0, "DestType: Link\r\n");
-		ast_str_append(&variable_data, 0, "LocalChannel1: %s\r\n", transfer_msg->dest.links[0]->name);
-		ast_str_append(&variable_data, 0, "LocalChannel2: %s\r\n", transfer_msg->dest.links[1]->name);
+		ast_str_append(&variable_data, 0, "%s", ast_str_buffer(local1_state));
+		ast_str_append(&variable_data, 0, "%s", ast_str_buffer(local2_state));
 		break;
 	case AST_ATTENDED_TRANSFER_DEST_FAIL:
 		ast_str_append(&variable_data, 0, "DestType: Fail\r\n");
@@ -648,17 +851,17 @@
 
 	return ast_manager_event_blob_create(EVENT_FLAG_CALL, "AttendedTransfer",
 			"Result: %s\r\n"
-			"Transferer1: %s\r\n"
-			"Bridge1: %s\r\n"
-			"Transferer2: %s\r\n"
-			"Bridge2: %s\r\n"
+			"%s"
+			"%s"
+			"%s"
+			"%s"
 			"IsExternal: %s\r\n"
 			"%s\r\n",
 			result_strs[transfer_msg->result],
-			transfer_msg->to_transferee.channel_snapshot->name,
-			transfer_msg->to_transferee.bridge_snapshot ? transfer_msg->to_transferee.bridge_snapshot->uniqueid : "None",
-			transfer_msg->to_transfer_target.channel_snapshot->name,
-			transfer_msg->to_transfer_target.bridge_snapshot ? transfer_msg->to_transfer_target.bridge_snapshot->uniqueid : "None",
+			ast_str_buffer(transferer1_state),
+			bridge1_state ? ast_str_buffer(bridge1_state) : "",
+			ast_str_buffer(transferer2_state),
+			bridge2_state ? ast_str_buffer(bridge2_state) : "",
 			transfer_msg->is_external ? "Yes" : "No",
 			ast_str_buffer(variable_data));
 }




More information about the asterisk-commits mailing list