Merged revisions 53075 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 1 Feb 2007 20:12:56 +0000 (20:12 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 1 Feb 2007 20:12:56 +0000 (20:12 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r53075 | tilghman | 2007-02-01 14:09:52 -0600 (Thu, 01 Feb 2007) | 10 lines

Merged revisions 53074 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r53074 | tilghman | 2007-02-01 14:07:35 -0600 (Thu, 01 Feb 2007) | 2 lines

Bug 8965 - Allow FIELDQTY to work with both variables and dialplan functions

........

................

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@53076 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_strings.c

index c7fc485..ff3e577 100644 (file)
@@ -48,8 +48,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 static int function_fieldqty(struct ast_channel *chan, const char *cmd,
                             char *parse, char *buf, size_t len)
 {
-       const char *varval;
-       char *varval2 = NULL;
+       char *varname, *varsubst, varval[8192] = "", *varval2 = varval;
        int fieldcount = 0;
        AST_DECLARE_APP_ARGS(args,
                             AST_APP_ARG(varname);
@@ -68,9 +67,10 @@ static int function_fieldqty(struct ast_channel *chan, const char *cmd,
                        else
                                ast_copy_string(args.delim, "-", 2);
                }
-               varval = pbx_builtin_getvar_helper(chan, args.varname);
-               if (varval)
-                       varval2 = ast_strdupa(varval);
+               varsubst = alloca(strlen(varname) + 4);
+
+               sprintf(varsubst, "${%s}", varname);
+               pbx_substitute_variables_helper(chan, varsubst, varval, sizeof(varval) - 1);
                while (strsep(&varval2, args.delim))
                        fieldcount++;
        } else {