]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_queue: Fix rN raise_penalty ignoring min_penalty in calc_metric
authorphoneben <3232963@gmail.com>
Tue, 6 Jan 2026 19:53:45 +0000 (21:53 +0200)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Mon, 26 Jan 2026 20:31:05 +0000 (20:31 +0000)
QUEUE_RAISE_PENALTY=rN was not respected during member selection. calc_metric() raised penalties below QUEUE_MIN_PENALTY, allowing excluded members to be selected.

This change makes calc_metric() honor raise_respect_min, keeping behavior consistent with queue empty checks and expected rN semantics

UserNote: Fixes an issue where QUEUE_RAISE_PENALTY=rN could raise a member’s penalty below QUEUE_MIN_PENALTY during member selection. This could allow members intended to be excluded to be selected. The queue now consistently respects the minimum penalty when raising penalties, aligning member selection behavior with queue empty checks and documented rN semantics.

apps/app_queue.c

index 7235de913e2ab8c74968bd3e02bd23c1a839f33a..3233f384f1e04f231a8c9bc5cd3a8c83e89b6f82 100644 (file)
@@ -6206,7 +6206,7 @@ static int calc_metric(struct call_queue *q, struct member *mem, int pos, struct
        int penalty = mem->penalty;
 
        if (usepenalty) {
-               if (qe->raise_penalty != INT_MAX && penalty < qe->raise_penalty) {
+               if (qe->raise_penalty != INT_MAX && penalty < qe->raise_penalty && !(qe->raise_respect_min && qe->min_penalty != INT_MAX && penalty < qe->min_penalty)) {
                        /* Low penalty is raised up to the current minimum */
                        penalty = qe->raise_penalty;
                }