[asterisk-commits] oej: branch oej/manager-set-function-fail r231601 - in /team/oej/manager-set-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 30 14:41:00 CST 2009
Author: oej
Date: Mon Nov 30 14:40:57 2009
New Revision: 231601
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=231601
Log:
With this patch, manager action setvar returns error is function does not exist or if function returns error.
Modified:
team/oej/manager-set-function-fail/include/asterisk/pbx.h
team/oej/manager-set-function-fail/main/manager.c
team/oej/manager-set-function-fail/main/pbx.c
Modified: team/oej/manager-set-function-fail/include/asterisk/pbx.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/manager-set-function-fail/include/asterisk/pbx.h?view=diff&rev=231601&r1=231600&r2=231601
==============================================================================
--- team/oej/manager-set-function-fail/include/asterisk/pbx.h (original)
+++ team/oej/manager-set-function-fail/include/asterisk/pbx.h Mon Nov 30 14:40:57 2009
@@ -824,7 +824,7 @@
/*!
* \note Will lock the channel.
*/
-void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value);
+int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value);
/*!
* \note Will lock the channel.
Modified: team/oej/manager-set-function-fail/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/manager-set-function-fail/main/manager.c?view=diff&rev=231601&r1=231600&r2=231601
==============================================================================
--- team/oej/manager-set-function-fail/main/manager.c (original)
+++ team/oej/manager-set-function-fail/main/manager.c Mon Nov 30 14:40:57 2009
@@ -1490,6 +1490,7 @@
const char *name = astman_get_header(m, "Channel");
const char *varname = astman_get_header(m, "Variable");
const char *varval = astman_get_header(m, "Value");
+ int res;
if (ast_strlen_zero(varname)) {
astman_send_error(s, m, "No variable specified");
@@ -1504,12 +1505,16 @@
}
}
- pbx_builtin_setvar_helper(c, varname, S_OR(varval, ""));
+ res = pbx_builtin_setvar_helper(c, varname, S_OR(varval, ""));
if (c)
ast_channel_unlock(c);
- astman_send_ack(s, m, "Variable Set");
+ if (res == 0) {
+ astman_send_ack(s, m, "Variable Set");
+ } else {
+ astman_send_error(s, m, "Variable not set");
+ }
return 0;
}
Modified: team/oej/manager-set-function-fail/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/manager-set-function-fail/main/pbx.c?view=diff&rev=231601&r1=231600&r2=231601
==============================================================================
--- team/oej/manager-set-function-fail/main/pbx.c (original)
+++ team/oej/manager-set-function-fail/main/pbx.c Mon Nov 30 14:40:57 2009
@@ -5892,7 +5892,7 @@
ast_mutex_unlock(&globalslock);
}
-void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
+int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
{
struct ast_var_t *newvariable;
struct varshead *headp;
@@ -5901,8 +5901,7 @@
if (name[strlen(name)-1] == ')') {
char *function = ast_strdupa(name);
- ast_func_write(chan, function, value);
- return;
+ return ast_func_write(chan, function, value);
}
if (chan) {
@@ -5940,6 +5939,8 @@
ast_channel_unlock(chan);
else
ast_mutex_unlock(&globalslock);
+
+ return 0;
}
int pbx_builtin_setvar(struct ast_channel *chan, void *data)
More information about the asterisk-commits
mailing list