2009/7/31 pepesz76 <pepesz76 at o2.pl>
> Dear All,
>
> I'n trying to make a simple call forwarding, however I have small
> problem when evaluating an expresion.
>
> Here is my extensions.conf
> ...
>
>
> ; Unconditional Call Forward
> exten => _#21*X.,1,Set(DB(CFIM/${CALLERID(num)})=${EXTEN:4})
> exten => _#21*X.,2,Hangup()
> exten => #21#,1,Set(ignored=${DB_DELETE(CFIM/${CALLERID(num)})})
> exten => #21#,2,Hangup()
> ...
> exten => 50,1,Set(CFIM=${DB(CFIM/${EXTEN})})
> exten => 50,n,GotoIf($[${CFIM}=""]?start) ;<- THIS IS
WRONG, but not
> sure what should it look like?
> exten => 50,n,Dial(SIP/${CFIM},30)
> exten => 50,n,Dial(SIP/${EXTEN},30
> ...
>
> First part properly sets and deletes string in database
> Second part works as the forwarding is set, however if it is not set
> then CFIM is empty and I got:
> WARNING[9752]: ast_expr2.fl:434 ast_yyerror: ast_yyerror(): syntax error:
> syntax error, unexpected '=', expecting $end; Input:
> =''
>
> Can someone suggest the solution?
>
>
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...
d
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.digium.com/pipermail/asterisk-users/attachments/20090803/2e62fe86/attachment.htm