aboutsummaryrefslogtreecommitdiffstats
path: root/main/manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/manager.c')
-rw-r--r--main/manager.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/main/manager.c b/main/manager.c
index 8b10712e8..b966440b0 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1499,8 +1499,15 @@ static int action_getvar(struct mansession *s, const struct message *m)
if (varname[strlen(varname) - 1] == ')') {
char *copy = ast_strdupa(varname);
-
- ast_func_read(c, copy, workspace, sizeof(workspace));
+ if (!c) {
+ c = ast_channel_alloc(0, 0, "", "", "", "", "", 0, "Bogus/%p", NULL);
+ if (c) {
+ ast_func_read(c, copy, workspace, sizeof(workspace));
+ ast_channel_free(c);
+ } else
+ ast_log(LOG_ERROR, "Unable to allocate bogus channel for variable substitution. Function results may be blank.\n");
+ } else
+ ast_func_read(c, copy, workspace, sizeof(workspace));
varval = workspace;
} else {
pbx_retrieve_variable(c, varname, &varval, workspace, sizeof(workspace), NULL);