--- ../tmp/asterisk-1.8.30.0/apps/app_queue.c 2014-07-28 21:27:56.000000000 +0300 +++ apps/app_queue.c 2014-10-27 12:17:25.000000000 +0200 @@ -3448,14 +3448,21 @@ while (ret == 0) { struct callattempt *best = find_best(outgoing); if (!best) { - ast_debug(1, "Nobody left to try ringing in queue\n"); - break; + /* If ringall strategy then increase penalty when no member in range available */ + if (qe->parent->strategy == QUEUE_STRATEGY_RINGALL) { + /* Set time to 0, causes waiting loop to skip to next queuerule */ + qe->pr->time = 0; + break; + } else { + ast_debug(1, "Nobody left to try ringing in queue\n"); + break; + } } if (qe->parent->strategy == QUEUE_STRATEGY_RINGALL) { struct callattempt *cur; - /* Ring everyone who shares this best metric (for ringall) */ + /* Ring everyone who shares this best metric (for ringall) or fits between QUEUE_MIN_PENALTY and QUEUE_MAX_PENALTY */ for (cur = outgoing; cur; cur = cur->q_next) { - if (cur->stillgoing && !cur->chan && cur->metric <= best->metric) { + if (cur->stillgoing && !cur->chan && ( ( cur->metric >= qe->min_penalty * 1000000 && cur->metric <= qe->max_penalty * 1000000 ) || cur->metric < best->metric ) ) { ast_debug(1, "(Parallel) Trying '%s' with metric %d\n", cur->interface, cur->metric); ret |= ring_entry(qe, cur, busies); } @@ -4246,8 +4253,13 @@ snprintf(max_penalty_str, sizeof(max_penalty_str), "%d", max_penalty); pbx_builtin_setvar_helper(qe->chan, "QUEUE_MAX_PENALTY", max_penalty_str); qe->max_penalty = max_penalty; - ast_debug(3, "Setting max penalty to %d for caller %s since %d seconds have elapsed\n", - qe->max_penalty, qe->chan->name, qe->pr->time); + if ( qe->pr->time != 0 ) { + ast_debug(3, "Setting max penalty to %d for caller %s since %d seconds have elapsed\n", + qe->max_penalty, qe->chan->name, qe->pr->time); + } else { + ast_debug(3, "Setting max penalty to %d for caller %s cause no members were available with previous penalty range\n", + qe->max_penalty, qe->chan->name); + } } if (qe->min_penalty != INT_MAX) { @@ -4271,8 +4283,13 @@ snprintf(min_penalty_str, sizeof(min_penalty_str), "%d", min_penalty); pbx_builtin_setvar_helper(qe->chan, "QUEUE_MIN_PENALTY", min_penalty_str); qe->min_penalty = min_penalty; - ast_debug(3, "Setting min penalty to %d for caller %s since %d seconds have elapsed\n", - qe->min_penalty, qe->chan->name, qe->pr->time); + if ( qe->pr->time != 0) { + ast_debug(3, "Setting min penalty to %d for caller %s since %d seconds have elapsed\n", + qe->min_penalty, qe->chan->name, qe->pr->time); + } else { + ast_debug(3, "Setting min penalty to %d for caller %s cause no members were available with previous penalty range\n", + qe->min_penalty, qe->chan->name); + } } qe->pr = AST_LIST_NEXT(qe->pr, list);