[svn-commits] mmichelson: branch mmichelson/queue_bugbug r395200 - in /team/mmichelson/queu...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jul 23 15:05:27 CDT 2013


Author: mmichelson
Date: Tue Jul 23 15:05:25 2013
New Revision: 395200

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395200
Log:
Properly log attended transfers in the queue log.

The CHANGES file has been updated to indicate how attended
transfers are differentiated from blind transfers in the queue
log.


Modified:
    team/mmichelson/queue_bugbug/CHANGES
    team/mmichelson/queue_bugbug/apps/app_queue.c

Modified: team/mmichelson/queue_bugbug/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/queue_bugbug/CHANGES?view=diff&rev=395200&r1=395199&r2=395200
==============================================================================
--- team/mmichelson/queue_bugbug/CHANGES (original)
+++ team/mmichelson/queue_bugbug/CHANGES Tue Jul 23 15:05:25 2013
@@ -97,6 +97,14 @@
    removed.  As a result, the AMI events QueueMemberStatus, AgentCalled,
    AgentConnect, AgentComplete, AgentDump, and AgentRingNoAnswer will always be
    sent.  The "Variable" fields will also no longer exist on the Agent* events.
+
+ * The queue log now differentiates between blind and attended transfers. A
+   blind transfer will result in a BLINDTRANSFER message with the destination
+   context and extension. An attended transfer will result in an
+   ATTENDEDTRANSFER message. This message will indicate the method by which
+   the attended transfer was completed: "BRIDGE" for a bridge merge, "APP"
+   for running an application on a bridge or channel, or "LINK" for linking
+   two bridges together with local channels.
 
 ResetCDR
 ------------------

Modified: team/mmichelson/queue_bugbug/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/queue_bugbug/apps/app_queue.c?view=diff&rev=395200&r1=395199&r2=395200
==============================================================================
--- team/mmichelson/queue_bugbug/apps/app_queue.c (original)
+++ team/mmichelson/queue_bugbug/apps/app_queue.c Tue Jul 23 15:05:25 2013
@@ -5252,6 +5252,40 @@
 	return queue_data;
 }
 
+static void log_attended_transfer(struct queue_stasis_data *queue_data, struct ast_channel_snapshot *caller,
+		struct ast_attended_transfer_message *atxfer_msg)
+{
+	RAII_VAR(struct ast_str *, transfer_str, ast_str_create(32), ast_free);
+
+	if (!transfer_str) {
+		ast_log(LOG_WARNING, "Unable to log attended transfer to queue log\n");
+		return;
+	}
+
+	switch (atxfer_msg->dest_type) {
+	case AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE:
+		ast_str_append(&transfer_str, 0, "BRIDGE|%s", atxfer_msg->dest.bridge);
+		break;
+	case AST_ATTENDED_TRANSFER_DEST_APP:
+		ast_str_append(&transfer_str, 0, "APP|%s", atxfer_msg->dest.app);
+		break;
+	case AST_ATTENDED_TRANSFER_DEST_LINK:
+		ast_str_append(&transfer_str, 0, "LINK|%s|%s", atxfer_msg->dest.links[0]->name,
+				atxfer_msg->dest.links[1]->name);
+		break;
+	case AST_ATTENDED_TRANSFER_DEST_THREEWAY:
+	case AST_ATTENDED_TRANSFER_DEST_FAIL:
+		/* Threeways are headed off and should not be logged here */
+		ast_assert(0);
+		return;
+	}
+
+	ast_queue_log(queue_data->queue->name, caller->uniqueid, queue_data->member->membername, "ATTENDEDTRANSFER", "%s|%ld|%ld|%d",
+			ast_str_buffer(transfer_str),
+			(long) queue_data->starttime - queue_data->holdstart,
+			(long) time(NULL) - queue_data->starttime, queue_data->caller_pos);
+}
+
 static void queue_bridge_cb(void *userdata, struct stasis_subscription *sub,
 		struct stasis_topic *topic, struct stasis_message *msg)
 {
@@ -5299,7 +5333,7 @@
 		ao2_unlock(queue_data);
 
 		ast_log(LOG_NOTICE, "Detected blind transfer in queue %s\n", queue_data->queue->name);
-		ast_queue_log(queue_data->queue->name, caller->uniqueid, queue_data->member->membername, "TRANSFER", "%s|%s|%ld|%ld|%d",
+		ast_queue_log(queue_data->queue->name, caller->uniqueid, queue_data->member->membername, "BLINDTRANSFER", "%s|%s|%ld|%ld|%d",
 				ast_json_string_get(ast_json_object_get(blind_blob->blob, "exten")),
 				ast_json_string_get(ast_json_object_get(blind_blob->blob, "context")),
 				(long) queue_data->starttime - queue_data->holdstart,
@@ -5342,10 +5376,9 @@
 		ao2_unlock(queue_data);
 
 		ast_log(LOG_NOTICE, "Detected attended transfer in queue %s\n", queue_data->queue->name);
-		/* XXX Need to send queue log something-or-other here. Problem is that it doesn't really make
-		 * sense to specify an exten and context on an attended transfer. Perhaps separate queue log message
-		 * type?
-		 */
+
+		log_attended_transfer(queue_data, caller, atxfer_msg);
+
 		send_agent_complete(queue_data->queue->name, caller, agent, queue_data->member,
 				queue_data->holdstart, queue_data->starttime, TRANSFER);
 		update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,




More information about the svn-commits mailing list