I am hoping that someone out there can help me out.
I have a FreePBX installation running version 2.8.1.5 and Asterisk version 1.6.2.20.
I have a SIP trunk defined to a public service provider and that works OK but I have noticed that quite often, Asterisk takes a long time to register the trunk.
The normal process, and what I would expect to happen, is for Asterisk to send a Register request, The service provider challenges with SIP 401 Unauthorised, Asterisk replies with new registration request adding the correct auth parameters generated from the challenge.
What seems to be happening is, Asterisk sends a Register request, The service provider challenges with SIP 401 Unauthorised, Asterisk ignores this challenge and re-transmitts the original request.
debug log …
[Dec 1 22:01:50] VERBOSE[26237] chan_sip.c: Reliably Transmitting (NAT) to 80.93.165.111:5060:
REGISTER sip:sip.numbergroup-services.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.132:5060;branch=z9hG4bK15bd82e9;rport
Max-Forwards: 70
From: sip:[email protected];tag=as56e0e721
To: sip:[email protected]
Call-ID: [email protected]
CSeq: 1309 REGISTER
User-Agent: FPBX-2.8.1(1.6.2.20)
Authorization: Digest username=“MyAccount”, realm=“sip.numbergroup-services.com”, algorithm=MD5, uri=“sip:sip.numbergroup-services.com”, nonce=“91458f8c-3c01-11e2-aab6-03dda959c092”, response=“04f26cdda5c7e7f88e5c6d9482a60fd6”, qop=auth, cnonce=“40cab4cc”, nc=00000003
Expires: 600
Contact: sip:[email protected]
Content-Length: 0
[Dec 1 22:01:50] VERBOSE[26237] chan_sip.c: Really destroying SIP dialog ‘[email protected]’ Method: REGISTER
[Dec 1 22:01:50] VERBOSE[26237] chan_sip.c:
<— SIP read from UDP:80.93.165.111:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.132:5060;branch=z9hG4bK15bd82e9;rport=61810
From: sip:[email protected];tag=as56e0e721
To: sip:[email protected];tag=F91aUKHDaHe4a
Call-ID: [email protected]
CSeq: 1309 REGISTER
User-Agent: numbergroup.com
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, precondition, path, replaces
WWW-Authenticate: Digest realm=“sip.numbergroup-services.com”, nonce=“556b2372-3c02-11e2-b292-03dda959c092”, stale=true, algorithm=MD5, qop="auth"
Content-Length: 0
<------------->
[Dec 1 22:01:50] VERBOSE[26237] chan_sip.c: — (11 headers 0 lines) —
[Dec 1 22:01:51] VERBOSE[26237] chan_sip.c: Retransmitting #1 (NAT) to 80.93.165.111:5060:
REGISTER sip:sip.numbergroup-services.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.132:5060;branch=z9hG4bK15bd82e9;rport
Max-Forwards: 70
From: sip:[email protected];tag=as56e0e721
To: sip:[email protected]
Call-ID: [email protected]
CSeq: 1309 REGISTER
User-Agent: FPBX-2.8.1(1.6.2.20)
Authorization: Digest username=“MyAccount”, realm=“sip.numbergroup-services.com”, algorithm=MD5, uri=“sip:sip.numbergroup-services.com”, nonce=“91458f8c-3c01-11e2-aab6-03dda959c092”, response=“04f26cdda5c7e7f88e5c6d9482a60fd6”, qop=auth, cnonce=“40cab4cc”, nc=00000003
Expires: 600
Contact: sip:[email protected]
Content-Length: 0
This challenge being ignored continues for a couple of minutes and then, eventually, Asterisk does acknowledge the register challenge and responds appropriately, finally registering the trunk.
What I have noted is the line … [Dec 1 22:01:50] VERBOSE[26237] chan_sip.c: Really destroying SIP dialog ‘[email protected]’ Method: REGISTER … which I am guessing may have something to do with it.
Anyway, after a time, the trunk does register successfully.
e.g…
[Dec 1 22:01:58] VERBOSE[26237] chan_sip.c: Retransmitting #4 (NAT) to 80.93.165.111:5060:
REGISTER sip:sip.numbergroup-services.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.132:5060;branch=z9hG4bK15bd82e9;rport
Max-Forwards: 70
From: sip:[email protected];tag=as56e0e721
To: sip:[email protected]
Call-ID: [email protected]
CSeq: 1309 REGISTER
User-Agent: FPBX-2.8.1(1.6.2.20)
Authorization: Digest username=“MyAccount”, realm=“sip.numbergroup-services.com”, algorithm=MD5, uri=“sip:sip.numbergroup-services.com”, nonce=“91458f8c-3c01-11e2-aab6-03dda959c092”, response=“04f26cdda5c7e7f88e5c6d9482a60fd6”, qop=auth, cnonce=“40cab4cc”, nc=00000003
Expires: 600
Contact: sip:[email protected]
Content-Length: 0
[Dec 1 22:01:58] VERBOSE[26237] chan_sip.c:
<— SIP read from UDP:80.93.165.111:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.132:5060;branch=z9hG4bK15bd82e9;rport=61810
From: sip:[email protected];tag=as56e0e721
To: sip:[email protected];tag=F91aUKHDaHe4a
Call-ID: [email protected]
CSeq: 1309 REGISTER
User-Agent: numbergroup.com
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, precondition, path, replaces
WWW-Authenticate: Digest realm=“sip.numbergroup-services.com”, nonce=“556b2372-3c02-11e2-b292-03dda959c092”, stale=true, algorithm=MD5, qop="auth"
Content-Length: 0
<------------->
[Dec 1 22:01:58] VERBOSE[26237] chan_sip.c: — (11 headers 0 lines) —
[Dec 1 22:01:58] VERBOSE[26237] chan_sip.c: Responding to challenge, registration to domain/host name sip.numbergroup-services.com
[Dec 1 22:01:58] VERBOSE[26237] chan_sip.c: REGISTER 11 headers, 0 lines
[Dec 1 22:01:58] VERBOSE[26237] chan_sip.c: Reliably Transmitting (NAT) to 80.93.165.111:5060:
REGISTER sip:sip.numbergroup-services.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.132:5060;branch=z9hG4bK687936da;rport
Max-Forwards: 70
From: sip:[email protected];tag=as4ee9fa6e
To: sip:[email protected]
Call-ID: [email protected]
CSeq: 1310 REGISTER
User-Agent: FPBX-2.8.1(1.6.2.20)
Authorization: Digest username=“MyAccount”, realm=“sip.numbergroup-services.com”, algorithm=MD5, uri=“sip:sip.numbergroup-services.com”, nonce=“556b2372-3c02-11e2-b292-03dda959c092”, response=“cc6527ff1c6201bdc236e8d0e5325e12”, qop=auth, cnonce=“4d6643fa”, nc=00000001
Expires: 600
Contact: sip:[email protected]
Content-Length: 0
[Dec 1 22:01:58] VERBOSE[26237] chan_sip.c:
<— SIP read from UDP:80.93.165.111:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.132:5060;branch=z9hG4bK687936da;rport=61810
From: sip:[email protected];tag=as4ee9fa6e
To: sip:[email protected];tag=8j20D6ecyr29H
Call-ID: [email protected]
CSeq: 1310 REGISTER
Contact: sip:[email protected]:5060;expires=600
Date: Sat, 01 Dec 2012 21:59:17 GMT
User-Agent: numbergroup.com
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, precondition, path, replaces
Content-Length: 0
<------------->
[Dec 1 22:01:58] VERBOSE[26237] chan_sip.c: — (12 headers 0 lines) —
[Dec 1 22:01:58] VERBOSE[26237] chan_sip.c: Scheduling destruction of SIP dialog ‘[email protected]’ in 32000 ms (Method: REGISTER)
[Dec 1 22:01:58] NOTICE[26237] chan_sip.c: Outbound Registration: Expiry for sip.numbergroup-services.com is 300 sec (Scheduling reregistration in 285 s)
Can anyone give me any clues as to why the Asterisk SIP stack should randomly ignore the challenge in this way? I am sure that it must be somethong to do with the server configuration but I don’t know where to look. I am prety sure this is not a networking issue as the SIP messages are clearly received by the server as they can be seen in the debug, and also the trunk does register eventualy.
Any pointers would be greatly appreciated. I have searched the forum and not found anything like this on there. Hopefully somone out there can help me.
Thanks,
Colin.