[asterisk-users] Problem with GotoIf in dialplan

Eric Lyons eric at gus.to
Mon Jul 10 18:40:21 MST 2006


Hmm.

GotoIf seems to be doing something, uh, wrong in my dialplan:  Despite getting a TRUE  value in the conditional (as shown in the 
debug below), it doesn't take the jump!  The following is part of the macro being executed in the dialplan, starting at priority 16:

exten => s,16,Dial(IAX2/sixtel/${ARG1},${ARG2})
exten => s,17,GotoIf($[${DIALSTATUS} = NOANSWER],106)
exten => s,18,GotoIf($[${DIALSTATUS} = CONGESTION],23)
exten => s,19,GotoIf($[${DIALSTATUS} = CHANUNAVAIL],23)
exten => s,20,GotoIf($[${DIALSTATUS} = BUSY],100)
exten => s,21,GotoIf($[${DIALSTATUS} = CANCEL],104)
exten => s,22,Goto(102)
exten => s,23,Dial(Zap/g4/${ARG1},${ARG2})
exten => s,24,GotoIf($[${DIALSTATUS} = NOANSWER],106)
exten => s,25,GotoIf($[${DIALSTATUS} = BUSY],100)
exten => s,26,GotoIf($[${DIALSTATUS} = CANCEL],104)
exten => s,27,Goto(102)
exten => s,100,NoOp(reporting busy)
exten => s,101,Busy()
exten => s,102,NoOp(reporting congestion)
exten => s,103,Congestion()
exten => s,104,NoOp(reporting cancel)
exten => s,105,Hangup()
exten => s,106,NoOp(reporting noanswer returning to caller)

The Dial() in priority 16 returns with CHANUNAVAIL, as evidenced in the following monitor output, but it doesn't take the jump:

    -- Executing Dial("Zap/20-1", "IAX2/sixtel/1415xxxxxxx|5") in new stack
    -- Called sixtel/1415xxxxxxx
    -- Hungup 'IAX2/sixtel-1'
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Executing GotoIf("Zap/20-1", "0|106") in new stack
    -- Executing GotoIf("Zap/20-1", "0|23") in new stack
    -- Executing GotoIf("Zap/20-1", "1|23") in new stack   <--- TRUE!
    -- Executing GotoIf("Zap/20-1", "0|100") in new stack
    -- Executing GotoIf("Zap/20-1", "0|104") in new stack
    -- Executing Goto("Zap/20-1", "102") in new stack  <--- WHA??
    -- Goto (macro-dialout,s,102)
    -- Executing NoOp("Zap/20-1", "reporting congestion") in new stack
    -- Executing Congestion("Zap/20-1", "") in new stack
    -- Channel 0/20, span 1 got hangup request

The macro jumps to priority 102 instead of 23 as though it fell through all the GotoIf's!  This is asterisk v1.2.7.1, and no, I 
don't have "jumps" set.

Can anyone explain why it doesn't take the jump?  The plain "Goto" jump happens; it doesn't fall through to Dial(), so I don't get 
it.

Eric.




More information about the asterisk-users mailing list