mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 11:28:25 +00:00
app_queue: Fix CLI "queue remove member" queue_log entry.
The queue_log entry resulting from CLI "queue remove member" when
log_membername_as_agent is enabled is wrong. It always uses the interface
name instead of the member name in the queue_log entry.
* Get the queue member before removing it from the queue so the member
name is available for the queue_log entry.
(closes issue ASTERISK-21826)
Reported by: Oscar Esteve
Patches:
fix_membername.diff (license #6505) patch uploaded by Oscar Esteve
(modified to fix potential ref leak)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@401433 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -9135,6 +9135,7 @@ static char *handle_queue_remove_member(struct ast_cli_entry *e, int cmd, struct
|
|||||||
{
|
{
|
||||||
const char *queuename, *interface;
|
const char *queuename, *interface;
|
||||||
struct member *mem = NULL;
|
struct member *mem = NULL;
|
||||||
|
char *res = CLI_FAILURE;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CLI_INIT:
|
case CLI_INIT:
|
||||||
@@ -9156,36 +9157,39 @@ static char *handle_queue_remove_member(struct ast_cli_entry *e, int cmd, struct
|
|||||||
queuename = a->argv[5];
|
queuename = a->argv[5];
|
||||||
interface = a->argv[3];
|
interface = a->argv[3];
|
||||||
|
|
||||||
switch (remove_from_queue(queuename, interface)) {
|
|
||||||
case RES_OKAY:
|
|
||||||
if (log_membername_as_agent) {
|
if (log_membername_as_agent) {
|
||||||
mem = find_member_by_queuename_and_interface(queuename, interface);
|
mem = find_member_by_queuename_and_interface(queuename, interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (remove_from_queue(queuename, interface)) {
|
||||||
|
case RES_OKAY:
|
||||||
if (!mem || ast_strlen_zero(mem->membername)) {
|
if (!mem || ast_strlen_zero(mem->membername)) {
|
||||||
ast_queue_log(queuename, "CLI", interface, "REMOVEMEMBER", "%s", "");
|
ast_queue_log(queuename, "CLI", interface, "REMOVEMEMBER", "%s", "");
|
||||||
} else {
|
} else {
|
||||||
ast_queue_log(queuename, "CLI", mem->membername, "REMOVEMEMBER", "%s", "");
|
ast_queue_log(queuename, "CLI", mem->membername, "REMOVEMEMBER", "%s", "");
|
||||||
}
|
}
|
||||||
|
ast_cli(a->fd, "Removed interface %s from queue '%s'\n", interface, queuename);
|
||||||
|
res = CLI_SUCCESS;
|
||||||
|
break;
|
||||||
|
case RES_EXISTS:
|
||||||
|
ast_cli(a->fd, "Unable to remove interface '%s' from queue '%s': Not there\n", interface, queuename);
|
||||||
|
break;
|
||||||
|
case RES_NOSUCHQUEUE:
|
||||||
|
ast_cli(a->fd, "Unable to remove interface from queue '%s': No such queue\n", queuename);
|
||||||
|
break;
|
||||||
|
case RES_OUTOFMEMORY:
|
||||||
|
ast_cli(a->fd, "Out of memory\n");
|
||||||
|
break;
|
||||||
|
case RES_NOT_DYNAMIC:
|
||||||
|
ast_cli(a->fd, "Unable to remove interface '%s' from queue '%s': Member is not dynamic\n", interface, queuename);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (mem) {
|
if (mem) {
|
||||||
ao2_ref(mem, -1);
|
ao2_ref(mem, -1);
|
||||||
}
|
}
|
||||||
ast_cli(a->fd, "Removed interface %s from queue '%s'\n", interface, queuename);
|
|
||||||
return CLI_SUCCESS;
|
return res;
|
||||||
case RES_EXISTS:
|
|
||||||
ast_cli(a->fd, "Unable to remove interface '%s' from queue '%s': Not there\n", interface, queuename);
|
|
||||||
return CLI_FAILURE;
|
|
||||||
case RES_NOSUCHQUEUE:
|
|
||||||
ast_cli(a->fd, "Unable to remove interface from queue '%s': No such queue\n", queuename);
|
|
||||||
return CLI_FAILURE;
|
|
||||||
case RES_OUTOFMEMORY:
|
|
||||||
ast_cli(a->fd, "Out of memory\n");
|
|
||||||
return CLI_FAILURE;
|
|
||||||
case RES_NOT_DYNAMIC:
|
|
||||||
ast_cli(a->fd, "Unable to remove interface '%s' from queue '%s': Member is not dynamic\n", interface, queuename);
|
|
||||||
return CLI_FAILURE;
|
|
||||||
default:
|
|
||||||
return CLI_FAILURE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *complete_queue_pause_member(const char *line, const char *word, int pos, int state)
|
static char *complete_queue_pause_member(const char *line, const char *word, int pos, int state)
|
||||||
|
|||||||
Reference in New Issue
Block a user