aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-18 20:23:11 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-08-18 20:23:11 +0000
commitd4a3345cb16062ba44a7c15ccfc02e273e58e750 (patch)
treedb70fdac46017e5a1445ad8e312799b0b9f79c6b /apps
parentcc38d4ed0093a8aebbf61a520e9e9ada7fde22ed (diff)
Change the queue timeout priority logic into less ugly
and confusing code pieces. Clarify the logic within queues.conf.sample. (closes issue #12690) Reported by: atis Patches: queue_timeoutpriority.patch uploaded by atis (license 242) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@138694 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 405443737..8f94ef11b 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2314,6 +2314,14 @@ static int ring_one(struct queue_ent *qe, struct callattempt *outgoing, int *bus
ast_debug(1, "Trying '%s' with metric %d\n", best->interface, best->metric);
ret = ring_entry(qe, best, busies);
}
+
+ /* If we have timed out, break out */
+ if (qe->expire && (time(NULL) >= qe->expire)) {
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Queue timed out while ringing members.\n");
+ ret = 0;
+ break;
+ }
}
return ret;
@@ -3407,10 +3415,22 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
}
}
- if (qe->expire && (!qe->parent->timeout || (qe->parent->timeoutpriority == TIMEOUT_PRIORITY_APP && (qe->expire - now) <= qe->parent->timeout)))
- to = (qe->expire - now) * 1000;
- else
- to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
+ if (qe->parent->timeoutpriority == TIMEOUT_PRIORITY_APP) {
+ /* Application arguments have higher timeout priority (behaviour for <=1.6) */
+ if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout))
+ to = (qe->expire - now) * 1000;
+ else
+ to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
+ } else {
+ /* Config timeout is higher priority thatn application timeout */
+ if (qe->expire && qe->expire<=now) {
+ to = 0;
+ } else if (qe->parent->timeout) {
+ to = qe->parent->timeout * 1000;
+ } else {
+ to = -1;
+ }
+ }
orig = to;
++qe->pending;
ao2_unlock(qe->parent);