diff options
author | Mark Spencer <markster@digium.com> | 2003-08-13 18:58:01 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2003-08-13 18:58:01 +0000 |
commit | 465a7518ccf06550b131e6dae8e41eaa4243c1ba (patch) | |
tree | 3f8580f7a6b870021379b92452d81c68f920bc42 /apps/app_queue.c | |
parent | 66252c0f4b2afa5fbd4d680c5cd389c2de61307b (diff) |
Do the right thing with ringall queues with entries that have penalties
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1314 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_queue.c')
-rwxr-xr-x | apps/app_queue.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index 43440e435..e4dc2a4ff 100755 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -398,13 +398,23 @@ static int ring_one(struct queue_ent *qe, struct localuser *outgoing) cur = cur->next; } if (best) { - /* Ring the best channel, and remember the best - metric for the next pass */ - ast_log(LOG_DEBUG, "Trying '%s/%s' with metric %d\n", best->tech, best->numsubst, best->metric); - ring_entry(qe, best); + if (!qe->parent->strategy) { + /* Ring everyone who shares this best metric (for ringall) */ + cur = outgoing; + while(cur) { + if (cur->stillgoing && !cur->chan && (cur->metric == bestmetric)) { + ast_log(LOG_DEBUG, "(Parallel) Trying '%s/%s' with metric %d\n", cur->tech, cur->numsubst, cur->metric); + ring_entry(qe, cur); + } + cur = cur->next; + } + } else { + /* Ring just the best channel */ + ast_log(LOG_DEBUG, "Trying '%s/%s' with metric %d\n", best->tech, best->numsubst, best->metric); + ring_entry(qe, best); + } } } while (best && !best->chan); - if (!best) { ast_log(LOG_DEBUG, "Nobody left to try ringing in queue\n"); return 0; @@ -628,7 +638,8 @@ static int calc_metric(struct ast_call_queue *q, struct member *mem, int pos, st { switch (q->strategy) { case QUEUE_STRATEGY_RINGALL: - ast_log(LOG_WARNING, "Can't calculate metric for ringall strategy\n"); + /* Everyone equal, except for penalty */ + tmp->metric = mem->penalty * 1000000; break; case QUEUE_STRATEGY_ROUNDROBIN: if (!pos) { @@ -738,10 +749,7 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri } /* Special case: If we ring everyone, go ahead and ring them, otherwise just calculate their metric for the appropriate strategy */ - if (!qe->parent->strategy) - ring_entry(qe, tmp); - else - calc_metric(qe->parent, cur, x++, qe, tmp); + calc_metric(qe->parent, cur, x++, qe, tmp); /* Put them in the list of outgoing thingies... We're ready now. XXX If we're forcibly removed, these outgoing calls won't get hung up XXX */ @@ -757,8 +765,7 @@ static int try_calling(struct queue_ent *qe, char *options, char *announceoverri to = qe->parent->timeout * 1000; else to = -1; - if (qe->parent->strategy) - ring_one(qe, outgoing); + ring_one(qe, outgoing); ast_mutex_unlock(&qe->parent->lock); lpeer = wait_for_answer(qe, outgoing, &to, &allowredir_in, &allowredir_out, &allowdisconnect, &digit); if (lpeer) |