Dial doesn't seem to connect in GotoIf

Hi,

I’m trying out some basics in extensions.conf and got stuck on a strange problem.

This is the extensions.conf

exten=2312,1,GotoIf($["${CALLERID(num):0:2}" = "07"]?cellip-in,forex,1:cellip-in,020777777,1) exten=2793,1,Ringing exten=2793,n,Wait,2 exten=2793,n,Background(tt-monkeysintro) exten=2793,n,WaitExten exten=1,1,Goto(cellip-in,hydro,1) exten=2,1,Goto(cellip-in,forex,1) exten=3,1,Goto(cellip-in,goyada,1) exten=4,1,Goto(cellip-in,020777777,1) exten=5,1,Dial(SIP/6001) exten=hydro,1,Set(CHANNEL(language)=se) exten=hydro,2,Agi(agi://192.168.16.54/hydro.agi) exten=forex,1,Agi(agi://192.168.16.54/forex.agi) exten=goyada,1,Set(CHANNEL(language)=goyada) exten=goyada,2,Agi(agi://192.168.16.54/goyadaIVR.agi) exten=020777777,1,Dial(SIP/020777777@cellip-2312)

This is the CLI output when calling the two extensions. 2312 first and 2793 after.

*CLI> -- Executing [2312@cellip-in:1] GotoIf("SIP/46855002312-b670da18", "0?cellip-in|forex|1:cellip-in|020777777|1") in new stack -- Goto (cellip-in,020777777,1) -- Executing [020777777@cellip-in:1] Dial("SIP/46855002312-b670da18", "SIP/020777777@cellip-2312") in new stack -- Called 020777777@cellip-2312 -- SIP/cellip-2312-08227e90 is ringing -- SIP/cellip-2312-08227e90 answered SIP/46855002312-b670da18 -- Packet2Packet bridging SIP/46855002312-b670da18 and SIP/cellip-2312-08227e90 == Spawn extension (cellip-in, 020777777, 1) exited non-zero on 'SIP/46855002312-b670da18' -- Executing [2793@cellip-in:1] Ringing("SIP/46855002312-b670da18", "") in new stack -- Executing [2793@cellip-in:2] Wait("SIP/46855002312-b670da18", "2") in new stack -- Executing [2793@cellip-in:3] BackGround("SIP/46855002312-b670da18", "tt-monkeysintro") in new stack -- <SIP/46855002312-b670da18> Playing 'tt-monkeysintro' (language 'en') -- Executing [2793@cellip-in:4] WaitExten("SIP/46855002312-b670da18", "") in new stack [Sep 10 18:06:35] NOTICE[22693]: rtp.c:788 process_rfc3389: Comfort noise support incomplete in Asterisk (RFC 3389). Please turn off on client if possible. Client IP: 62.80.200.53 == CDR updated on SIP/46855002312-b670da18 -- Executing [4@cellip-in:1] Goto("SIP/46855002312-b670da18", "cellip-in|020777777|1") in new stack -- Goto (cellip-in,020777777,1) -- Executing [020777777@cellip-in:1] Dial("SIP/46855002312-b670da18", "SIP/020777777@cellip-2312") in new stack -- Called 020777777@cellip-2312 -- SIP/cellip-2312-0822bdc0 is ringing -- SIP/cellip-2312-0822bdc0 answered SIP/46855002312-b670da18 -- Packet2Packet bridging SIP/46855002312-b670da18 and SIP/cellip-2312-0822bdc0 == Spawn extension (cellip-in, 020777777, 1) exited non-zero on 'SIP/46855002312-b670da18'

What happens is that when the GotoIf in extension 2312 is false and calls “cellip-in,020777777,1” the call is never picked up. When I call extension 2793 and press 4, the call gets picked up ok although it’s calling the same 020777777 number.

What on earth am I doing wrong? Why does GotoIf behave differently than Goto? And how can I do a workaround if this is a bug. All I need is to connect to one extension if the caller number starts with one thing and anoter extension if it doesn’t.

The trace shows that it is picked up. You will need the sip debug output to prove otherwise.