[Asterisk-Users] Testing null values: ast_yyerror(): syntax error

Walt Reed asterisk at linuxguy.com
Wed Aug 18 07:56:48 MST 2004


OK, I'm going nuts here trying to correctly identify null values,
specifically when callerID info is not available.

FYI, I'm running Asterisk CVS-HEAD-08/17/04-13:08:53, and Bison 1.875a
(debian Sid).

A snippit of my dialplan looks like this:
exten => s,1,SetCIDNum(${CALLERIDNUM})
exten => s,2,NoOp,${CALLERID}
exten => s,3,DBGet(temp=idiot/${CALLERIDNUM}) ; Is the person calling an idiot?
exten => s,4,Goto(s,2001) ; Yep, he's an idiot.

; else check for callerID. If none (or 800 number,) handle special.
exten => s,104,GotoIf($[${CALLERIDNUM} = ""]?s|1000:s|105)
exten => s,105,GotoIf($[${CALLERIDNUM:0:3} = 877]?s|1000:s|106)

Output from * is:

    -- Executing SetCIDNum("Zap/2-1", "") in new stack
    -- Executing NoOp("Zap/2-1", "") in new stack
    -- Executing DBget("Zap/2-1", "temp=idiot/") in new stack
    -- DBget: varname=temp, family=idiot, key=
    -- DBget: Value not found in database.
Aug 18 10:34:06 WARNING[458767]: ast_expr.y:474 ast_yyerror:
ast_yyerror(): syntax error: syntax error; Input:
 = ""
   ^
    -- Executing GotoIf("Zap/2-1", "0?s|1000:s|105") in new stack
    -- Goto (bell2,s,105)
Aug 18 10:34:06 WARNING[458767]: ast_expr.y:474 ast_yyerror:
ast_yyerror(): syntax error: syntax error; Input:
 = 877


When I DO have a valid caller ID number, everything works:

 -- Executing SetCIDNum("SIP/601-83b7", "601") in new stack
    -- Executing NoOp("SIP/601-83b7", ""Office" <601>") in new stack
    -- Executing DBget("SIP/601-83b7", "temp=idiot/601") in new stack
    -- DBget: varname=temp, family=idiot, key=601
    -- DBget: Value not found in database.
    -- Executing GotoIf("SIP/601-83b7", "0?s|1000:s|105") in new stack
    -- Goto (bell2,s,105)
    -- Executing GotoIf("SIP/601-83b7", "0?s|1000:s|106") in new stack
    -- Goto (bell2,s,106)



I have tried the "foo" method too with similar results (this shows both
a failed and working calledID):

Aug 16 14:58:33 ERROR[409616]: fsk_serie made mylen < 0 (-16)
Aug 16 14:58:33 WARNING[409616]: CallerID feed failed: Success
Aug 16 14:58:33 WARNING[409616]: CallerID returned with error on channel
'Zap/2-1'
Aug  16 14:58:36 WARNING[409616]: ast_yyerror(): syntax error: syntax
error; Input:
foo = foo
^^^^^^^^^
      ^
Aug 16 17:19:07 WARNING[425999]: ast_yyerror(): syntax error: syntax
error; Input:
foo2075551212 = foo
^^^^^^^^^^^^^^^^^^^


So, IS there a method that works? Can I set CID to 0 if it's missing or
something? Or some other variable that gives the real CID status (feed error,
anonymous, unavailable)?




More information about the asterisk-users mailing list