[asterisk-commits] file: trunk r47567 - in /trunk: ./ apps/ configs/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Nov 13 11:23:56 MST 2006
Author: file
Date: Mon Nov 13 12:23:55 2006
New Revision: 47567
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47567
Log:
Add 'loose' option to joinempty and leavewhenempty which is almost exactly like 'strict' except it does not count paused queue members as unavailable. (issue #8263 reported by gnarf)
Modified:
trunk/CHANGES
trunk/apps/app_queue.c
trunk/configs/queues.conf.sample
Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=47567&r1=47566&r2=47567
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Nov 13 12:23:55 2006
@@ -59,3 +59,5 @@
setqueueentryvar options for each queue, see queues.conf.sample for details.
* Brazilian Portuguese (pt-BR) in VM, and say.c was added via patch from cfassoni.
* CID matching information is now shown when doing 'dialplan show'.
+ * app_queue now has a 'loose' option which is almost exactly like 'strict' except it
+ does not count paused queue members as unavailable.
Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=47567&r1=47566&r2=47567
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Mon Nov 13 12:23:55 2006
@@ -338,6 +338,7 @@
/* values used in multi-bit flags in call_queue */
#define QUEUE_EMPTY_NORMAL 1
#define QUEUE_EMPTY_STRICT 2
+#define QUEUE_EMPTY_LOOSE 3
#define ANNOUNCEHOLDTIME_ALWAYS 1
#define ANNOUNCEHOLDTIME_ONCE 2
#define QUEUE_EVENT_VARIABLES 3
@@ -488,6 +489,7 @@
enum queue_member_status {
QUEUE_NO_MEMBERS,
QUEUE_NO_REACHABLE_MEMBERS,
+ QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS,
QUEUE_NORMAL
};
@@ -500,19 +502,23 @@
for (member = q->members; member; member = member->next) {
if (max_penalty && (member->penalty > max_penalty))
continue;
-
- if (member->paused) continue;
switch (member->status) {
case AST_DEVICE_INVALID:
/* nothing to do */
break;
case AST_DEVICE_UNAVAILABLE:
- result = QUEUE_NO_REACHABLE_MEMBERS;
+ if (result != QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)
+ result = QUEUE_NO_REACHABLE_MEMBERS;
break;
default:
- ast_mutex_unlock(&q->lock);
- return QUEUE_NORMAL;
+ if (member->paused) {
+ result = QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS;
+ } else {
+ ast_mutex_unlock(&q->lock);
+ return QUEUE_NORMAL;
+ }
+ break;
}
}
@@ -903,14 +909,18 @@
q->strategy = QUEUE_STRATEGY_RINGALL;
}
} else if (!strcasecmp(param, "joinempty")) {
- if (!strcasecmp(val, "strict"))
+ if (!strcasecmp(val, "loose"))
+ q->joinempty = QUEUE_EMPTY_LOOSE;
+ else if (!strcasecmp(val, "strict"))
q->joinempty = QUEUE_EMPTY_STRICT;
else if (ast_true(val))
q->joinempty = QUEUE_EMPTY_NORMAL;
else
q->joinempty = 0;
} else if (!strcasecmp(param, "leavewhenempty")) {
- if (!strcasecmp(val, "strict"))
+ if (!strcasecmp(val, "loose"))
+ q->leavewhenempty = QUEUE_EMPTY_LOOSE;
+ else if (!strcasecmp(val, "strict"))
q->leavewhenempty = QUEUE_EMPTY_STRICT;
else if (ast_true(val))
q->leavewhenempty = QUEUE_EMPTY_NORMAL;
@@ -1189,7 +1199,9 @@
stat = get_member_status(q, qe->max_penalty);
if (!q->joinempty && (stat == QUEUE_NO_MEMBERS))
*reason = QUEUE_JOINEMPTY;
- else if ((q->joinempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS))
+ else if ((q->joinempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS))
+ *reason = QUEUE_JOINUNAVAIL;
+ else if ((q->joinempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS))
*reason = QUEUE_JOINUNAVAIL;
else if (q->maxlen && (q->count >= q->maxlen))
*reason = QUEUE_FULL;
@@ -2207,7 +2219,13 @@
}
/* leave the queue if no reachable agents, if enabled */
- if ((qe->parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS)) {
+ 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);
+ 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);
leave_queue(qe);
@@ -3532,7 +3550,13 @@
}
/* leave the queue if no reachable agents, if enabled */
- if ((qe.parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS)) {
+ if ((qe.parent->leavewhenempty == QUEUE_EMPTY_STRICT) && (stat == QUEUE_NO_REACHABLE_MEMBERS || stat == QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)) {
+ record_abandoned(&qe);
+ reason = QUEUE_LEAVEUNAVAIL;
+ res = 0;
+ break;
+ }
+ if ((qe.parent->leavewhenempty == QUEUE_EMPTY_LOOSE) && (stat == QUEUE_NO_REACHABLE_MEMBERS)) {
record_abandoned(&qe);
reason = QUEUE_LEAVEUNAVAIL;
res = 0;
Modified: trunk/configs/queues.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/queues.conf.sample?view=diff&rev=47567&r1=47566&r2=47567
==============================================================================
--- trunk/configs/queues.conf.sample (original)
+++ trunk/configs/queues.conf.sample Mon Nov 13 12:23:55 2006
@@ -254,6 +254,8 @@
; no - callers cannot join a queue with no members
; strict - callers cannot join a queue with no members or only unavailable
; members
+; loose - same as strict, but paused queue members do not count as unavailable
+;
;
; ----------------------- TYPE MIXMONITOR OPTIONS -----------------------------
;
More information about the asterisk-commits
mailing list