Commit a741676a9d for asterisk.org
commit a741676a9dbf1c8c83cfbf253ee9428406ff4deb
Author: serfreeman1337 <serfreeman1337@gmail.com>
Date: Mon Jan 5 20:47:22 2026 +0500
app_queue: Only compare calls at 1st position across queues when forcing longest waiting caller.
This prevents a situation where a call joining at 1st position to a queue with calls
leads to a state where no callers are considered the longest waiting,
causing queues to stop offering calls.
Resolves: #1691
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 959be3a6a5..7235de913e 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4758,10 +4758,12 @@ static int is_longest_waiting_caller(struct queue_ent *caller, struct member *me
* is already ringing at another agent. Ignore such callers; otherwise, all agents
* will be unused until the first caller is picked up.
*/
- if (ch->start < caller->start && !ch->pending) {
- ast_debug(1, "Queue %s has a call at position %i that's been waiting longer (%li vs %li)\n",
- q->name, ch->pos, ch->start, caller->start);
- is_longest_waiting = 0;
+ if (!ch->pending) {
+ if (ch->start < caller->start) {
+ ast_debug(1, "Queue %s has a call at position %i that's been waiting longer (%li vs %li)\n",
+ q->name, ch->pos, ch->start, caller->start);
+ is_longest_waiting = 0;
+ }
break;
}
ch = ch->next;