[asterisk-commits] mmichelson: branch mmichelson/transfer_stasis r391673 - in /team/mmichelson/t...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 13 12:59:07 CDT 2013


Author: mmichelson
Date: Thu Jun 13 12:59:05 2013
New Revision: 391673

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391673
Log:
Two changes:

* Adds documentation for AttendedTransfer manager event
* Removes redundant bridge parameters from link transfer function calls.


Modified:
    team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h
    team/mmichelson/transfer_stasis/main/bridging.c
    team/mmichelson/transfer_stasis/main/stasis_bridging.c

Modified: team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h?view=diff&rev=391673&r1=391672&r2=391673
==============================================================================
--- team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h (original)
+++ team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h Thu Jun 13 12:59:05 2013
@@ -293,13 +293,8 @@
 		char bridge[AST_UUID_STR_LEN];
 		/*! Destination application of transfer. Applicable for AST_ATTENDED_TRANSFER_DEST_APP */
 		char app[AST_MAX_APP];
-		/*! Pair of local channels and the bridge to which they belong. Applicable for AST_ATTENDED_TRANSFER_DEST_LINK */
-		struct {
-			/*! Local channel snapshot */
-			struct ast_channel_snapshot *local_channel;
-			/*! Bridge unique ID to which the local channel belongs */
-			char bridge[AST_UUID_STR_LEN];
-		} links[2];
+		/*! Pair of local channels linking the bridges. Applicable for AST_ATTENDED_TRANSFER_DEST_LINK */
+		struct ast_channel_snapshot *links[2];
 	} dest;
 };
 
@@ -387,11 +382,11 @@
  * \param result The result of the transfer. Will always be a type of failure.
  * \param transferee The bridge between the transferer and transferees as well as the transferer channel from that bridge
  * \param target The bridge between the transferer and transfer targets as well as the transferer channel from that bridge
- * \param locals The local channels linking the bridges together along with the bridge that each local channel belongs to.
+ * \param locals The local channels linking the bridges together.
  */
 void ast_bridge_publish_attended_transfer_link(int is_external, enum ast_transfer_result result,
 		struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target,
-		struct ast_bridge_channel_pair *locals[2]);
+		struct ast_channel *locals[2]);
 
 /*!
  * \brief Returns the most recent snapshot for the bridge.

Modified: team/mmichelson/transfer_stasis/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/transfer_stasis/main/bridging.c?view=diff&rev=391673&r1=391672&r2=391673
==============================================================================
--- team/mmichelson/transfer_stasis/main/bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/bridging.c Thu Jun 13 12:59:05 2013
@@ -5684,23 +5684,12 @@
  *
  * \param publication Base data about the attended transfer
  * \param local_channel1 Local channel in the original bridge
- * \param local_bridge1 Bridge that local_channel1 is in
  * \param local_channel2 Local channel in the second bridge
- * \param local_bridge2 Bridge taht local_channel2 is in
  */
 static void publish_attended_transfer_link(struct stasis_attended_transfer_publish_data *publication,
-		struct ast_channel *local_channel1, struct ast_bridge *local_bridge1,
-		struct ast_channel *local_channel2, struct ast_bridge *local_bridge2)
-{
-	struct ast_bridge_channel_pair local1 = {
-		.channel = local_channel1,
-		.bridge = local_bridge1,
-	};
-	struct ast_bridge_channel_pair local2 = {
-		.channel = local_channel2,
-		.bridge = local_bridge2,
-	};
-	struct ast_bridge_channel_pair *locals[2] = { &local1, &local2 };
+		struct ast_channel *local_channel1, struct ast_channel *local_channel2)
+{
+	struct ast_channel *locals[2] = { local_channel1, local_channel2 };
 
 	ast_bridge_publish_attended_transfer_link(1, AST_BRIDGE_TRANSFER_SUCCESS,
 			&publication->to_transferee, &publication->to_transfer_target, locals);
@@ -5791,7 +5780,7 @@
 		ast_assert(local_chan2 != NULL);
 
 		publish_attended_transfer_link(publication,
-				local_chan, bridge1, local_chan2, bridge2);
+				local_chan, local_chan2);
 	} else {
 		publish_attended_transfer_app(publication, app);
 	}

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=391673&r1=391672&r2=391673
==============================================================================
--- team/mmichelson/transfer_stasis/main/stasis_bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/stasis_bridging.c Thu Jun 13 12:59:05 2013
@@ -80,6 +80,51 @@
 			</syntax>
 		</managerEventInstance>
 	</managerEvent>
+	<managerEvent language="en_US" name="AttendedTransfer">
+		<managerEventInstance class="EVENT_FLAG_CALL">
+			<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">
+					<para>The original transferer channel that performed the attended transfer.</para>
+				</parameter>
+				<parameter name="Bridge1">
+					<para>The bridge that Transferer1 was in, or <literal>None</literal> if Transferer1 was not bridged</para>
+				</parameter>
+				<parameter name="Transferer2">
+					<para>The second transferer channel involved in the attended transfer.</para>
+				</parameter>
+				<parameter name="Bridge2">
+					<para>The bridge that Transferer2 was in, or <literal>None</literal> if Transferer2 was not bridged</para>
+				</parameter>
+				<parameter name="DestType">
+					<para>Indicates the method by which the attended transfer completed.</para>
+					<enumlist>
+						<enum name="Bridge"><para>The transfer was accomplished by merging two bridges into one.</para></enum>
+						<enum name="App"><para>The transfer was accomplished by having a channel or bridge run a dialplan application.</para></enum>
+						<enum name="Link"><para>The transfer was accomplished by linking two bridges together using a local channel pair.</para></enum>
+						<enum name="Fail"><para>The transfer failed.</para></enum>
+					</enumlist>
+				</parameter>
+				<parameter name="DestBridge">
+					<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>
+				<parameter name="DestApp">
+					<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>
+					<note><para>This header is only present when <replaceable>DestType</replaceable> is <literal>Link</literal></para></note>
+				</parameter>
+			</syntax>
+		</managerEventInstance>
+	</managerEvent>
  ***/
 
 static struct ast_manager_event_blob *attended_transfer_to_ami(struct stasis_message *message);
@@ -492,10 +537,8 @@
 		break;
 	case AST_ATTENDED_TRANSFER_DEST_LINK:
 		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].local_channel->name);
-		ast_str_append(&variable_data, 0, "LocalBridge1: %s\r\n", transfer_msg->dest.links[0].bridge);
-		ast_str_append(&variable_data, 0, "LocalChannel2: %s\r\n", transfer_msg->dest.links[1].local_channel->name);
-		ast_str_append(&variable_data, 0, "LocalBridge2: %s\r\n", transfer_msg->dest.links[1].bridge);
+		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);
 		break;
 	case AST_ATTENDED_TRANSFER_DEST_FAIL:
 		ast_str_append(&variable_data, 0, "DestType: Fail\r\n");
@@ -532,7 +575,7 @@
 	}
 
 	for (i = 0; i < ARRAY_LEN(msg->dest.links); ++i) {
-		ao2_cleanup(msg->dest.links[i].local_channel);
+		ao2_cleanup(msg->dest.links[i]);
 	}
 }
 
@@ -628,7 +671,7 @@
 
 void ast_bridge_publish_attended_transfer_link(int is_external, enum ast_transfer_result result,
 		struct ast_bridge_channel_pair *transferee, struct ast_bridge_channel_pair *target,
-		struct ast_bridge_channel_pair *locals[2])
+		struct ast_channel *locals[2])
 {
 	RAII_VAR(struct ast_attended_transfer_message *, transfer_msg, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
@@ -641,12 +684,10 @@
 
 	transfer_msg->dest_type = AST_ATTENDED_TRANSFER_DEST_LINK;
 	for (i = 0; i < 2; ++i) {
-		transfer_msg->dest.links[i].local_channel = ast_channel_snapshot_create(locals[i]->channel);
-		if (!transfer_msg->dest.links[i].local_channel) {
+		transfer_msg->dest.links[i] = ast_channel_snapshot_create(locals[i]);
+		if (!transfer_msg->dest.links[i]) {
 			return;
 		}
-		ast_copy_string(transfer_msg->dest.links[i].bridge, locals[i]->bridge->uniqueid,
-			sizeof(transfer_msg->dest.links[i].bridge));
 	}
 
 	msg = stasis_message_create(ast_attended_transfer_type(), transfer_msg);
@@ -761,9 +802,8 @@
 		ast_log(LOG_NOTICE, "Transfer to application %s\n", xfer_msg->dest.app);
 		break;
 	case AST_ATTENDED_TRANSFER_DEST_LINK:
-		ast_log(LOG_NOTICE, "Transfer linking two bridges.\n\t\tFirst chan and bridge: %s and %s.\n\t\tSecond chan and bridge: %s and %s\n",
-				xfer_msg->dest.links[0].local_channel->name, xfer_msg->dest.links[0].bridge,
-				xfer_msg->dest.links[1].local_channel->name, xfer_msg->dest.links[1].bridge);
+		ast_log(LOG_NOTICE, "Transfer linking two bridges.\n\t\tFirst chan: %s.\n\t\tSecond chan: %s\n",
+				xfer_msg->dest.links[0]->name, xfer_msg->dest.links[1]->name);
 		break;
 	}
 }




More information about the asterisk-commits mailing list