From f8bed34be9c29f3504c79e52e27673a51fac6620 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Thu, 1 Feb 2007 20:07:35 +0000 Subject: [PATCH] Bug 8965 - Allow FIELDQTY to work with both variables and dialplan functions git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@53074 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- funcs/func_strings.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/funcs/func_strings.c b/funcs/func_strings.c index 6da95b54c2..00b6dd1720 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -41,17 +41,18 @@ static char *function_fieldqty(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len) { - char *varname, *varval; + char *varname, *varsubst, varval[8192] = "", *varval2 = varval; char *delim = ast_strdupa(data); int fieldcount = 0; if (delim) { varname = strsep(&delim, "|"); - varval = pbx_builtin_getvar_helper(chan, varname); - if (varval) - varval = ast_strdupa(varval); + varsubst = alloca(strlen(varname) + 4); + + sprintf(varsubst, "${%s}", varname); + pbx_substitute_variables_helper(chan, varsubst, varval, sizeof(varval) - 1); if (delim) { - while (strsep(&varval, delim)) + while (strsep(&varval2, delim)) fieldcount++; } else if (!ast_strlen_zero(varval)) { fieldcount = 1; -- 2.47.2