[svn-commits] mmichelson: branch mmichelson/transfer_stasis r391294 - in /team/mmichelson/t...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jun 10 15:34:35 CDT 2013


Author: mmichelson
Date: Mon Jun 10 15:34:33 2013
New Revision: 391294

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391294
Log:
Create message structure for attended transfers.

It became clear that a bridge-channel pair structure would
be useful for representing certain items, and so the blind
transfer structure has also been given one of these for the
original bridge and its transferer channel.


Modified:
    team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h
    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=391294&r1=391293&r2=391294
==============================================================================
--- team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h (original)
+++ team/mmichelson/transfer_stasis/include/asterisk/stasis_bridging.h Mon Jun 10 15:34:33 2013
@@ -207,6 +207,14 @@
 struct ast_json *ast_bridge_snapshot_to_json(const struct ast_bridge_snapshot *snapshot);
 
 /*!
+ * \brief Pair showing a bridge and a specific channel belonging to the bridge
+ */
+struct ast_bridge_channel_pair {
+	struct ast_bridge_snapshot *bridge;
+	struct ast_channel_snapshot *channel;
+};
+
+/*!
  * \brief Message representing blind transfer
  */
 struct ast_blind_transfer_message {
@@ -220,10 +228,8 @@
 	enum ast_transfer_result result;
 	/*! If 0, was core DTMF transfer, otherwise was a native transfer */
 	int is_native;
-	/*! The bridge between the transferer and the transferee(s). May be NULL */
-	struct ast_bridge_snapshot *original_bridge;
-	/*! The channel that performed the transfer */
-	struct ast_channel_snapshot *transferer;
+	/*! The transferer and its bridge before starting the transfer*/
+	struct ast_bridge_channel_pair transferer;
 };
 
 /*!
@@ -248,6 +254,42 @@
 		struct ast_channel *transferer, struct ast_bridge *original_bridge,
 		const char *context, const char *exten);
 
+enum ast_attended_transfer_dest_type {
+	/*! The transfer results in a single bridge remaining due to a merge or swap */
+	AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE,
+	/*! The transfer results in a channel or bridge running an application */
+	AST_ATTENDED_TRANSFER_DEST_APP,
+	/*! The transfer results in both bridges remaining with a local channel linking them */
+	AST_ATTENDED_TRANSFER_DEST_LINK,
+};
+
+/*!
+ * \brief Message representing attended transfer
+ */
+struct ast_attended_transfer_message {
+	/*! Indicates if the transfer was performed using a native protocol */
+	int is_native;
+	/*! Bridge between transferer <-> transferee and the transferer channel in that bridge. May be NULL */
+	struct ast_bridge_channel_pair to_transferee;
+	/*! Bridge between transferer <-> transfer target and the transferer channel in that bridge. May be NULL */
+	struct ast_bridge_channel_pair to_transfer_target;
+	/*! Indicates the final state of the transfer */
+	enum ast_attended_transfer_dest_type dest_type;	
+	union {
+		/*! ID of the surviving bridge. Applicable for AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE */
+		const char *bridge_id;
+		/*! Destination application of transfer. Applicable for AST_ATTENDED_TRANSFER_DEST_APP */
+		const char *app;
+		/*! Pair of local channels and the bridge to which they belong. Applicable for AST_ATTENDED_TRANSFER_DEST_LINK */
+		struct {
+			/*! Local channel unique ID */
+			const char *channel;
+			/*! Bridge unique ID to which the local channel belongs */
+			const char *bridge;
+		} links[2];
+	} dest;
+};
+
 /*!
  * \brief Initialize the stasis bridging topic and message types
  * \retval 0 on success

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=391294&r1=391293&r2=391294
==============================================================================
--- team/mmichelson/transfer_stasis/main/stasis_bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/stasis_bridging.c Mon Jun 10 15:34:33 2013
@@ -316,8 +316,8 @@
 	struct ast_blind_transfer_message *msg = obj;
 
 	ast_string_field_free_memory(msg);
-	ao2_cleanup(msg->original_bridge);
-	ao2_cleanup(msg->transferer);
+	ao2_cleanup(msg->transferer.bridge);
+	ao2_cleanup(msg->transferer.channel);
 }
 
 static struct ast_blind_transfer_message *blind_transfer_message_create(int is_native,
@@ -332,14 +332,14 @@
 	}
 
 	if (original_bridge) {
-		msg->original_bridge = ast_bridge_snapshot_create(original_bridge);
-		if (!msg->original_bridge) {
+		msg->transferer.bridge = ast_bridge_snapshot_create(original_bridge);
+		if (!msg->transferer.bridge) {
 			return NULL;
 		}
 	}
 
-	msg->transferer = ast_channel_snapshot_create(transferer);
-	if (!msg->transferer) {
+	msg->transferer.channel = ast_channel_snapshot_create(transferer);
+	if (!msg->transferer.channel) {
 		return NULL;
 	}
 
@@ -412,10 +412,10 @@
 	xfer_msg = stasis_message_data(msg);
 
 	ast_log(LOG_NOTICE, "Blind transfer to %s@%s by %s\n", xfer_msg->exten,
-			xfer_msg->context, xfer_msg->transferer->name);
+			xfer_msg->context, xfer_msg->transferer.channel->name);
 	if (xfer_msg->result == AST_TRANSFER_SUCCESS) {
 		ast_log(LOG_NOTICE, "Transfer from bridge %s was successful\n",
-				xfer_msg->original_bridge->uniqueid);
+				xfer_msg->transferer.bridge->uniqueid);
 	} else {
 		ast_log(LOG_NOTICE, "Transfer was unsuccessful\n");
 	}




More information about the svn-commits mailing list