From 422f48910d03d621ddbc4005969bd1859d5763bc Mon Sep 17 00:00:00 2001 From: mmichelson Date: Thu, 3 Jul 2008 14:34:25 +0000 Subject: Added a new option, "timeoutpriority" to queues.conf. A detailed explanation of the change may be found in configs/queues.conf.sample (closes issue #12690) Reported by: atis git-svn-id: http://svn.digium.com/svn/asterisk/trunk@127720 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_queue.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/app_queue.c b/apps/app_queue.c index 872dc4955..1331703b0 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -108,7 +108,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * to this order! */ - enum { QUEUE_STRATEGY_RINGALL = 0, QUEUE_STRATEGY_LEASTRECENT, @@ -316,6 +315,11 @@ const struct { { QUEUE_CONTINUE, "CONTINUE" }, }; +enum queue_timeout_priority { + TIMEOUT_PRIORITY_APP, + TIMEOUT_PRIORITY_CONF, +}; + /*! \brief We define a custom "local user" structure because we * use it not only for keeping track of what is in use but * also for keeping track of who we're dialing. @@ -498,6 +502,7 @@ struct call_queue { int timeout; /*!< How long to wait for an answer */ int weight; /*!< Respective weight */ int autopause; /*!< Auto pause queue members if they fail to answer */ + int timeoutpriority; /*!< Do we allow a fraction of the timeout to occur for a ring? */ /* Queue strategy things */ int rrpos; /*!< Round Robin - position */ @@ -907,6 +912,7 @@ static void init_queue(struct call_queue *q) q->periodicannouncefrequency = 0; q->randomperiodicannounce = 0; q->numperiodicannounce = 0; + q->timeoutpriority = TIMEOUT_PRIORITY_APP; if (!q->members) { if (q->strategy == QUEUE_STRATEGY_LINEAR) /* linear strategy depends on order, so we have to place all members in a single bucket */ @@ -1295,6 +1301,12 @@ static void queue_set_param(struct call_queue *q, const char *param, const char q->timeoutrestart = ast_true(val); } else if (!strcasecmp(param, "defaultrule")) { ast_string_field_set(q, defaultrule, val); + } else if (!strcasecmp(param, "timeoutpriority")) { + if (!strcasecmp(val, "conf")) { + q->timeoutpriority = TIMEOUT_PRIORITY_CONF; + } else { + q->timeoutpriority = TIMEOUT_PRIORITY_APP; + } } else if (failunknown) { if (linenum >= 0) { ast_log(LOG_WARNING, "Unknown keyword in queue '%s': %s at line %d of queues.conf\n", @@ -3362,7 +3374,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ast_free(tmp); } } - if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout)) + + 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; -- cgit v1.2.3