Dial command not timing out properly

Here’s what we’re wanting to do:-

1) user calls into the system, then enters a code.   (done)
2) code is looked up and 3 contacts are found (done)
3) asterisk tries to call the first contact for 15 seconds (example)
4) if not answered etc. try 2nd contact
5) if answered log information to database (caller, who answered etc)

Now I’ve got that scripted in extensions_custom. What happens is that the first number is called. Asterisk notices that the first number was NOT answered and moves on in the script (which is what we expect), HOWEVER it’s still calling the first number. The script shows it moving on to the second call, but it’s still calling the first, and doesn’t drop the first call.

Any ideas? (part of the exensions_custom posted below)

Asterisk 1.2.18, CentOS 4.5.

console log:-

– Executing Goto(“IAX2/XXXX_User-21”, “xyz-account-check|s|1”) in new stack
– Goto (xyz-account-check,s,1)
– Executing Answer(“IAX2/XXXX_User-21”, “”) in new stack
– Executing Set(“IAX2/XXXX_User-21”, “TIMEOUT(digit)=4”) in new stack
– Digit timeout set to 4
– Executing Set(“IAX2/XXXX_User-21”, “TIMEOUT(response)=20”) in new stack
– Response timeout set to 20
– Executing AGI(“IAX2/XXXX_User-21”, “xyz/get-info.php”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/xyz/get-info.php
xyz/get-info.php: writing: SET VARIABLE XYZ_Customer XXXX
xyz/get-info.php: writing: SET VARIABLE XYZ_FirstContact nnnnnn9268
xyz/get-info.php: writing: SET VARIABLE XYZ_SecondContact nnnnnn4050
xyz/get-info.php: writing: SET VARIABLE XYZ_FinalContact nnnnnn4075
xyz/get-info.php: writing: SET VARIABLE XYZ_Representative Hugh
xyz/get-info.php: writing: SET VARIABLE XYZ_CallerID nnnnnn4080
– AGI Script xyz/get-info.php completed, returning 0
– Executing GotoIf(“IAX2/XXXX_User-21”, “0?110”) in new stack
– Executing Dial(“IAX2/XXXX_User-21”, “ZAP/g2/nnnnnn9268|15|r”) in new stack
– Called g2/nnnnnn9268
– Nobody picked up in 15000 ms
– Hungup ‘Zap/25-1’ (Doesn’t hang up first call, keeps ringing!)
– Executing Goto(“IAX2/XXXX_User-21”, “s-NOANSWER|1”) in new stack
– Goto (xyz-account-check,s-NOANSWER,1)
– Executing Goto(“IAX2/XXXX_User-21”, “xyz-secondcontact|s|1”) in new stack
– Goto (xyz-secondcontact,s,1)
– Executing GotoIf(“IAX2/XXXX_User-21”, “0?110”) in new stack
– Executing Dial(“IAX2/XXXX_User-21”, “ZAP/g2/nnnnnn4050|15”) in new stack
– Called g2/nnnnnn4050 (NEVER RINGS!)
– Hungup ‘Zap/25-1’
== Spawn extension (xyz-secondcontact, s, 2) exited non-zero on ‘IAX2/XXXX_User-21’
– Hungup ‘IAX2/XXXX_User-21’

extensions_custom:-

[from-xyz]
exten => 5010,1,Answer
exten => 5010,n,Goto(xyz-account-check|s,1)
exten => 5010,101,Hangup

[xyz-account-check]
exten => s,1,Answer
exten => s,2,Set(TIMEOUT(digit)=4)
exten => s,3,Set(TIMEOUT(response)=20)
exten => s,4,Agi(xyz/get-info.php)
exten => s,5,GotoIf($["${XYZ_FirstContact}" = “”]?110)
exten => s,6,Dial(ZAP/g2/${XYZ_FirstContact},15,r)
exten => s,7,Goto(s-${DIALSTATUS},1)
exten => s,8,Hangup

exten => s,110,Goto(xyz-secondcontact,s,1)
exten => s-ANSWER,1,Agi(xyz/log-answered.php|${XYZ_FirstContact})
exten => s-NOANSWER,1,Goto(xyz-secondcontact,s,1)
exten => s-BUSY,1,Goto(xyz-secondcontact,s,1)
exten => s-CHANUNAVAIL,1,Goto(xyz-secondcontact,s,1)
exten => s-CANCEL,1,Hangup
exten => s-CONGESTION,1,Goto(xyz-secondcontact,s,1)

[xyz-secondcontact]
exten => s,1,GotoIf($["${XYZ_SecondContact}" = “”]?110)
exten => s,n,Dial(ZAP/g2/${XYZ_SecondContact},15)
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n,Hangup

exten => s,110,Goto(xyz-finalcontact,s,1)

exten => s-ANSWER,1,Agi(xyz/log-answered.php|${XYZ_SecondContact})
exten => s-NOANSWER,1,Goto(xyz-finalcontact,s,1)
exten => s-BUSY,1,Goto(xyz-finalcontact,s,1)
exten => s-CHANUNAVAIL,1,Goto(xyz-finalcontact,s,1)
exten => s-CANCEL,1,Hangup
exten => s-CONGESTION,1,Goto(xyz-finalcontact,s,1)

[xyz-finalcontact]
exten => s,1,GotoIf($["${XYZ_FinalContact}" = “”]?110)
exten => s,n,Dial(ZAP/g2/${XYZ_FinalContact})
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s,n,Hangup

exten => s,110,Goto(xyz-account-invalid,s,1)

exten => s-ANSWER,1,Agi(xyz/log-answered.php|${XYZ_FinalContact})
exten => s-NOANSWER,1,Goto(xyz-goodbye,s,1)
exten => s-BUSY,1,Goto(xyz-goodbye,s,1)
exten => s-CHANUNAVAIL,1,Goto(xyz-goodbye,s,1)
exten => s-CANCEL,1,Hangup
exten => s-CONGESTION,1,Goto(xyz-goodbye,s,1)

[xyz-account-invalid]
exten => s,1,PlayBack(thank-you-for-calling)
exten => s,n,PlayBack(goodbye)
exten => s,n,Hangup

[xyz-goodbye]
exten => s,1,PlayBack(thank-you-for-calling)
exten => s,n,PlayBack(goodbye)
exten => s,n,Hangup

Does noone have any ideas or suggestions? I’m trying to implement this for a customer.

Thanks.