Add member/queue filters to queuestatus manager command (bug #3995)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5441 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
e87a53037e
commit
a3c09af463
1 changed files with 54 additions and 49 deletions
101
apps/app_queue.c
101
apps/app_queue.c
|
@ -2883,6 +2883,8 @@ static int manager_queues_status( struct mansession *s, struct message *m )
|
||||||
time_t now;
|
time_t now;
|
||||||
int pos;
|
int pos;
|
||||||
char *id = astman_get_header(m,"ActionID");
|
char *id = astman_get_header(m,"ActionID");
|
||||||
|
char *queuefilter = astman_get_header(m,"Queue");
|
||||||
|
char *memberfilter = astman_get_header(m,"Member");
|
||||||
char idText[256] = "";
|
char idText[256] = "";
|
||||||
struct ast_call_queue *q;
|
struct ast_call_queue *q;
|
||||||
struct queue_ent *qe;
|
struct queue_ent *qe;
|
||||||
|
@ -2899,57 +2901,60 @@ static int manager_queues_status( struct mansession *s, struct message *m )
|
||||||
ast_mutex_lock(&q->lock);
|
ast_mutex_lock(&q->lock);
|
||||||
|
|
||||||
/* List queue properties */
|
/* List queue properties */
|
||||||
if(q->callscompleted > 0)
|
if (ast_strlen_zero(queuefilter) || !strcmp(q->name, queuefilter)) {
|
||||||
sl = 100*((float)q->callscompletedinsl/(float)q->callscompleted);
|
if(q->callscompleted > 0)
|
||||||
ast_mutex_lock(&s->lock);
|
sl = 100*((float)q->callscompletedinsl/(float)q->callscompleted);
|
||||||
ast_cli(s->fd, "Event: QueueParams\r\n"
|
ast_mutex_lock(&s->lock);
|
||||||
|
ast_cli(s->fd, "Event: QueueParams\r\n"
|
||||||
|
"Queue: %s\r\n"
|
||||||
|
"Max: %d\r\n"
|
||||||
|
"Calls: %d\r\n"
|
||||||
|
"Holdtime: %d\r\n"
|
||||||
|
"Completed: %d\r\n"
|
||||||
|
"Abandoned: %d\r\n"
|
||||||
|
"ServiceLevel: %d\r\n"
|
||||||
|
"ServicelevelPerf: %2.1f\r\n"
|
||||||
|
"Weight: %d\r\n"
|
||||||
|
"%s"
|
||||||
|
"\r\n",
|
||||||
|
q->name, q->maxlen, q->count, q->holdtime, q->callscompleted,
|
||||||
|
q->callsabandoned, q->servicelevel, sl, q->weight, idText);
|
||||||
|
/* List Queue Members */
|
||||||
|
for (mem = q->members; mem; mem = mem->next) {
|
||||||
|
if (ast_strlen_zero(memberfilter) || !strcmp(mem->interface, memberfilter)) {
|
||||||
|
ast_cli(s->fd, "Event: QueueMember\r\n"
|
||||||
|
"Queue: %s\r\n"
|
||||||
|
"Location: %s\r\n"
|
||||||
|
"Membership: %s\r\n"
|
||||||
|
"Penalty: %d\r\n"
|
||||||
|
"CallsTaken: %d\r\n"
|
||||||
|
"LastCall: %ld\r\n"
|
||||||
|
"Status: %d\r\n"
|
||||||
|
"Paused: %d\r\n"
|
||||||
|
"%s"
|
||||||
|
"\r\n",
|
||||||
|
q->name, mem->interface, mem->dynamic ? "dynamic" : "static",
|
||||||
|
mem->penalty, mem->calls, mem->lastcall, mem->status, mem->paused, idText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* List Queue Entries */
|
||||||
|
pos = 1;
|
||||||
|
for (qe = q->head; qe; qe = qe->next) {
|
||||||
|
ast_cli(s->fd, "Event: QueueEntry\r\n"
|
||||||
"Queue: %s\r\n"
|
"Queue: %s\r\n"
|
||||||
"Max: %d\r\n"
|
"Position: %d\r\n"
|
||||||
"Calls: %d\r\n"
|
"Channel: %s\r\n"
|
||||||
"Holdtime: %d\r\n"
|
"CallerID: %s\r\n"
|
||||||
"Completed: %d\r\n"
|
"CallerIDName: %s\r\n"
|
||||||
"Abandoned: %d\r\n"
|
"Wait: %ld\r\n"
|
||||||
"ServiceLevel: %d\r\n"
|
|
||||||
"ServicelevelPerf: %2.1f\r\n"
|
|
||||||
"Weight: %d\r\n"
|
|
||||||
"%s"
|
"%s"
|
||||||
"\r\n",
|
"\r\n",
|
||||||
q->name, q->maxlen, q->count, q->holdtime, q->callscompleted,
|
q->name, pos++, qe->chan->name,
|
||||||
q->callsabandoned, q->servicelevel, sl, q->weight, idText);
|
qe->chan->cid.cid_num ? qe->chan->cid.cid_num : "unknown",
|
||||||
|
qe->chan->cid.cid_name ? qe->chan->cid.cid_name : "unknown",
|
||||||
/* List Queue Members */
|
(long)(now - qe->start), idText);
|
||||||
for (mem = q->members; mem; mem = mem->next)
|
}
|
||||||
ast_cli(s->fd, "Event: QueueMember\r\n"
|
}
|
||||||
"Queue: %s\r\n"
|
|
||||||
"Location: %s\r\n"
|
|
||||||
"Membership: %s\r\n"
|
|
||||||
"Penalty: %d\r\n"
|
|
||||||
"CallsTaken: %d\r\n"
|
|
||||||
"LastCall: %ld\r\n"
|
|
||||||
"Status: %d\r\n"
|
|
||||||
"Paused: %d\r\n"
|
|
||||||
"%s"
|
|
||||||
"\r\n",
|
|
||||||
q->name, mem->interface, mem->dynamic ? "dynamic" : "static",
|
|
||||||
mem->penalty, mem->calls, mem->lastcall, mem->status, mem->paused, idText);
|
|
||||||
|
|
||||||
/* List Queue Entries */
|
|
||||||
|
|
||||||
pos = 1;
|
|
||||||
for (qe = q->head; qe; qe = qe->next)
|
|
||||||
ast_cli(s->fd, "Event: QueueEntry\r\n"
|
|
||||||
"Queue: %s\r\n"
|
|
||||||
"Position: %d\r\n"
|
|
||||||
"Channel: %s\r\n"
|
|
||||||
"CallerID: %s\r\n"
|
|
||||||
"CallerIDName: %s\r\n"
|
|
||||||
"Wait: %ld\r\n"
|
|
||||||
"%s"
|
|
||||||
"\r\n",
|
|
||||||
q->name, pos++, qe->chan->name,
|
|
||||||
qe->chan->cid.cid_num ? qe->chan->cid.cid_num : "unknown",
|
|
||||||
qe->chan->cid.cid_name ? qe->chan->cid.cid_name : "unknown",
|
|
||||||
(long)(now - qe->start), idText);
|
|
||||||
ast_mutex_unlock(&s->lock);
|
ast_mutex_unlock(&s->lock);
|
||||||
ast_mutex_unlock(&q->lock);
|
ast_mutex_unlock(&q->lock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue