use pbx_builtin_getvar_helper() so that GET VARIABLE can retrieve global

variables (issue #7609)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@39935 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2006-08-15 22:49:41 +00:00
parent f4e47e9b51
commit 465207a28d

View File

@@ -1161,18 +1161,17 @@ static int handle_setvariable(struct ast_channel *chan, AGI *agi, int argc, char
static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, char **argv) static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, char **argv)
{ {
char *ret; const char *ret;
char tempstr[1024]; char tempstr[1024];
if (argc != 3) if (argc != 3)
return RESULT_SHOWUSAGE; return RESULT_SHOWUSAGE;
/* check if we want to execute an ast_custom_function */ /* check if we want to execute an ast_custom_function */
if (!ast_strlen_zero(argv[2]) && (argv[2][strlen(argv[2]) - 1] == ')')) { if (!ast_strlen_zero(argv[2]) && (argv[2][strlen(argv[2]) - 1] == ')'))
ret = ast_func_read(chan, argv[2], tempstr, sizeof(tempstr)); ret = ast_func_read(chan, argv[2], tempstr, sizeof(tempstr));
} else { else
pbx_retrieve_variable(chan, argv[2], &ret, tempstr, sizeof(tempstr), NULL); ret = pbx_builtin_getvar_helper(chan, argv[2]);
}
if (ret) if (ret)
fdprintf(agi->fd, "200 result=1 (%s)\n", ret); fdprintf(agi->fd, "200 result=1 (%s)\n", ret);