Fix the build of app_queue

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@80088 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2007-08-20 21:57:08 +00:00
parent 6268d2d7ec
commit 108326e3d1

View File

@@ -1120,55 +1120,6 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
return q; return q;
} }
static struct call_queue *load_realtime_queue(const char *queuename)
{
struct ast_variable *queue_vars;
struct ast_config *member_config = NULL;
struct call_queue *q;
/* Find the queue in the in-core list first. */
AST_LIST_LOCK(&queues);
AST_LIST_TRAVERSE(&queues, q, list) {
if (!strcasecmp(q->name, queuename)) {
break;
}
}
AST_LIST_UNLOCK(&queues);
if (!q || q->realtime) {
/*! \note Load from realtime before taking the global qlock, to avoid blocking all
queue operations while waiting for the DB.
This will be two separate database transactions, so we might
see queue parameters as they were before another process
changed the queue and member list as it was after the change.
Thus we might see an empty member list when a queue is
deleted. In practise, this is unlikely to cause a problem. */
queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
if (queue_vars) {
member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
if (!member_config) {
ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
return NULL;
}
}
AST_LIST_LOCK(&queues);
q = find_queue_by_name_rt(queuename, queue_vars, member_config);
if (member_config)
ast_config_destroy(member_config);
if (queue_vars)
ast_variables_destroy(queue_vars);
AST_LIST_UNLOCK(&queues);
} else {
update_realtime_member(q);
}
return q;
}
static void update_realtime_members(struct call_queue *q) static void update_realtime_members(struct call_queue *q)
{ {
struct ast_config *member_config = NULL; struct ast_config *member_config = NULL;
@@ -1220,6 +1171,55 @@ static void update_realtime_members(struct call_queue *q)
ast_mutex_unlock(&q->lock); ast_mutex_unlock(&q->lock);
} }
static struct call_queue *load_realtime_queue(const char *queuename)
{
struct ast_variable *queue_vars;
struct ast_config *member_config = NULL;
struct call_queue *q;
/* Find the queue in the in-core list first. */
AST_LIST_LOCK(&queues);
AST_LIST_TRAVERSE(&queues, q, list) {
if (!strcasecmp(q->name, queuename)) {
break;
}
}
AST_LIST_UNLOCK(&queues);
if (!q || q->realtime) {
/*! \note Load from realtime before taking the global qlock, to avoid blocking all
queue operations while waiting for the DB.
This will be two separate database transactions, so we might
see queue parameters as they were before another process
changed the queue and member list as it was after the change.
Thus we might see an empty member list when a queue is
deleted. In practise, this is unlikely to cause a problem. */
queue_vars = ast_load_realtime("queues", "name", queuename, NULL);
if (queue_vars) {
member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", queuename, NULL);
if (!member_config) {
ast_log(LOG_ERROR, "no queue_members defined in your config (extconfig.conf).\n");
return NULL;
}
}
AST_LIST_LOCK(&queues);
q = find_queue_by_name_rt(queuename, queue_vars, member_config);
if (member_config)
ast_config_destroy(member_config);
if (queue_vars)
ast_variables_destroy(queue_vars);
AST_LIST_UNLOCK(&queues);
} else {
update_realtime_members(q);
}
return q;
}
static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason) static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
{ {
struct call_queue *q; struct call_queue *q;