diff --git a/funcs/func_strings.c b/funcs/func_strings.c index 8088f4db54af462b5ac4617acbc88d20a92cc364..c7fc485fdc4c95ab1d80e65f75bc6759acff019f 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -48,7 +48,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static int function_fieldqty(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) { - char *varval; + const char *varval; + char *varval2 = NULL; int fieldcount = 0; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(varname); @@ -57,7 +58,6 @@ static int function_fieldqty(struct ast_channel *chan, const char *cmd, AST_STANDARD_APP_ARGS(args, parse); if (args.delim) { - pbx_retrieve_variable(chan, args.varname, &varval, buf, len, NULL); if (args.delim[0] == '\\') { if (args.delim[1] == 'n') ast_copy_string(args.delim, "\n", 2); @@ -68,7 +68,10 @@ static int function_fieldqty(struct ast_channel *chan, const char *cmd, else ast_copy_string(args.delim, "-", 2); } - while (strsep(&varval, args.delim)) + varval = pbx_builtin_getvar_helper(chan, args.varname); + if (varval) + varval2 = ast_strdupa(varval); + while (strsep(&varval2, args.delim)) fieldcount++; } else { fieldcount = 1; diff --git a/main/pbx.c b/main/pbx.c index f60b2b2bd9893d47f379cb30a8b0d3b4bab7b5aa..e31d842f064b6c237dc7e80c2406cd620fb89aa3 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -1097,7 +1097,7 @@ static char *substring(const char *value, int offset, int length, char *workspac return ret; } -/*! \brief Support for Asterisk built-in variables and functions in the dialplan +/*! \brief Support for Asterisk built-in variables in the dialplan \note See also - \ref AstVar Channel variables