aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-18 20:09:02 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-18 20:09:02 +0000
commitb889122d407739b0267fba583889e2d757c231cf (patch)
tree6494cb4068acb26b25099075f59c4ce050bd7c23 /apps
parent29026c67e57110c93c4959f1c447e22e7326f0db (diff)
Moving the logic for handling an empty membername to the create_member function so that there is a common place
where this occurs instead of being spread out to several different places. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@82865 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_queue.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index a435f7f12..fe2bd4987 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -650,7 +650,10 @@ 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));
- ast_copy_string(cur->membername, membername, sizeof(cur->membername));
+ if(!ast_strlen_zero(membername))
+ ast_copy_string(cur->membername, membername, sizeof(cur->membername));
+ else
+ ast_copy_string(cur->membername, interface, sizeof(cur->membername));
if (!strchr(cur->interface, '/'))
ast_log(LOG_WARNING, "No location at interface '%s'\n", interface);
cur->status = ast_device_state(interface);
@@ -1145,7 +1148,7 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
while ((interface = ast_category_browse(member_config, interface))) {
rt_handle_member_record(q, interface,
- S_OR(ast_variable_retrieve(member_config, interface, "membername"), interface),
+ ast_variable_retrieve(member_config, interface, "membername"),
ast_variable_retrieve(member_config, interface, "penalty"),
ast_variable_retrieve(member_config, interface, "paused"));
}
@@ -3045,7 +3048,7 @@ static void reload_queue_members(void)
char *queue_name;
char *member;
char *interface;
- char *membername;
+ char *membername = NULL;
char *penalty_tok;
int penalty = 0;
char *paused_tok;
@@ -3347,10 +3350,6 @@ static int aqm_exec(struct ast_channel *chan, void *data)
priority_jump = 1;
}
- if (ast_strlen_zero(args.membername))
- args.membername = args.interface;
-
-
switch (add_to_queue(args.queuename, args.interface, args.membername, penalty, 0, queue_persistent_members)) {
case RES_OKAY:
ast_queue_log(args.queuename, chan->uniqueid, args.interface, "ADDMEMBER", "%s", "");
@@ -3944,8 +3943,7 @@ static int reload_queues(void)
if (!ast_strlen_zero(args.membername)) {
membername = args.membername;
while (*membername && *membername < 33) membername++;
- } else
- membername = interface;
+ }
/* Find the old position in the list */
ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface));
@@ -4321,9 +4319,6 @@ static int manager_add_queue_member(struct mansession *s, const struct message *
else
paused = abs(ast_true(paused_s));
- if (ast_strlen_zero(membername))
- membername = interface;
-
switch (add_to_queue(queuename, interface, membername, penalty, paused, queue_persistent_members)) {
case RES_OKAY:
ast_queue_log(queuename, "MANAGER", interface, "ADDMEMBER", "%s", "");
@@ -4399,7 +4394,7 @@ static int manager_pause_queue_member(struct mansession *s, const struct message
static int handle_queue_add_member(int fd, int argc, char *argv[])
{
- char *queuename, *interface, *membername;
+ char *queuename, *interface, *membername = NULL;
int penalty;
if ((argc != 6) && (argc != 8) && (argc != 10)) {
@@ -4430,8 +4425,6 @@ static int handle_queue_add_member(int fd, int argc, char *argv[])
if (argc >= 10) {
membername = argv[9];
- } else {
- membername = interface;
}
switch (add_to_queue(queuename, interface, membername, penalty, 0, queue_persistent_members)) {