[svn-commits] mmichelson: branch mmichelson/transfer_stasis r391429 - /team/mmichelson/tran...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 11 14:26:37 CDT 2013


Author: mmichelson
Date: Tue Jun 11 14:26:35 2013
New Revision: 391429

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=391429
Log:
Add a test function for seeing attended transfer events.


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=391429&r1=391428&r2=391429
==============================================================================
--- team/mmichelson/transfer_stasis/main/stasis_bridging.c (original)
+++ team/mmichelson/transfer_stasis/main/stasis_bridging.c Tue Jun 11 14:26:35 2013
@@ -611,6 +611,45 @@
 	}
 }
 
+static void atxfer_cb(void *userdata, struct stasis_subscription *sub,
+		struct stasis_topic *topic, struct stasis_message *msg)
+{
+	struct ast_attended_transfer_message *xfer_msg;
+
+	if (ast_attended_transfer_type() != stasis_message_type(msg)) {
+		return;
+	}
+
+	xfer_msg = stasis_message_data(msg);
+
+	ast_log(LOG_NOTICE, "Attended transfer!\n");
+	ast_log(LOG_NOTICE, "Original transferer: %s, and his bridge: %s\n",
+			xfer_msg->to_transferee.channel_snapshot->name,
+			xfer_msg->to_transferee.bridge_snapshot ? xfer_msg->to_transferee.bridge_snapshot->uniqueid : "None");
+
+	ast_log(LOG_NOTICE, "Second transferer: %s, and his bridge: %s\n",
+			xfer_msg->to_transfer_target.channel_snapshot->name,
+			xfer_msg->to_transfer_target.bridge_snapshot ? xfer_msg->to_transfer_target.bridge_snapshot->uniqueid : "None");
+
+	switch (xfer_msg->dest_type) {
+	case AST_ATTENDED_TRANSFER_DEST_FAIL:
+		ast_log(LOG_NOTICE, "Attended transfer attempt failed :(\n");
+		break;
+	case AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE:
+		ast_log(LOG_NOTICE, "Transfer accomplished via bridge merge. Surviving bridge: %s\n",
+				xfer_msg->dest.bridge);
+		break;
+	case AST_ATTENDED_TRANSFER_DEST_APP:
+		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. First bridge and chan: %s and %s. Second bridge and chan: %s and %s\n",
+				xfer_msg->dest.links[0].channel, xfer_msg->dest.links[0].bridge,
+				xfer_msg->dest.links[1].channel, xfer_msg->dest.links[1].bridge);
+		break;
+	}
+}
+
 int ast_stasis_bridging_init(void)
 {
 	ast_register_cleanup(stasis_bridging_cleanup);
@@ -627,6 +666,7 @@
 
 	/* XXX Temporary stasis subscriptions for debugging/testing */
 	stasis_subscribe(ast_bridge_topic_all(), transfer_cb, NULL);
+	stasis_subscribe(ast_bridge_topic_all(), atxfer_cb, NULL);
 
 	return !bridge_topic_all
 		|| !bridge_topic_all_cached




More information about the svn-commits mailing list