aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/manager.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/main/manager.c b/main/manager.c
index ade1500c5..bdd679c34 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1490,6 +1490,7 @@ static int action_setvar(struct mansession *s, const struct message *m)
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 = 0;
if (ast_strlen_zero(varname)) {
astman_send_error(s, m, "No variable specified");
@@ -1503,13 +1504,23 @@ static int action_setvar(struct mansession *s, const struct message *m)
return 0;
}
}
-
- pbx_builtin_setvar_helper(c, varname, S_OR(varval, ""));
+ if (varname[strlen(varname)-1] == ')') {
+ char *function = ast_strdupa(varname);
+ res = ast_func_write(c, function, varval);
+ ast_log(LOG_DEBUG, "---- RESULT of ast_func_write %d \n", res);
+ } else {
+ pbx_builtin_setvar_helper(c, varname, S_OR(varval, ""));
+ }
if (c)
ast_channel_unlock(c);
- astman_send_ack(s, m, "Variable Set");
+ ast_log(LOG_DEBUG, "---- RESULT 2 :: ast_func_write %d \n", res);
+ if (res == 0) {
+ astman_send_ack(s, m, "Variable Set");
+ } else {
+ astman_send_error(s, m, "Variable not set");
+ }
return 0;
}