[asterisk-commits] rmudgett: trunk r401435 - in /trunk: ./ apps/app_queue.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 22 14:04:56 CDT 2013
Author: rmudgett
Date: Tue Oct 22 14:04:53 2013
New Revision: 401435
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401435
Log:
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)
........
Merged revisions 401433 from http://svn.asterisk.org/svn/asterisk/branches/11
........
Merged revisions 401434 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
trunk/ (props changed)
trunk/apps/app_queue.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.
Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=401435&r1=401434&r2=401435
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Tue Oct 22 14:04:53 2013
@@ -9727,6 +9727,7 @@
{
const char *queuename, *interface;
struct member *mem = NULL;
+ char *res = CLI_FAILURE;
switch (cmd) {
case CLI_INIT:
@@ -9748,36 +9749,39 @@
queuename = a->argv[5];
interface = a->argv[3];
+ if (log_membername_as_agent) {
+ mem = find_member_by_queuename_and_interface(queuename, interface);
+ }
+
switch (remove_from_queue(queuename, interface)) {
case RES_OKAY:
- if (log_membername_as_agent) {
- mem = find_member_by_queuename_and_interface(queuename, interface);
- }
if (!mem || ast_strlen_zero(mem->membername)) {
ast_queue_log(queuename, "CLI", interface, "REMOVEMEMBER", "%s", "");
} else {
ast_queue_log(queuename, "CLI", mem->membername, "REMOVEMEMBER", "%s", "");
}
- if (mem) {
- ao2_ref(mem, -1);
- }
ast_cli(a->fd, "Removed interface %s from queue '%s'\n", interface, queuename);
- return CLI_SUCCESS;
+ res = CLI_SUCCESS;
+ break;
case RES_EXISTS:
ast_cli(a->fd, "Unable to remove interface '%s' from queue '%s': Not there\n", interface, queuename);
- return CLI_FAILURE;
+ break;
case RES_NOSUCHQUEUE:
ast_cli(a->fd, "Unable to remove interface from queue '%s': No such queue\n", queuename);
- return CLI_FAILURE;
+ break;
case RES_OUTOFMEMORY:
ast_cli(a->fd, "Out of memory\n");
- return CLI_FAILURE;
+ break;
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;
- }
+ break;
+ }
+
+ if (mem) {
+ ao2_ref(mem, -1);
+ }
+
+ return res;
}
static char *complete_queue_pause_member(const char *line, const char *word, int pos, int state)
More information about the asterisk-commits
mailing list