summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2007-09-13 16:27:42 +0000
committerMark Michelson <mmichelson@digium.com>2007-09-13 16:27:42 +0000
commit10d22b6e13d92b99110fcbaa9ae272622bae966e (patch)
tree773ff53d2568ae1d161751db0a1b68fc4c944f81 /apps/app_queue.c
parent1282de797de2190f282b60308b093223f93cf89a (diff)
Merged revisions 82326 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r82326 | mmichelson | 2007-09-13 11:25:59 -0500 (Thu, 13 Sep 2007) | 7 lines Added logic to handle the unlikely case that someone has two queues with the same name. Asterisk will log a warning message letting the user know that one was already defined with that name and is it skipping all further instances. This also will work for realtime queues but in order for that to happen, the user would have to trigger a perfectly timed reload as a realtime queue is being looked up, which is highly unlikely (but taken care of nonetheless). ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82327 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 0f3f82446..2b3ba9add 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -368,6 +368,7 @@ struct call_queue {
unsigned int strategy:3;
unsigned int maskmemberstatus:1;
unsigned int realtime:1;
+ unsigned int found:1;
int announcefrequency; /*!< How often to announce their position */
int minannouncefrequency; /*!< The minimum number of seconds between position announcements (def. 15) */
int periodicannouncefrequency; /*!< How often to play periodic announcement */
@@ -795,6 +796,7 @@ static void init_queue(struct call_queue *q)
q->sound_callerannounce[0] = '\0'; /* Default, don't announce the caller that he has been answered */
q->members = ao2_container_alloc(37, member_hash_fn, member_cmp_fn);
q->membercount = 0;
+ q->found = 1;
ast_copy_string(q->sound_next, "queue-youarenext", sizeof(q->sound_next));
ast_copy_string(q->sound_thereare, "queue-thereare", sizeof(q->sound_thereare));
ast_copy_string(q->sound_calls, "queue-callswaiting", sizeof(q->sound_calls));
@@ -1164,6 +1166,7 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
ast_mutex_unlock(&q->lock);
return NULL;
} else {
+ ast_log(LOG_WARNING, "Static queue '%s' already exists. Not loading from realtime\n", q->name);
ast_mutex_unlock(&q->lock);
return q;
}
@@ -4074,8 +4077,10 @@ static int reload_queues(int reload)
use_weight=0;
/* Mark all queues as dead for the moment */
AST_LIST_TRAVERSE(&queues, q, list) {
- if(!q->realtime)
+ if(!q->realtime) {
q->dead = 1;
+ q->found = 0;
+ }
}
/* Chug through config file */
@@ -4113,6 +4118,13 @@ static int reload_queues(int reload)
if (q) {
if (!new)
ast_mutex_lock(&q->lock);
+ /* Check if a queue with this name already exists */
+ if (q->found) {
+ ast_log(LOG_WARNING, "Queue '%s' already defined! Skipping!\n", cat);
+ if(!new)
+ ast_mutex_unlock(&q->lock);
+ continue;
+ }
/* Re-initialize the queue, and clear statistics */
init_queue(q);
if (!queue_keep_stats)