summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2009-09-10 23:54:51 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2009-09-10 23:54:51 +0000
commit85f18fcb8fbe691c611135e2fb99be1395dba557 (patch)
tree1144154c4a65d373b915e8eea528f1a81f73ee54 /apps
parentedb5e6efd9e4b7b7fce3f74a5e3726bb75c7c288 (diff)
Merged revisions 217989 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r217989 | tilghman | 2009-09-10 18:52:22 -0500 (Thu, 10 Sep 2009) | 3 lines Don't ring another channel, if there's not enough time for a queue member to answer. (Fixes AST-228) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@217990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index beece4dff..a8d9832b9 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2710,6 +2710,7 @@ static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies
/* Inherit specially named variables from parent channel */
ast_channel_inherit_variables(qe->chan, tmp->chan);
+ ast_channel_datastore_inherit(qe->chan, tmp->chan);
/* Presense of ADSI CPE on outgoing channel follows ours */
tmp->chan->adsicpe = qe->chan->adsicpe;
@@ -3082,7 +3083,11 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
*to = 0;
return NULL;
}
+
+ /* Poll for events from both the incoming channel as well as any outgoing channels */
winner = ast_waitfor_n(watchers, pos, to);
+
+ /* Service all of the outgoing channels */
for (o = start; o; o = o->call_next) {
/* We go with a static buffer here instead of using ast_strdupa. Using
* ast_strdupa in a loop like this one can cause a stack overflow
@@ -3231,7 +3236,11 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart)
*to = orig;
- ring_one(qe, outgoing, &numbusies);
+ /* Have enough time for a queue member to answer? */
+ if (*to > 500) {
+ ring_one(qe, outgoing, &numbusies);
+ starttime = (long) time(NULL);
+ }
}
numbusies++;
break;
@@ -3246,7 +3255,10 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart)
*to = orig;
- ring_one(qe, outgoing, &numbusies);
+ if (*to > 500) {
+ ring_one(qe, outgoing, &numbusies);
+ starttime = (long) time(NULL);
+ }
}
numbusies++;
break;
@@ -3286,18 +3298,23 @@ static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callatte
}
}
ast_frfree(f);
- } else {
+ } else { /* ast_read() returned NULL */
endtime = (long) time(NULL) - starttime;
rna(endtime * 1000, qe, on, membername, 1);
do_hang(o);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart)
*to = orig;
- ring_one(qe, outgoing, &numbusies);
+ if (*to > 500) {
+ ring_one(qe, outgoing, &numbusies);
+ starttime = (long) time(NULL);
+ }
}
}
}
}
+
+ /* If we received an event from the caller, deal with it. */
if (winner == in) {
f = ast_read(in);
if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {