[asterisk-commits] tilghman: branch 1.2 r53074 - /branches/1.2/funcs/func_strings.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Feb 1 13:07:36 MST 2007


Author: tilghman
Date: Thu Feb  1 14:07:35 2007
New Revision: 53074

URL: http://svn.digium.com/view/asterisk?view=rev&rev=53074
Log:
Bug 8965

Modified:
    branches/1.2/funcs/func_strings.c

Modified: branches/1.2/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/funcs/func_strings.c?view=diff&rev=53074&r1=53073&r2=53074
==============================================================================
--- branches/1.2/funcs/func_strings.c (original)
+++ branches/1.2/funcs/func_strings.c Thu Feb  1 14:07:35 2007
@@ -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;



More information about the asterisk-commits mailing list