[Asterisk-Users] Re: Gogoif with variables acting funny?
Steve Woolley
swoolley at adstelecom.com
Tue Jul 13 05:01:26 MST 2004
So far I have tried various forms of the expression including:
exten => t,2,Gotoif,$[${counter} < 3]?s|7:h|1
exten => t,2,Gotoif([${counter} < 3]?s,7:h,1)
exten => t,2,Gotoif([ ${counter} < 3 ]?s,7:h,1)
exten => t,2,Gotoif([ ${counter} < 3] ? s,7 : h,1)
With none of the desired results. It always jumps to hangup:
-- Goto (inbound-analog,h,1)
The most interesting result was from the 1st one:
exten => t,2,Gotoif,$[${counter} < 3]?s|7:h|1
In the log it showed:
-- Executing SetVar("Zap/99-1", "counter=[0+1]") in new stack
-- Executing GotoIf("Zap/99-1", "0?s|7:h|1") in new stack
-- Goto (inbound-analog,h,1)
According to numerous installation guides, I need bison installed to
process expressions within my extensions.conf. I am running RedHat
Enterprise Linus 3.0 which says bison is installed. However it seems I
am not properly processing the expressions, is their a config file or
PATH variable that can be set or is their some other log file that would
show a bison problem within asterisk?
Andrew Kohlsmith wrote:
> On Monday 12 July 2004 18:44, Ed Pringle wrote:
> > $[expr1 operator expr2]
> >
> > Spaces (and lack of spaces) are important. There is no space
> between the
> > opening [ and expr1, or between expr2 and the closing ]. But you do
> need
> > spaces separating expr1 from operator, and separating operator from
> expr2.
>
> Any particular reason why it's so picky about spaces, especially
> between the
> [] and exprs? Seems like a minor bug to me.
>
> -A.
I added code to improve the parser, to a degree, a number of weeks ago.
It is in CVS right now. Basically, it made it so it didn't care how many
spaces were between tokens (as long as there is at least one), or at the
beginning or end of the string to be evaluated. It also improved the
error messages that are sent to the log (see
/var/log/asterisk/messages). And, I made it use double quotes to force a
string token... even if the string contains spaces.
It's all documented in the asterisk/doc/README.variables.
I was very tempted to change it so that it used a lexer-- like lex,
perfect hash, etc, etc.... but just didn't have the time. It'd be a big
change. The lexical analysis is real simple. it uses a space, basically,
to separate tokens. And that's it! No space? it's all one token.
murf
--__--__--
_______________________________________________
Asterisk-Users mailing list
Asterisk-Users at lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-users
End of Asterisk-Users Digest
--
Steve Woolley
IT Manager
ADS Telecom, Inc.
59 Skyline Drive
Suite 1250
Lake Mary, Florida 32746
Phone: (407)682-6226 x1110
Fax: (407)682-3455
Cell: (321)229-5311
swoolley at adstelecom.com
www.adstelecom.com
More information about the asterisk-users
mailing list