Index: apps/app_queue.c =================================================================== RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v retrieving revision 1.128 diff -u -r1.128 app_queue.c --- apps/app_queue.c 21 Mar 2005 22:08:36 -0000 1.128 +++ apps/app_queue.c 28 Mar 2005 19:18:50 -0000 @@ -197,6 +197,7 @@ #define QUEUE_FLAG_REPORTHOLDTIME (1 << 12) /* Should we report caller hold time to answering member? */ #define QUEUE_FLAG_WRAPPED (1 << 13) /* Round Robin - wrapped around? */ #define QUEUE_FLAG_TIMEOUTRESTART (1 << 14) /* Restart timer when member call */ +#define QUEUE_FLAG_EVENTMEMBERSTATUS (1 << 15) /* Generate somewhat spurious queue member status events */ /* We define a custom "local user" structure because we use it not only for keeping track of what is in use but @@ -386,17 +387,19 @@ if (!strcasecmp(sc->dev, cur->interface)) { if (cur->status != sc->state) { cur->status = sc->state; - manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus", - "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", - q->name, cur->interface, cur->dynamic ? "dynamic" : "static", - cur->penalty, cur->calls, cur->lastcall, cur->status, cur->paused); + if (ast_test_flag(q, QUEUE_FLAG_EVENTMEMBERSTATUS)) { + manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus", + "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", + q->name, cur->interface, cur->dynamic ? "dynamic" : "static", + cur->penalty, cur->calls, cur->lastcall, cur->status, cur->paused); + } } } cur = cur->next; @@ -713,17 +716,19 @@ while(cur) { if (member == cur) { cur->status = status; - manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus", - "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", - q->name, cur->interface, cur->dynamic ? "dynamic" : "static", - cur->penalty, cur->calls, cur->lastcall, cur->status, cur->paused); + if (ast_test_flag(q, QUEUE_FLAG_EVENTMEMBERSTATUS)) { + manager_event(EVENT_FLAG_AGENT, "QueueMemberStatus", + "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", + q->name, cur->interface, cur->dynamic ? "dynamic" : "static", + cur->penalty, cur->calls, cur->lastcall, cur->status, cur->paused); + } break; } cur = cur->next; @@ -1625,12 +1630,13 @@ ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "CONNECT", "%ld", (long)time(NULL) - qe->start); if (ast_test_flag(qe->parent, QUEUE_FLAG_EVENTWHENCALLED)) { manager_event(EVENT_FLAG_AGENT, "AgentConnect", - "Queue: %s\r\n" - "Uniqueid: %s\r\n" - "Channel: %s\r\n" - "Member: %s\r\n" - "Holdtime: %ld\r\n", - queuename, qe->chan->uniqueid, peer->name, member->interface, (long)time(NULL) - qe->start); + "Queue: %s\r\n" + "Uniqueid: %s\r\n" + "Channel: %s\r\n" + "Member: %s\r\n" + "Holdtime: %ld\r\n" + "Url: %s\r\n", + queuename, qe->chan->uniqueid, peer->name, member->interface, (long)time(NULL) - qe->start, url); } strncpy(oldcontext, qe->chan->context, sizeof(oldcontext) - 1); strncpy(oldexten, qe->chan->exten, sizeof(oldexten) - 1); @@ -2606,10 +2612,15 @@ use_weight++; } else if (!strcasecmp(var->name, "timeoutrestart")) { ast_set2_flag(q, ast_true(var->value), QUEUE_FLAG_TIMEOUTRESTART); + } else if (!strcasecmp(var->name, "eventmemberstatus")) { + ast_set2_flag(q, ast_true(var->value), QUEUE_FLAG_EVENTMEMBERSTATUS); } else { ast_log(LOG_WARNING, "Unknown keyword in queue '%s': %s at line %d of queue.conf\n", cat, var->name, var->lineno); } var = var->next; + } + if (!ast_test_flag(q, QUEUE_FLAG_EVENTMEMBERSTATUS)) { + ast_set2_flag(q, -1, QUEUE_FLAG_EVENTMEMBERSTATUS); } if (q->retry < 0) q->retry = DEFAULT_RETRY; Index: configs/queues.conf.sample =================================================================== RCS file: /usr/cvsroot/asterisk/configs/queues.conf.sample,v retrieving revision 1.24 diff -u -r1.24 queues.conf.sample --- configs/queues.conf.sample 4 Mar 2005 00:59:58 -0000 1.24 +++ configs/queues.conf.sample 28 Mar 2005 19:18:51 -0000 @@ -130,10 +130,17 @@ ; ; leavewhenempty = yes ; -; Asterisk can generate AgentCalled events when an agent is rung, if this is turned on -; (may generate a LOT of extra manager events) +; If this is set to yes, the following manager events will be generated: +; AgentCalled, AgentDump, AgentConnect, AgentComplete +; (may generate some extra manager events, but probably ones you want) ; ; eventwhencalled = yes +; +; If this is set to no, the following manager events will be generated: +; QueueMemberStatus +; (may generate a WHOLE LOT of extra manager events) +; +; eventmemberstatusoff = no ; ; If you wish to report the caller's hold time to the member before they are connected ; to the caller, set this to yes.