From: Tilghman Lesher Date: Thu, 1 Feb 2007 20:07:35 +0000 (+0000) Subject: Bug 8965 - Allow FIELDQTY to work with both variables and dialplan functions X-Git-Tag: 1.2.15~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8bed34be9c29f3504c79e52e27673a51fac6620;p=thirdparty%2Fasterisk.git 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 --- 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;