summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--apps/app_queue.c59
-rw-r--r--configs/queues.conf.sample4
3 files changed, 61 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index d1bc024c2..720d2c098 100644
--- a/CHANGES
+++ b/CHANGES
@@ -235,6 +235,10 @@ Queue changes
* A 'relative-peroidic-announce' option has been added to queues.conf. When
enabled, this option will cause periodic announce times to be calculated
from the end of announcements rather than from the beginning.
+ * The autopause option in queues.conf can be passed a new value, "all." The
+ result is that if a member becomes auto-paused, he will be paused in all
+ queues for which he is a member, not just the queue that failed to reach
+ the member.
mISDN channel driver (chan_misdn) changes
----------------------------------------
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 6e255aa61..5c6297872 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -671,6 +671,12 @@ enum {
QUEUE_STRATEGY_WRANDOM
};
+enum {
+ QUEUE_AUTOPAUSE_OFF = 0,
+ QUEUE_AUTOPAUSE_ON,
+ QUEUE_AUTOPAUSE_ALL
+};
+
enum queue_reload_mask {
QUEUE_RELOAD_PARAMETERS = (1 << 0),
QUEUE_RELOAD_MEMBER = (1 << 1),
@@ -692,6 +698,16 @@ static const struct strategy {
{ QUEUE_STRATEGY_WRANDOM, "wrandom"},
};
+static const struct autopause {
+ int autopause;
+ const char *name;
+} autopausesmodes [] = {
+ { QUEUE_AUTOPAUSE_OFF,"no" },
+ { QUEUE_AUTOPAUSE_ON, "yes" },
+ { QUEUE_AUTOPAUSE_ALL,"all" },
+};
+
+
static struct ast_taskprocessor *devicestate_tps;
#define DEFAULT_RETRY 5
@@ -1037,6 +1053,26 @@ static int strat2int(const char *strategy)
return -1;
}
+static int autopause2int(const char *autopause)
+{
+ int x;
+ /*This 'double check' that default value is OFF */
+ if (ast_strlen_zero(autopause))
+ return QUEUE_AUTOPAUSE_OFF;
+
+ /*This 'double check' is to ensure old values works */
+ if(ast_true(autopause))
+ return QUEUE_AUTOPAUSE_ON;
+
+ for (x = 0; x < ARRAY_LEN(autopausesmodes); x++) {
+ if (!strcasecmp(autopause, autopausesmodes[x].name))
+ return autopausesmodes[x].autopause;
+ }
+
+ /*This 'double check' that default value is OFF */
+ return QUEUE_AUTOPAUSE_OFF;
+}
+
static int queue_hash_cb(const void *obj, const int flags)
{
const struct call_queue *q = obj;
@@ -1466,6 +1502,7 @@ static void init_queue(struct call_queue *q)
q->periodicannouncefrequency = 0;
q->randomperiodicannounce = 0;
q->numperiodicannounce = 0;
+ q->autopause = QUEUE_AUTOPAUSE_OFF;
q->timeoutpriority = TIMEOUT_PRIORITY_APP;
if (!q->members) {
if (q->strategy == QUEUE_STRATEGY_LINEAR)
@@ -1771,7 +1808,7 @@ static void queue_set_param(struct call_queue *q, const char *param, const char
if (!strcasecmp(val, "mixmonitor"))
q->montype = 1;
} else if (!strcasecmp(param, "autopause")) {
- q->autopause = ast_true(val);
+ q->autopause = autopause2int(val);
} else if (!strcasecmp(param, "maxlen")) {
q->maxlen = atoi(val);
if (q->maxlen < 0)
@@ -3128,11 +3165,23 @@ static void rna(int rnatime, struct queue_ent *qe, char *interface, char *member
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
}
ast_queue_log(qe->parent->name, qe->chan->uniqueid, membername, "RINGNOANSWER", "%d", rnatime);
- if (qe->parent->autopause && pause) {
- if (!set_member_paused(qe->parent->name, interface, "Auto-Pause", 1)) {
- ast_verb(3, "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n", interface, qe->parent->name);
+ if (qe->parent->autopause != QUEUE_AUTOPAUSE_OFF && pause) {
+ if (qe->parent->autopause == QUEUE_AUTOPAUSE_ON) {
+ if (!set_member_paused(qe->parent->name, interface, "Auto-Pause", 1)) {
+ ast_verb(3, "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n",
+ interface, qe->parent->name);
+ } else {
+ ast_verb(3, "Failed to pause Queue Member %s in queue %s!\n", interface, qe->parent->name);
+ }
} else {
- ast_verb(3, "Failed to pause Queue Member %s in queue %s!\n", interface, qe->parent->name);
+ /* If queue autopause is mode all, just don't send any queue to stop.
+ * the function will stop in all queues */
+ if (!set_member_paused("", interface, "Auto-Pause", 1)) {
+ ast_verb(3, "Auto-Pausing Queue Member %s in all queues since they failed to answer on queue %s.\n",
+ interface, qe->parent->name);
+ } else {
+ ast_verb(3, "Failed to pause Queue Member %s in all queues!\n", interface);
+ }
}
}
return;
diff --git a/configs/queues.conf.sample b/configs/queues.conf.sample
index b80461538..f6c3a7676 100644
--- a/configs/queues.conf.sample
+++ b/configs/queues.conf.sample
@@ -190,7 +190,9 @@ shared_lastcall=no
;autofill=yes
;
; Autopause will pause a queue member if they fail to answer a call
-;
+; no: Member will not be paused
+; yes: Member will be paused only in the queue where the timeout took place
+; all: Memeber will be paused in all queues he/she is a member
;autopause=yes
;
; Maximum number of people waiting in the queue (0 for unlimited)