diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-13 18:58:01 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-08-13 18:58:01 +0000 |
commit | 1a1944e264b0b8dc94adfb132b2e97a4f497fdfc (patch) | |
tree | 3f8580f7a6b870021379b92452d81c68f920bc42 | |
parent | 2d8b03612b8b39f9f4f11639205c2070a34f47e1 (diff) |
Do the right thing with ringall queues with entries that have penalties
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1314 f38db490-d61c-443f-a65b-d21fe96a405b
-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) |