Index: app_queue.c =================================================================== RCS file: /var/lib/cvs/asterisk/apps/app_queue.c,v retrieving revision 1.3 diff -u -r1.3 app_queue.c --- app_queue.c 30 May 2005 11:27:50 -0000 1.3 +++ app_queue.c 9 Jun 2005 14:36:03 -0000 @@ -635,7 +635,7 @@ cur = cur->next; } if (best) { - if (!qe->parent->strategy) { + if (qe->parent->strategy == QUEUE_STRATEGY_RINGALL) { /* Ring everyone who shares this best metric (for ringall) */ cur = outgoing; while(cur) { @@ -753,7 +753,7 @@ while(*to && !peer) { BUILD_STATS; - if ((found < 0) && stillgoing && !qe->parent->strategy) { + if ((found < 0) && stillgoing && qe->parent->strategy == QUEUE_STRATEGY_RINGALL) { /* On "ringall" strategy we only move to the next penalty level when *all* ringing phones are done in the current penalty level */ ring_one(qe, outgoing, &numbusies); @@ -977,52 +971,52 @@ static int calc_metric(struct ast_call_queue *q, struct member *mem, int pos, struct queue_ent *qe, struct localuser *tmp) { switch (q->strategy) { - case QUEUE_STRATEGY_RINGALL: - /* Everyone equal, except for penalty */ - tmp->metric = mem->penalty * 1000000; - break; - case QUEUE_STRATEGY_ROUNDROBIN: - if (!pos) { - if (!q->wrapped) { - /* No more channels, start over */ - q->rrpos = 0; - } else { - /* Prioritize next entry */ - q->rrpos++; + case QUEUE_STRATEGY_RINGALL: + /* Everyone equal, except for penalty */ + tmp->metric = mem->penalty * 1000000; + break; + case QUEUE_STRATEGY_ROUNDROBIN: + if (!pos) { + if (!q->wrapped) { + /* No more channels, start over */ + q->rrpos = 0; + } else { + /* Prioritize next entry */ + q->rrpos++; + } + q->wrapped = 0; } - q->wrapped = 0; - } - /* Fall through */ - case QUEUE_STRATEGY_RRMEMORY: - if (pos < q->rrpos) { - tmp->metric = 1000 + pos; - } else { - if (pos > q->rrpos) { - /* Indicate there is another priority */ - q->wrapped = 1; + /* Fall through */ + case QUEUE_STRATEGY_RRMEMORY: + if (pos < q->rrpos) { + tmp->metric = 1000 + pos; + } else { + if (pos > q->rrpos) { + /* Indicate there is another priority */ + q->wrapped = 1; + } + tmp->metric = pos; } - tmp->metric = pos; - } - tmp->metric += mem->penalty * 1000000; - break; - case QUEUE_STRATEGY_RANDOM: - tmp->metric = rand() % 1000; - tmp->metric += mem->penalty * 1000000; - break; - case QUEUE_STRATEGY_FEWESTCALLS: - tmp->metric = mem->calls; - tmp->metric += mem->penalty * 1000000; - break; - case QUEUE_STRATEGY_LEASTRECENT: - if (!mem->lastcall) - tmp->metric = 0; - else - tmp->metric = 1000000 - (time(NULL) - mem->lastcall); - tmp->metric += mem->penalty * 1000000; - break; - default: - ast_log(LOG_WARNING, "Can't calculate metric for unknown strategy %d\n", q->strategy); - break; + tmp->metric += mem->penalty * 1000000; + break; + case QUEUE_STRATEGY_RANDOM: + tmp->metric = rand() % 1000; + tmp->metric += mem->penalty * 1000000; + break; + case QUEUE_STRATEGY_FEWESTCALLS: + tmp->metric = mem->calls; + tmp->metric += mem->penalty * 1000000; + break; + case QUEUE_STRATEGY_LEASTRECENT: + if (!mem->lastcall) + tmp->metric = 0; + else + tmp->metric = 1000000 - (time(NULL) - mem->lastcall); + tmp->metric += mem->penalty * 1000000; + break; + default: + ast_log(LOG_WARNING, "Can't calculate metric for unknown strategy %d\n", q->strategy); + break; } return 0; } @@ -1905,7 +1899,7 @@ q->strategy = strat2int(var->value); if (q->strategy < 0) { ast_log(LOG_WARNING, "'%s' isn't a valid strategy, using ringall instead\n", var->value); - q->strategy = 0; + q->strategy = QUEUE_STRATEGY_RINGALL; } } else if (!strcasecmp(var->name, "joinempty")) { q->joinempty = ast_true(var->value);