[asterisk-commits] russell: trunk r62462 - in /trunk: CHANGES apps/app_queue.c doc/queuelog.tex

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Apr 30 09:46:49 MST 2007


Author: russell
Date: Mon Apr 30 11:46:49 2007
New Revision: 62462

URL: http://svn.digium.com/view/asterisk?view=rev&rev=62462
Log:
This patch adds additional information to the EXITWITHKEY and EXITWITHTIMEOUT
entries in the queue log.
(issue #7561, reported and originally patched by fkasumovic, patch slightly
 modified and updated to trunk by me)

Modified:
    trunk/CHANGES
    trunk/apps/app_queue.c
    trunk/doc/queuelog.tex

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=62462&r1=62461&r2=62462
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Apr 30 11:46:49 2007
@@ -113,6 +113,8 @@
   * Added min-announce-frequency option to queues.conf which allows you to control the
      minimum amount of time between queue announcements for use when the caller's queue
      position changes frequently.
+  * Added additional information to EXITWITHTIMEOUT and EXITWITHKEY events in the
+     queue log.
 
 MeetMe Changes
 --------------

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=62462&r1=62461&r2=62462
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Mon Apr 30 11:46:49 2007
@@ -2056,7 +2056,7 @@
 							if (in->cdr)
 								ast_cdr_busy(in->cdr);
 							do_hang(o);
-							endtime = (long)time(NULL);
+							endtime = (long) time(NULL);
 							endtime -= starttime;
 							rna(endtime*1000, qe, on, membername);
 							if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
@@ -2071,7 +2071,7 @@
 								ast_verbose( VERBOSE_PREFIX_3 "%s is circuit-busy\n", o->chan->name);
 							if (in->cdr)
 								ast_cdr_busy(in->cdr);
-							endtime = (long)time(NULL);
+							endtime = (long) time(NULL);
 							endtime -= starttime;
 							rna(endtime*1000, qe, on, membername);
 							do_hang(o);
@@ -2236,7 +2236,7 @@
 		/* leave the queue if no agents, if enabled */
 		if (qe->parent->leavewhenempty && (stat == QUEUE_NO_MEMBERS)) {
 			*reason = QUEUE_LEAVEEMPTY;
-			ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long)time(NULL) - qe->start);
+			ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
 			leave_queue(qe);
 			break;
 		}
@@ -2244,13 +2244,13 @@
 		/* leave the queue if no reachable agents, if enabled */
 		if ((qe->parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
 			*reason = QUEUE_LEAVEUNAVAIL;
-			ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long)time(NULL) - qe->start);
+			ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
 			leave_queue(qe);
 			break;
 		}
 		if ((qe->parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS)) {
 			*reason = QUEUE_LEAVEUNAVAIL;
-			ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long)time(NULL) - qe->start);
+			ast_queue_log(qe->parent->name, qe->chan->uniqueid, "NONE", "EXITEMPTY", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
 			leave_queue(qe);
 			break;
 		}
@@ -2580,7 +2580,7 @@
 			} else if (res2) {
 				/* Caller must have hung up just before being connected*/
 				ast_log(LOG_NOTICE, "Caller was about to talk to agent on %s but the caller hungup.\n", peer->name);
-				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long)time(NULL) - qe->start);
+				ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "ABANDON", "%d|%d|%ld", qe->pos, qe->opos, (long) time(NULL) - qe->start);
 				record_abandoned(qe);
 				ast_hangup(peer);
 				return -1;
@@ -2711,7 +2711,7 @@
 		/* use  pbx_builtin_setvar to set a load of variables with one call */
 		if (qe->parent->setqueueentryvar) {
 			snprintf(interfacevar,sizeof(interfacevar), "QEHOLDTIME=%ld|QEORIGINALPOS=%d",
-				(long)time(NULL) - qe->start, qe->opos);
+				(long) time(NULL) - qe->start, qe->opos);
 			pbx_builtin_setvar(qe->chan, interfacevar);
 		}
 	
@@ -2766,7 +2766,7 @@
 			} else
 				ast_log(LOG_WARNING, "Asked to execute an AGI on this channel, but could not find application (agi)!\n");
 		}
-		ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "CONNECT", "%ld|%s", (long)time(NULL) - qe->start, peer->uniqueid);
+		ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "CONNECT", "%ld|%s", (long) time(NULL) - qe->start, peer->uniqueid);
 		if (qe->parent->eventwhencalled)
 			manager_event(EVENT_FLAG_AGENT, "AgentConnect",
 					"Queue: %s\r\n"
@@ -2778,7 +2778,7 @@
 					"BridgedChannel: %s\r\n"
 					"%s",
 					queuename, qe->chan->uniqueid, peer->name, member->interface, member->membername,
-					(long)time(NULL) - qe->start, peer->uniqueid,
+					(long) time(NULL) - qe->start, peer->uniqueid,
 					qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
 		ast_copy_string(oldcontext, qe->chan->context, sizeof(oldcontext));
 		ast_copy_string(oldexten, qe->chan->exten, sizeof(oldexten));
@@ -3521,7 +3521,8 @@
 			if (!res)
 				break;
 			if (valid_exit(&qe, res)) {
-				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
+				ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d|%d|%ld", 
+					qe.digits, qe.pos, qe.opos, (long) time(NULL) - qe.start);
 				break;
 			}
 		}
@@ -3541,7 +3542,8 @@
 					record_abandoned(&qe);
 					reason = QUEUE_TIMEOUT;
 					res = 0;
-					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
+					ast_queue_log(args.queuename, chan->uniqueid,"NONE", "EXITWITHTIMEOUT", "%d|%d|%ld", 
+						qe.pos, qe.opos, (long) time(NULL) - qe.start);
 					break;
 				}
 
@@ -3549,7 +3551,8 @@
 					/* Make a position announcement, if enabled */
 					if (qe.parent->announcefrequency && !ringing &&
 						(res = say_position(&qe))) {
-						ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
+						ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d|%d|%ld", 
+							qe.digits, qe.pos, qe.opos, (long) time(NULL) - qe.start);
 						break;
 					}
 
@@ -3559,7 +3562,8 @@
 				/* Make a periodic announcement, if enabled */
 				if (qe.parent->periodicannouncefrequency && !ringing &&
 					(res = say_periodic_announcement(&qe))) {
-					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%c|%d", res, qe.pos);
+					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d|%d|%ld", 
+						qe.digits, qe.pos, qe.opos, (long) time(NULL) - qe.start);
 					break;
 				}
 
@@ -3574,8 +3578,8 @@
 								(long) time(NULL) - qe.start);
 						}
 					} else if (valid_exit(&qe, res)) {
-						ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY",
-							"%s|%d", qe.digits, qe.pos);
+						ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d|%d|%ld", 
+							qe.digits, qe.pos, qe.opos, (long) time(NULL) - qe.start);
 					}
 					break;
 				}
@@ -3609,7 +3613,7 @@
 					record_abandoned(&qe);
 					reason = QUEUE_TIMEOUT;
 					res = 0;
-					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
+					ast_queue_log(qe.parent->name, qe.chan->uniqueid,"NONE", "EXITWITHTIMEOUT", "%d|%d|%ld", qe.pos, qe.opos, (long) time(NULL) - qe.start);
 					break;
 				}
 
@@ -3617,7 +3621,7 @@
 				res = wait_a_bit(&qe);
 				if (res < 0) {
 					record_abandoned(&qe);
-					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
+					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long) time(NULL) - qe.start);
 					if (option_verbose > 2) {
 						ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s when they almost made it\n", args.queuename);
 					}
@@ -3625,14 +3629,16 @@
 					break;
 				}
 				if (res && valid_exit(&qe, res)) {
-					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
+					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d|%d|%ld", 
+						qe.digits, qe.pos, qe.opos, (long) time(NULL) - qe.start);
 					break;
 				}
 				/* exit after 'timeout' cycle if 'n' option enabled */
 				if (go_on) {
 					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "Exiting on time-out cycle\n");
-					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
+					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d|%d|%ld", 
+						qe.pos, qe.opos, (long) time(NULL) - qe.start);
 					record_abandoned(&qe);
 					reason = QUEUE_TIMEOUT;
 					res = 0;

Modified: trunk/doc/queuelog.tex
URL: http://svn.digium.com/view/asterisk/trunk/doc/queuelog.tex?view=diff&rev=62462&r1=62461&r2=62462
==============================================================================
--- trunk/doc/queuelog.tex (original)
+++ trunk/doc/queuelog.tex Mon Apr 30 11:46:49 2007
@@ -66,12 +66,15 @@
 caller was when they first entered the queue, and the waittime is how 
 long the call had been waiting in the queue at the time of disconnect.
 
-EXITWITHKEY(key|position)
+EXITWITHKEY(key|position|origposition|waittime)
 The caller elected to use a menu key to exit the queue.  The key and
-the caller's position in the queue are recorded.
+the caller's position in the queue are recorded.  The caller's entry
+position and amoutn of time waited is also recorded.
 
-EXITWITHTIMEOUT(position)
-The caller was on hold too long and the timeout expired.
+EXITWITHTIMEOUT(position|origposition|waittime)
+The caller was on hold too long and the timeout expired.  The position in the
+queue when the timeout occurred, the entry position, and the amount of time
+waited are logged.
 
 QUEUESTART
 The queueing system has been started for the first time this session.



More information about the asterisk-commits mailing list