app_queue: Evaluate realtime queues when running dialplan functions

ASTERISK-19103 #close
Reported by: Jim Van Meggelen

Change-Id: I4bd32a9d1fcebb8ac56bff0e084d4f53e31b692b
14
Sean Bright 8 years ago
parent 0f4d9dc1f3
commit d953c9287a

@ -7496,12 +7496,10 @@ static int set_member_value(const char *queuename, const char *interface, int pr
static int get_member_penalty(char *queuename, char *interface) static int get_member_penalty(char *queuename, char *interface)
{ {
int foundqueue = 0, penalty; int foundqueue = 0, penalty;
struct call_queue *q, tmpq = { struct call_queue *q;
.name = queuename,
};
struct member *mem; struct member *mem;
if ((q = ao2_t_find(queues, &tmpq, OBJ_POINTER, "Search for queue"))) { if ((q = find_load_queue_rt_friendly(queuename))) {
foundqueue = 1; foundqueue = 1;
ao2_lock(q); ao2_lock(q);
if ((mem = interface_exists(q, interface))) { if ((mem = interface_exists(q, interface))) {
@ -8255,10 +8253,7 @@ stop:
static int queue_function_var(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) static int queue_function_var(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{ {
int res = -1; int res = -1;
struct call_queue *q, tmpq = { struct call_queue *q;
.name = data,
};
char interfacevar[256] = ""; char interfacevar[256] = "";
float sl = 0; float sl = 0;
@ -8267,7 +8262,7 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d
return -1; return -1;
} }
if ((q = ao2_t_find(queues, &tmpq, OBJ_POINTER, "Find for QUEUE() function"))) { if ((q = find_load_queue_rt_friendly(data))) {
ao2_lock(q); ao2_lock(q);
if (q->setqueuevar) { if (q->setqueuevar) {
sl = 0; sl = 0;
@ -8665,9 +8660,7 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, const char
/*! \brief Dialplan function QUEUE_MEMBER_LIST() Get list of members in a specific queue */ /*! \brief Dialplan function QUEUE_MEMBER_LIST() Get list of members in a specific queue */
static int queue_function_queuememberlist(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) static int queue_function_queuememberlist(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{ {
struct call_queue *q, tmpq = { struct call_queue *q;
.name = data,
};
struct member *m; struct member *m;
/* Ensure an otherwise empty list doesn't return garbage */ /* Ensure an otherwise empty list doesn't return garbage */
@ -8678,7 +8671,7 @@ static int queue_function_queuememberlist(struct ast_channel *chan, const char *
return -1; return -1;
} }
if ((q = ao2_t_find(queues, &tmpq, OBJ_POINTER, "Find for QUEUE_MEMBER_LIST()"))) { if ((q = find_load_queue_rt_friendly(data))) {
int buflen = 0, count = 0; int buflen = 0, count = 0;
struct ao2_iterator mem_iter; struct ao2_iterator mem_iter;

Loading…
Cancel
Save