Warning with GOTOIF

Hello, I have this code in my extensions.conf,

exten => _XXXX,n(SU),gotoif([{DESTINOSU}=caixa_postal]?CAIXAPOSTAL:V1)
exten => _XXXX,n(V1),gotoif([{DESTINOSU}=fax]?FAX:V2)
exten => _XXXX,n(V2),gotoif([{DESTINOSU}=callback]?CALLBACK:V3)
exten => _XXXX,n(V3),gotoif([{NATENDE}=naoatende]?NATENDE:VIRTUALV4)

I receive this warning in my console:
[May 6 10:03:22] WARNING [29814][C-00000e91]: ast_expr2.fl : 470 ast_yyerror : ast_yyerror(): syntax error: syntax error, unexpected β€˜=’, expecting $end; Input:****=naoatende

Whats correct syntax for it ?
exten => _XXXX,n(V3),gotoif([{NATENDE}=naoatende]?NATENDE:VIRTUALV4)

Edit your post and use formmating tags for the dialplan, formatting is messed up.

Try putting quotes around the values being compared, will fix things in case the var’s are not defined:

["${DESTINOSU}"="caixa_postal"]

Please mark up your code as pre-formatted text, for the forum. At the moment I’d have to say it the missing $'s, but that would result in the parser not being invoked, so would not result in the error you are getting.

Second guess is that ${NATENDE} is an empty string. Variable are macro substituted into the parameters before the expression is parsed, so the parser will not see an a variable at that point, but rather nothing. Typically people use double quote.

Work Fine. Thank you

1 Like

Thank you work with " "

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.