[asterisk-commits] kmoore: branch kmoore/cel_transfers r393468 - in /team/kmoore/cel_transfers: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 2 13:56:20 CDT 2013


Author: kmoore
Date: Tue Jul  2 13:56:18 2013
New Revision: 393468

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393468
Log:
Attended transfer work so far, tests next

Modified:
    team/kmoore/cel_transfers/CHANGES
    team/kmoore/cel_transfers/main/cel.c

Modified: team/kmoore/cel_transfers/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_transfers/CHANGES?view=diff&rev=393468&r1=393467&r2=393468
==============================================================================
--- team/kmoore/cel_transfers/CHANGES (original)
+++ team/kmoore/cel_transfers/CHANGES Tue Jul  2 13:56:18 2013
@@ -278,7 +278,16 @@
 CEL (Channel Event Logging)
 ------------------
  * AST_CEL_BLINDTRANSFER events now report the transferee bridge unique
-   identifier instead of the transferee channel name.
+   identifier, extension, and context in the extra string instead of
+   the transferee channel name as the peer.
+
+ * AST_CEL_ATTENDEDTRANSFER events now report the peer as NULL and additional
+   information in the 'extra' string. For transfers that occur between two
+   bridged channels, the 'extra' string contains the primary bridge unique
+   identifier, the secondary channel name, and the secondary bridge unique
+   identifier. For transfers that occur between a bridged channel and a
+   channel running an app, the 'extra' string contains the primary bridge
+   unique identifier, the secondary channel name, and the app name.
 
 Features
 -------------------

Modified: team/kmoore/cel_transfers/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_transfers/main/cel.c?view=diff&rev=393468&r1=393467&r2=393468
==============================================================================
--- team/kmoore/cel_transfers/main/cel.c (original)
+++ team/kmoore/cel_transfers/main/cel.c Tue Jul  2 13:56:18 2013
@@ -1413,18 +1413,22 @@
 	struct ast_bridge_snapshot *bridge_snapshot = obj->bridge;
 	struct ast_json *blob = obj->blob;
 	struct ast_json *json_exten = ast_json_object_get(blob, "extension");
-	const char *exten;
-
-	if (!json_exten) {
+	struct ast_json *json_context = ast_json_object_get(blob, "context");
+	RAII_VAR(struct ast_str *, extra, ast_str_create(32), ast_free);
+	const char *exten, *context;
+
+	if (!json_exten || !json_context) {
 		return;
 	}
 
 	exten = ast_json_string_get(json_exten);
-	if (!exten) {
+	context = ast_json_string_get(json_context);
+	if (!exten || !context) {
 		return;
 	}
 
-	report_event_snapshot(chan_snapshot, AST_CEL_BLINDTRANSFER, NULL, exten, bridge_snapshot->uniqueid);
+	ast_str_set(&extra, 0, "%s,%s,%s", bridge_snapshot->uniqueid, exten, context);
+	report_event_snapshot(chan_snapshot, AST_CEL_BLINDTRANSFER, NULL, exten, NULL);
 }
 
 static void cel_attended_transfer_cb(
@@ -1432,6 +1436,37 @@
 	struct stasis_topic *topic,
 	struct stasis_message *message)
 {
+	struct ast_attended_transfer_message *xfer = stasis_message_data(message);
+	RAII_VAR(struct ast_str *, extra, ast_str_create(32), ast_free);
+	struct ast_bridge_snapshot *bridge1, *bridge2;
+	struct ast_channel_snapshot *channel1, *channel2;
+
+	/* Make sure bridge1 is always non-NULL */
+	if (!xfer->to_transferee.bridge_snapshot) {
+		bridge1 = xfer->to_transfer_target.bridge_snapshot;
+		bridge2 = xfer->to_transferee.bridge_snapshot;
+		channel1 = xfer->to_transfer_target.channel_snapshot;
+		channel2 = xfer->to_transferee.channel_snapshot;
+	} else {
+		bridge1 = xfer->to_transferee.bridge_snapshot;
+		bridge2 = xfer->to_transfer_target.bridge_snapshot;
+		channel1 = xfer->to_transferee.channel_snapshot;
+		channel2 = xfer->to_transfer_target.channel_snapshot;
+	}
+
+	switch (xfer->dest_type) {
+	case AST_ATTENDED_TRANSFER_DEST_FAIL:
+		return;
+		/* handle these two the same */
+	case AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE:
+	case AST_ATTENDED_TRANSFER_DEST_LINK:
+		ast_str_set(&extra, 0, "%s,%s,bridge:%s", bridge1->uniqueid, channel2->name, bridge2->uniqueid);
+		break;
+	case AST_ATTENDED_TRANSFER_DEST_APP:
+		ast_str_set(&extra, 0, "%s,%s,app:%s", bridge1->uniqueid, channel2->name, xfer->dest.app);
+		break;
+	}
+	report_event_snapshot(channel1, AST_CEL_ATTENDEDTRANSFER, NULL, ast_str_buffer(extra), NULL);
 }
 
 static void ast_cel_engine_term(void)




More information about the asterisk-commits mailing list