From e9fc5b041fcc236f1d6b24394a2d514b50705e7d Mon Sep 17 00:00:00 2001 From: phoneben <3232963@gmail.com> Date: Tue, 6 Jan 2026 21:53:45 +0200 Subject: [PATCH] app_queue: Fix rN raise_penalty ignoring min_penalty in calc_metric MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/app_queue.c b/apps/app_queue.c index a96cb653c8..eb4eeba40d 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -6290,7 +6290,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; }