mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 11:28:25 +00:00
Revert Janitor patch 341906 For now
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@341921 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1606,19 +1606,16 @@ static struct member *create_queue_member(const char *interface, const char *mem
|
||||
cur->penalty = penalty;
|
||||
cur->paused = paused;
|
||||
ast_copy_string(cur->interface, interface, sizeof(cur->interface));
|
||||
if (!ast_strlen_zero(state_interface)) {
|
||||
if (!ast_strlen_zero(state_interface))
|
||||
ast_copy_string(cur->state_interface, state_interface, sizeof(cur->state_interface));
|
||||
} else {
|
||||
else
|
||||
ast_copy_string(cur->state_interface, interface, sizeof(cur->state_interface));
|
||||
}
|
||||
if (!ast_strlen_zero(membername)) {
|
||||
if (!ast_strlen_zero(membername))
|
||||
ast_copy_string(cur->membername, membername, sizeof(cur->membername));
|
||||
} else {
|
||||
else
|
||||
ast_copy_string(cur->membername, interface, sizeof(cur->membername));
|
||||
}
|
||||
if (!strchr(cur->interface, '/')) {
|
||||
if (!strchr(cur->interface, '/'))
|
||||
ast_log(LOG_WARNING, "No location at interface '%s'\n", interface);
|
||||
}
|
||||
if (!strncmp(cur->state_interface, "hint:", 5)) {
|
||||
char *tmp = ast_strdupa(cur->state_interface), *context = tmp;
|
||||
char *exten = strsep(&context, "@") + 5;
|
||||
@@ -2105,10 +2102,9 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const
|
||||
|
||||
if (paused_str) {
|
||||
paused = atoi(paused_str);
|
||||
if (paused < 0) {
|
||||
if (paused < 0)
|
||||
paused = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find member by realtime uniqueid and update */
|
||||
mem_iter = ao2_iterator_init(q->members, 0);
|
||||
@@ -2116,9 +2112,8 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const
|
||||
if (!strcasecmp(m->rt_uniqueid, rt_uniqueid)) {
|
||||
m->dead = 0; /* Do not delete this one. */
|
||||
ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
|
||||
if (paused_str) {
|
||||
if (paused_str)
|
||||
m->paused = paused;
|
||||
}
|
||||
if (strcasecmp(state_interface, m->state_interface)) {
|
||||
ast_copy_string(m->state_interface, state_interface, sizeof(m->state_interface));
|
||||
}
|
||||
@@ -2229,10 +2224,10 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
|
||||
return q;
|
||||
}
|
||||
}
|
||||
} else if (!member_config) {
|
||||
} else if (!member_config)
|
||||
/* Not found in the list, and it's not realtime ... */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Check if queue is defined in realtime. */
|
||||
if (!queue_vars) {
|
||||
/* Delete queue from in-core list if it has been deleted in realtime. */
|
||||
@@ -2254,9 +2249,8 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
|
||||
/* Create a new queue if an in-core entry does not exist yet. */
|
||||
if (!q) {
|
||||
struct ast_variable *tmpvar = NULL;
|
||||
if (!(q = alloc_queue(queuename))) {
|
||||
if (!(q = alloc_queue(queuename)))
|
||||
return NULL;
|
||||
}
|
||||
ao2_lock(q);
|
||||
clear_queue(q);
|
||||
q->realtime = 1;
|
||||
@@ -2276,9 +2270,8 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
|
||||
}
|
||||
}
|
||||
/* We traversed all variables and didn't find a strategy */
|
||||
if (!tmpvar) {
|
||||
if (!tmpvar)
|
||||
q->strategy = QUEUE_STRATEGY_RINGALL;
|
||||
}
|
||||
queues_t_link(queues, q, "Add queue to container");
|
||||
}
|
||||
init_queue(q); /* Ensure defaults for all parameters not set explicitly. */
|
||||
@@ -2306,9 +2299,8 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
|
||||
mem_iter = ao2_iterator_init(q->members, 0);
|
||||
while ((m = ao2_iterator_next(&mem_iter))) {
|
||||
q->membercount++;
|
||||
if (m->realtime) {
|
||||
if (m->realtime)
|
||||
m->dead = 1;
|
||||
}
|
||||
ao2_ref(m, -1);
|
||||
}
|
||||
ao2_iterator_destroy(&mem_iter);
|
||||
@@ -2466,9 +2458,9 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
|
||||
int pos = 0;
|
||||
int inserted = 0;
|
||||
|
||||
if (!(q = load_realtime_queue(queuename))) {
|
||||
if (!(q = load_realtime_queue(queuename)))
|
||||
return res;
|
||||
}
|
||||
|
||||
ao2_lock(q);
|
||||
|
||||
/* This is our one */
|
||||
@@ -2777,9 +2769,8 @@ static void leave_queue(struct queue_ent *qe)
|
||||
struct penalty_rule *pr_iter;
|
||||
int pos = 0;
|
||||
|
||||
if (!(q = qe->parent)) {
|
||||
if (!(q = qe->parent))
|
||||
return;
|
||||
}
|
||||
queue_t_ref(q, "Copy queue pointer from queue entry");
|
||||
ao2_lock(q);
|
||||
|
||||
@@ -5122,9 +5113,9 @@ static struct member *interface_exists(struct call_queue *q, const char *interfa
|
||||
struct member *mem;
|
||||
struct ao2_iterator mem_iter;
|
||||
|
||||
if (!q) {
|
||||
if (!q)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mem_iter = ao2_iterator_init(q->members, 0);
|
||||
while ((mem = ao2_iterator_next(&mem_iter))) {
|
||||
if (!strcasecmp(interface, mem->interface)) {
|
||||
@@ -5247,9 +5238,8 @@ static int add_to_queue(const char *queuename, const char *interface, const char
|
||||
|
||||
/*! \note Ensure the appropriate realtime queue is loaded. Note that this
|
||||
* short-circuits if the queue is already in memory. */
|
||||
if (!(q = load_realtime_queue(queuename))) {
|
||||
if (!(q = load_realtime_queue(queuename)))
|
||||
return res;
|
||||
}
|
||||
|
||||
ao2_lock(q);
|
||||
if ((old_member = interface_exists(q, interface)) == NULL) {
|
||||
@@ -5275,9 +5265,8 @@ static int add_to_queue(const char *queuename, const char *interface, const char
|
||||
ao2_ref(new_member, -1);
|
||||
new_member = NULL;
|
||||
|
||||
if (dump) {
|
||||
if (dump)
|
||||
dump_queue_members(q);
|
||||
}
|
||||
|
||||
res = RES_OKAY;
|
||||
} else {
|
||||
@@ -5442,11 +5431,10 @@ static int get_member_penalty(char *queuename, char *interface)
|
||||
}
|
||||
|
||||
/* some useful debuging */
|
||||
if (foundqueue) {
|
||||
if (foundqueue)
|
||||
ast_log (LOG_ERROR, "Invalid queuename\n");
|
||||
} else {
|
||||
else
|
||||
ast_log (LOG_ERROR, "Invalid interface\n");
|
||||
}
|
||||
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
@@ -5482,9 +5470,8 @@ static void reload_queue_members(void)
|
||||
cur_queue = ao2_t_find(queues, &tmpq, OBJ_POINTER, "Reload queue members");
|
||||
}
|
||||
|
||||
if (!cur_queue) {
|
||||
if (!cur_queue)
|
||||
cur_queue = load_realtime_queue(queue_name);
|
||||
}
|
||||
|
||||
if (!cur_queue) {
|
||||
/* If the queue no longer exists, remove it from the
|
||||
@@ -6280,9 +6267,8 @@ static int queue_function_qac_dep(struct ast_channel *chan, const char *cmd, cha
|
||||
ao2_iterator_destroy(&mem_iter);
|
||||
ao2_unlock(q);
|
||||
queue_t_unref(q, "Done with temporary reference in QUEUE_MEMBER_COUNT");
|
||||
} else {
|
||||
} else
|
||||
ast_log(LOG_WARNING, "queue %s was not found\n", data);
|
||||
}
|
||||
|
||||
snprintf(buf, len, "%d", count);
|
||||
|
||||
@@ -6927,9 +6913,8 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
|
||||
struct ao2_iterator queue_iter;
|
||||
struct ao2_iterator mem_iter;
|
||||
|
||||
if (argc != 2 && argc != 3) {
|
||||
if (argc != 2 && argc != 3)
|
||||
return CLI_SHOWUSAGE;
|
||||
}
|
||||
|
||||
if (argc == 3) { /* specific queue */
|
||||
if ((q = load_realtime_queue(argv[2]))) {
|
||||
@@ -6991,9 +6976,9 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
|
||||
int2strat(q->strategy), q->holdtime, q->talktime, q->weight,
|
||||
q->callscompleted, q->callsabandoned,sl,q->servicelevel);
|
||||
do_print(s, fd, ast_str_buffer(out));
|
||||
if (!ao2_container_count(q->members)) {
|
||||
if (!ao2_container_count(q->members))
|
||||
do_print(s, fd, " No Members");
|
||||
} else {
|
||||
else {
|
||||
struct member *mem;
|
||||
|
||||
do_print(s, fd, " Members: ");
|
||||
@@ -7003,28 +6988,26 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
|
||||
if (strcasecmp(mem->membername, mem->interface)) {
|
||||
ast_str_append(&out, 0, " (%s)", mem->interface);
|
||||
}
|
||||
if (mem->penalty) {
|
||||
if (mem->penalty)
|
||||
ast_str_append(&out, 0, " with penalty %d", mem->penalty);
|
||||
}
|
||||
ast_str_append(&out, 0, "%s%s%s (%s)",
|
||||
mem->dynamic ? " (dynamic)" : "",
|
||||
mem->realtime ? " (realtime)" : "",
|
||||
mem->paused ? " (paused)" : "",
|
||||
ast_devstate2str(mem->status));
|
||||
if (mem->calls) {
|
||||
if (mem->calls)
|
||||
ast_str_append(&out, 0, " has taken %d calls (last was %ld secs ago)",
|
||||
mem->calls, (long) (time(NULL) - mem->lastcall));
|
||||
} else {
|
||||
else
|
||||
ast_str_append(&out, 0, " has taken no calls yet");
|
||||
}
|
||||
do_print(s, fd, ast_str_buffer(out));
|
||||
ao2_ref(mem, -1);
|
||||
}
|
||||
ao2_iterator_destroy(&mem_iter);
|
||||
}
|
||||
if (!q->head) {
|
||||
if (!q->head)
|
||||
do_print(s, fd, " No Callers");
|
||||
} else {
|
||||
else {
|
||||
struct queue_ent *qe;
|
||||
int pos = 1;
|
||||
|
||||
@@ -7043,11 +7026,10 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
|
||||
ao2_iterator_destroy(&queue_iter);
|
||||
ao2_unlock(queues);
|
||||
if (!found) {
|
||||
if (argc == 3) {
|
||||
if (argc == 3)
|
||||
ast_str_set(&out, 0, "No such queue: %s.", argv[2]);
|
||||
} else {
|
||||
else
|
||||
ast_str_set(&out, 0, "No queues.");
|
||||
}
|
||||
do_print(s, fd, ast_str_buffer(out));
|
||||
}
|
||||
return CLI_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user