aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-04 22:58:26 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-04 22:58:26 +0000
commit1d48e783dc06be3ba9dcb462122ecbf465c0320a (patch)
tree0875e8a395843ca7c2861e097cf1a5ac8d192f97 /apps/app_queue.c
parente98502ccc52d21f3e05df3d9d3b28721a386e1f3 (diff)
A two-in-one patch from the bugtracker
1) Fix some bad logic in the counting of statistics for QueueSummary manager event. Variables were not being reset for each additional queue, so cumulative totals were reported on each successive queue. 2) Add a longest hold time stat to QueueSummary manager event. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@84726 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 26f503b00..b73d16d1e 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4426,6 +4426,7 @@ static int manager_queues_summary(struct mansession *s, const struct message *m)
int qmemcount = 0;
int qmemavail = 0;
int qchancount = 0;
+ int qlongestholdtime = 0;
const char *id = astman_get_header(m, "ActionID");
const char *queuefilter = astman_get_header(m, "Queue");
char idText[256] = "";
@@ -4445,6 +4446,12 @@ static int manager_queues_summary(struct mansession *s, const struct message *m)
/* List queue properties */
if (ast_strlen_zero(queuefilter) || !strcmp(q->name, queuefilter)) {
+ /* Reset the necessary local variables if no queuefilter is set*/
+ qmemcount = 0;
+ qmemavail = 0;
+ qchancount = 0;
+ qlongestholdtime = 0;
+
/* List Queue Members */
mem_iter = ao2_iterator_init(q->members, 0);
while ((mem = ao2_iterator_next(&mem_iter))) {
@@ -4457,6 +4464,9 @@ static int manager_queues_summary(struct mansession *s, const struct message *m)
ao2_ref(mem, -1);
}
for (qe = q->head; qe; qe = qe->next) {
+ if ((now - qe->start) > qlongestholdtime) {
+ qlongestholdtime = now - qe->start;
+ }
++qchancount;
}
astman_append(s, "Event: QueueSummary\r\n"
@@ -4465,9 +4475,10 @@ static int manager_queues_summary(struct mansession *s, const struct message *m)
"Available: %d\r\n"
"Callers: %d\r\n"
"HoldTime: %d\r\n"
+ "LongestHoldTime: %d\r\n"
"%s"
"\r\n",
- q->name, qmemcount, qmemavail, qchancount, q->holdtime, idText);
+ q->name, qmemcount, qmemavail, qchancount, q->holdtime, qlongestholdtime, idText);
}
ao2_unlock(q);
queue_unref(q);