summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/app_queue.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index fbdff1553..e42ba3685 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2201,7 +2201,10 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
free(tmp);
}
}
- to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
+ if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout))
+ to = (qe->expire - now) * 1000;
+ else
+ to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
ring_one(qe, outgoing, &numbusies);
ast_mutex_unlock(&qe->parent->lock);
if (use_weight)