[asterisk-commits] mmichelson: branch mmichelson/queue-log-atxfer r121988 - /team/mmichelson/que...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 11 17:40:13 CDT 2008


Author: mmichelson
Date: Wed Jun 11 17:40:13 2008
New Revision: 121988

URL: http://svn.digium.com/view/asterisk?view=rev&rev=121988
Log:
Now the extra COMPLETECALLER event is not logged to the queue_log when
an attended transfer happens. The basic functionality is complete here. The
only thing left to do is to remove extraneous debug statements and add some
doxygenification.


Modified:
    team/mmichelson/queue-log-atxfer/apps/app_queue.c

Modified: team/mmichelson/queue-log-atxfer/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-log-atxfer/apps/app_queue.c?view=diff&rev=121988&r1=121987&r2=121988
==============================================================================
--- team/mmichelson/queue-log-atxfer/apps/app_queue.c (original)
+++ team/mmichelson/queue-log-atxfer/apps/app_queue.c Wed Jun 11 17:40:13 2008
@@ -3081,6 +3081,15 @@
 	ast_channel_datastore_remove(new_chan, datastore);
 }
 
+/* When a caller is atxferred, then the queue_transfer_info datastore
+ * is removed from the channel. If it's still there, then the caller was
+ * not atxferred
+ */
+static int attended_transfer_occurred(struct ast_channel *chan)
+{
+	return ast_channel_datastore_find(chan, &queue_transfer_info, NULL) ? 0 : 1;
+}
+
 static void setup_transfer_datastore(struct queue_ent *qe, struct member *member, int starttime)
 {
 	struct ast_datastore *ds;
@@ -3748,19 +3757,21 @@
 		/* If the queue member did an attended transfer, then the TRANSFER already was logged in the queue_log
 		 * when the masquerade occurred. These other "ending" queue_log messages are unnecessary
 		 */
-		if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
-			ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
-				qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
-				(long) (time(NULL) - callstart));
-			send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
-		} else if (ast_check_hangup(qe->chan)) {
-			ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
-				(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
-			send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
-		} else {
-			ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETEAGENT", "%ld|%ld|%d",
-				(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
-			send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
+		if (!attended_transfer_occurred(qe->chan)) {
+			if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
+				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
+					qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
+					(long) (time(NULL) - callstart));
+				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
+			} else if (ast_check_hangup(qe->chan)) {
+				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
+					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
+				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
+			} else {
+				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETEAGENT", "%ld|%ld|%d",
+					(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
+				send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
+			}
 		}
 
 		if (bridge != AST_PBX_NO_HANGUP_PEER)




More information about the asterisk-commits mailing list