<div class="gmail_quote">2009/7/31 pepesz76 <span dir="ltr"><pepesz76@o2.pl></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear All,<br>
<br>
I'n trying to make a simple call forwarding, however I have small<br>
problem when evaluating an expresion.<br>
<br>
Here is my extensions.conf<br>
...<br>
<br>
<br>
; Unconditional Call Forward<br>
exten => _#21*X.,1,Set(DB(CFIM/${CALLERID(num)})=${EXTEN:4})<br>
exten => _#21*X.,2,Hangup()<br>
exten => #21#,1,Set(ignored=${DB_DELETE(CFIM/${CALLERID(num)})})<br>
exten => #21#,2,Hangup()<br>
...<br>
exten => 50,1,Set(CFIM=${DB(CFIM/${EXTEN})})<br>
exten => 50,n,GotoIf($[${CFIM}=""]?start) ;<- THIS IS WRONG, but not<br>
sure what should it look like?<br>
exten => 50,n,Dial(SIP/${CFIM},30)<br>
exten => 50,n,Dial(SIP/${EXTEN},30<br>
...<br>
<br>
First part properly sets and deletes string in database<br>
Second part works as the forwarding is set, however if it is not set<br>
then CFIM is empty and I got:<br>
WARNING[9752]: ast_expr2.fl:434 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected '=', expecting $end; Input:<br>
=''<br>
<br>
Can someone suggest the solution?<br>
<br></blockquote></div><br>What it's doing in this case is first extracting the variable value then performing the evaluation of the condition, so, when there is no value set, what it's effectivly trying in the condition is $[=""], hence the unexpected '=' message. If you quote the variable, i.e. $["${CFIM}"=""] then in the event the variable is unset or contains an empty value the condition will still be at least $[""=""] and it should work...<br>
<br>d<br>