mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
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
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user