aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-03 14:34:25 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-03 14:34:25 +0000
commit422f48910d03d621ddbc4005969bd1859d5763bc (patch)
treeceb3e60be1ad85ccea5ae2bfc22e7f61708c12a8
parent4e4c786592175c1c75aa45f6de4428fd6e6d7f47 (diff)
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
-rw-r--r--CHANGES3
-rw-r--r--apps/app_queue.c17
-rw-r--r--configs/queues.conf.sample45
3 files changed, 59 insertions, 6 deletions
diff --git a/CHANGES b/CHANGES
index a67244155..e134208e1 100644
--- a/CHANGES
+++ b/CHANGES
@@ -163,6 +163,9 @@ Queue changes
-------------
* The TRANSFER queue log entry now includes the the caller's original
position in the transferred-from queue.
+ * A new configuration option, "timeoutpriority" has been added. Please see the section labeled
+ "QUEUE TIMING OPTIONS" in configs/queues.conf.sample for a detailed explanation of the option
+ as well as an explanation about timeout options in general
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0 -------------
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;
diff --git a/configs/queues.conf.sample b/configs/queues.conf.sample
index 643cbab8c..e4f6dd3bd 100644
--- a/configs/queues.conf.sample
+++ b/configs/queues.conf.sample
@@ -117,14 +117,51 @@ shared_lastcall=no
;
;context = qoutcon
;
-; How long do we let the phone ring before we consider this a timeout...
+;----------------------QUEUE TIMING OPTIONS------------------------------------
+; A Queue has two different "timeout" values associated with it. One is the
+; timeout parameter configured in queues.conf. This timeout specifies the
+; amount of time to try ringing a member's phone before considering the
+; member to be unavailable. The other timeout value is the second argument
+; to the Queue() application. This timeout represents the absolute amount
+; of time to allow a caller to stay in the queue before the caller is
+; removed from the queue. In certain situations, these two timeout values
+; may clash. For instance, if the timeout in queues.conf is set to 5 seconds,
+; the retry value in queues.conf is set to 4, and the second argument to Queue()
+; is 10, then the following may occur:
+;
+; A caller places a call to a queue.
+; The queue selects a member and attempts to ring that member.
+; The member's phone is rung for 5 seconds and he does not answer.
+; The retry time of 4 seconds occurs.
+; The queue selects a second member to call.
+;
+; How long does that second member's phone ring? Does it ring for 5 seconds
+; since the timeout set in app_queue is 5 seconds? Does it ring for 1 second since
+; the caller has been in the queue for 9 seconds and is supposed to be removed after
+; being in the queue for 10 seconds? This is configurable with the timeoutpriority
+; option. By setting the timeoutpriority to "conf" then you are saying that you would
+; rather use the time specified in the configuration file even if it means having the
+; caller stay in the queue longer than the time specified in the application argument.
+; For the scenario described above, timeoutpriority=conf would result in the second
+; member's phone ringing for 5 seconds. By specifying "app" as the value for
+; timeoutpriority, you are saying that the timeout specified as the argument to the
+; Queue application is more important. In the scenario above, timeoutpriority=app
+; would result in the second member's phone ringing for 1 second.
+;
+; There are a few exceptions to the priority rules. For instance, if the configuration
+; file timeout is set to 0, but the application argument timeout is non-zero, then the
+; timeoutpriority is ignored and the application argument is used as the timeout. Furthermore,
+; if no application argument timeout is specified, then the timeoutpriority option is
+; ignored and the configuration file timeout is always used when calling queue members.
+;
+; The default value for timeoutpriority is "app" since this was how previous versions of
+; Asterisk behaved.
;
;timeout = 15
-;
-; How long do we wait before trying all the members again?
-;
;retry = 5
+;timeoutpriority = app|conf
;
+;-----------------------END QUEUE TIMING OPTIONS---------------------------------
; Weight of queue - when compared to other queues, higher weights get
; first shot at available channels when the same channel is included in
; more than one queue.