Hello D Tucny,

Your solution works indeed well, thanks for it:)

pepesz










Monday, August 3, 2009, 6:20:39 AM, you wrote:


2009/7/31 pepesz76 <pepes...@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





-- 
Best regards,
 pepesz76                            mailto:pepes...@o2.pl



_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

AstriCon 2009 - October 13 - 15 Phoenix, Arizona
Register Now: http://www.astricon.net

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to