From: Mark Michelson Date: Wed, 20 Feb 2008 22:32:22 +0000 (+0000) Subject: Clear up confusion when viewing the QUEUE_WAITING_COUNT of a X-Git-Tag: 1.4.19~155 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=70b222e46f07f4643990ccd42bdc74f84ae9e5ea;p=thirdparty%2Fasterisk.git Clear up confusion when viewing the QUEUE_WAITING_COUNT of a "dead" realtime queue. Since from the user's perspective, the queue does exist, we shouldn't tell them we couldn't find the queue. Instead since it is a dead queue, report a 0 waiting count This issue was brought up on IRC by jmls git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@103956 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index 0374575eca..f8ef4cb2d2 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -4002,6 +4002,7 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, char *cmd, int count = 0; struct call_queue *q; struct ast_module_user *lu; + struct ast_variable *var = NULL; buf[0] = '\0'; @@ -4024,6 +4025,13 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, char *cmd, if (q) { count = q->count; ast_mutex_unlock(&q->lock); + } else if ((var = ast_load_realtime("queues", "name", data, NULL))) { + /* if the queue is realtime but was not found in memory, this + * means that the queue had been deleted from memory since it was + * "dead." This means it has a 0 waiting count + */ + count = 0; + ast_variables_destroy(var); } else ast_log(LOG_WARNING, "queue %s was not found\n", data);