[asterisk-bugs] [Asterisk 0014897]: expressions are not working

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Apr 14 15:10:40 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14897 
====================================================================== 
Reported By:                johnlange
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   14897
Category:                   Functions/func_math
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           1.4.23 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-04-14 14:54 CDT
Last Modified:              2009-04-14 15:10 CDT
====================================================================== 
Summary:                    expressions are not working
Description: 
In Asterisk 1.4.23.1, expressions don't seem to be working.

According to the docs (doc/channelvariables.txt),  you should be able to
do this:

exten => 1,2,Set(koko=$[2 * ${lala}])
        

In my system I have this:

exten => i,2,Set(TRIES=$[1 + ${TRIES}])

However, it generates this error:

 WARNING[6389]: ast_expr2.fl:407 ast_yyerror: ast_yyerror():  syntax
error: syntax error, unexpected $end, expecting '-' or '!' or '(' or
'<token>'; Input:
1 + 
    ^

I also reversed it:

exten => i,2,Set(TRIES=$[${TRIES} + 1])

But it still didn't work.

I know this worked in the past so is there something I'm not seeing or
are expressions not working in Asterisk?
====================================================================== 

---------------------------------------------------------------------- 
 (0103240) jsmith (administrator) - 2009-04-14 15:10
 http://bugs.digium.com/view.php?id=14897#c103240 
---------------------------------------------------------------------- 
John,

You'll get that warning if ${TRIES} doesn't yet have a value, as the
expression ends up evaluating to: $[1 + ] or $[ + 1] (depending on the
order of your operands).  What the warning is saying in plain English is
"Hey, I got to the end of the expression, but I was expecting something
else before the end".

To double-check your variable, try this instead:

exten => i,2,Verbose(1,The value of TRIES is ${TRIES}.)
exten => i,3,Set(TRIES=$[${TRIES}+1])
exten => i,4,Verbose(1,The value of TRIES is now ${TRIES}.) 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-04-14 15:10 jsmith         Note Added: 0103240                          
======================================================================




More information about the asterisk-bugs mailing list