[Asterisk-Users] RE: Dial Command Doesn't return Correctly! (Bug?)
Douglas Garstang
dgarstang at oneeighty.com
Fri Dec 9 22:29:18 MST 2005
Oops.
Worked it out. I misspelled 'qualify' for the second proxy server. I did not realise you need to have qualify= on a SIP peer to be able to get ${DIALSTATUS} for it. Lucky I had it in there at all, otherwise I would have given up on this approach quick smart. DOCUMENTATION WOULD BE NICE!
-----Original Message-----
From: Douglas Garstang
Sent: Fri 12/9/2005 10:23 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion; asterisk-users at lists.digium.com
Cc:
Subject: Dial Command Doesn't return Correctly! (Bug?)
I have a really really weird problem here!
I'm trying to dial a proxy server, and when that fails, dial another, and finally take some action such as play a sound file.
I found that if the proxy server isn't up, Asterisk returns a CONGESTION on the channel, and if the proxy server is up but returns a "404 Not Found", Asterisk returns CHANUNAVAIL.
So, I tried to write some logic around that.
When I issue the first dial command, and the proxy server isn't up or returns a "Not Found", Asterisk ***immediately returns control*** and jumps to the CONGESTION or CHANUNAVAIL paths. It then goes on to dial the second proxy server. This proxy server is NOT RUNNING, but Asterisk doesn't immediately return like it did for the first one. It just keeps sending INVITES every few seconds until the 20s dial timeout is up. When that timeout expires it displays on the console that the channel was NOANSWER. This is wrong!!!
Also, when asterisk immediately returns after the first dial command fails, it displays the following on the console:
"Unable to create channel of type 'SIP' (cause 3 - No route to destination"
Good! But on the SECOND dial, it does not display this. As I said, it just keeps sending INVITE's to a system that is down (CHANUNAVAIL) for the full 20s and then returns status NOANSWER.
Why is it doing this? Arrgh!
Files pasted below.
Help would be very much appreciated!
extensions.conf:
[test]
exten => _1.,1,NoOp(Calling macro DialProxy)
exten => _1.,n,Macro(DialProxy,${EXTEN})
[macro-DialProxy];
exten => s,1,Dial(SIP/${ARG1}@proxy1,20,tr <mailto:SIP/${ARG1}@proxy1,20,tr> )
exten => s,2,Goto(s-${DIALSTATUS},1) ; Gets excuted as it should, because
exten => s-CONGESTION,1,Goto(s,20)
exten => s-CHANUNAVAIL,1,Goto(s,20)
exten => s,20,Dial(SIP/${ARG1}@proxy2,20,tr <mailto:SIP/${ARG1}@proxy2,20,tr> )
exten => s,21,Goto(s2-${DIALSTATUS},1) ; Never gets executed eventhough channel is CHANUNAVAIL. Why???
exten => s2-CONGESTION,1,Playback(all-outgoing-lines-unavailable)
exten => s2-CHANUNAVAIL,1,Playback(all-outgoing-lines-unavailable)
sip.conf:
[proxy1]
type=peer
context=test
host=192.168.10.24
insecure=very
qualify=yes
[proxy2]
type=peer
context=test
host=192.168.10.25
insecure=very
qyalify=yes
More information about the asterisk-users
mailing list