]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_queue: Only compare calls at 1st position across queues when forcing longest...
authorserfreeman1337 <serfreeman1337@gmail.com>
Mon, 5 Jan 2026 15:47:22 +0000 (20:47 +0500)
committerserfreeman1337 <serfreeman1337@gmail.com>
Mon, 26 Jan 2026 19:43:29 +0000 (19:43 +0000)
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

apps/app_queue.c

index ced61f8c0b82da77fe30b068dbc2778802b2e529..93f46c6c52239e3261675b432058a58f5cf51ffa 100644 (file)
@@ -4802,10 +4802,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;