Question on SIP Client Registration with VOIP Trunk

Dear All

First of all, thanks so much in advance for helping me. I am new on Asterisk and my English is not good (I am living in Hong Kong). I will try my best to explain the problem. Kindly let me know if you need any other information for my case. Thanks.

I have an VPS server running with CentOS 6.6 (Final) version and my Asterisk version is “Asterisk/11.11.0”. The server was built on Public IP and behind the firewall. I have configured the firewall to open all the necessary udp ports (5060, 5061, 10000~20000).

Before I add a VOIP trunk to my server. Everything was fine. 4 SIP Extensions can be connected to the server through Internet without any problem. However, the problem occurred after I added the VOIP trunk. The trunk registered successfully but some SIP extensions cannot be connected to the server. I have checked the information from CLI. The SIP client (Android Zoiper) didn’t respond the 401 Unautherized challenge after I added the trunk. I tried to remove the trunk. The SIP extensions can be connected again. I can see the challenge respond from SIP client.

I have spent few days to search but I couldn’t find anything. May I seek for your help to provide me some hints for checking? Thanks so much for your help.

Best Regards
Thomas YU

Please find below supplement:

Trunk Register Successfully:

REGISTER sip:210.99.89.80 SIP/2.0
Via: SIP/2.0/UDP 211.112.1.88:5060;branch=z9hG4bK1905fd17;rport
Max-Forwards: 70
From: <sip:8523XXXXXX@210.99.89.80>;tag=as25adbfaf
To: <sip:8523XXXXXX@210.99.89.80>
Call-ID: 6df06e106ed7341655fa90e328f21121@211.112.1.88
CSeq: 266 REGISTER
User-Agent: Asterisk PBX
Authorization: Digest username="8523XXXXXX", realm="huawei", algorithm=MD5, uri="sip:sip:huawei.com", nonce="7f31b3862c6bced071e7c0fd409d303a", response="8e90619b6f62eb7ae7e2a79bbc8bf21d"
Expires: 120
Contact: <sip:s@211.112.1.88:5060>
Content-Length: 0

<--- SIP read from UDP:210.99.89.80:5060 --->
SIP/2.0 401 Unauthorized
From: <sip:8523XXXXXX@210.99.89.80>;tag=as25adbfaf
To: <sip:8523XXXXXX@210.99.89.80>;tag=c2c58153
CSeq: 266 REGISTER
Call-ID: 6df06e106ed7341655fa90e328f21121@211.112.1.88
Via: SIP/2.0/UDP 211.112.1.88:5060;branch=z9hG4bK1905fd17;rport=5060
WWW-Authenticate: Digest realm="huawei", nonce="ca1b56e160c53f31c6011d284d036e06",domain="sip:huawei.com", stale=false,algorithm=MD5
Content-Length: 0

REGISTER sip:210.99.89.80 SIP/2.0
Via: SIP/2.0/UDP 211.112.1.88:5060;branch=z9hG4bK1b676a89;rport
Max-Forwards: 70
From: <sip:8523XXXXXX@210.99.89.80>;tag=as25adbfaf
To: <sip:8523XXXXXX@210.99.89.80>
Call-ID: 6df06e106ed7341655fa90e328f21121@211.112.1.88
CSeq: 267 REGISTER
User-Agent: Asterisk PBX
Authorization: Digest username="8523XXXXXX", realm="huawei", algorithm=MD5, uri="sip:sip:huawei.com", nonce="ca1b56e160c53f31c6011d284d036e06", response="251060203f26f5df7d997bdcd795544d"
Expires: 120
Contact: <sip:s@211.112.1.88:5060>
Content-Length: 0

<--- SIP read from UDP:210.99.89.80:5060 --->
SIP/2.0 200 OK
From: <sip:8523XXXXXX@210.99.89.80>;tag=as25adbfaf
To: <sip:8523XXXXXX@210.99.89.80>;tag=6605fb25
CSeq: 267 REGISTER
Call-ID: 6df06e106ed7341655fa90e328f21121@211.112.1.88
Via: SIP/2.0/UDP 211.112.1.88:5060;branch=z9hG4bK1b676a89;rport=5060
Contact: <sip:8523XXXXXX@211.112.1.88:5060;user=phone>;expires=120
Content-Length: 0

Android Zoiper Client couldn’t register after added the trunk:

REGISTER sip:mysipdomain.com;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 111.222.53.175:39681;branch=z9hG4bK-524287-1---443535f8adeb7059;rport
Max-Forwards: 70
Contact: <sip:6000@111.222.53.175:39681;rinstance=4c4bbb7bbe612558;transport=UDP>
To: <sip:6000@mysipdomain.com;transport=UDP>
From: <sip:6000@mysipdomain.com;transport=UDP>;tag=67627279
Call-ID: C2U83-iQT3PW2dquqU7JuQ..
CSeq: 6 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
User-Agent: Zoiper r29851
Allow-Events: presence, kpml
Content-Length: 0

<--- Transmitting (NAT) to 111.222.53.175:39681 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 111.222.53.175:39681;branch=z9hG4bK-524287-1---443535f8adeb7059;received=111.222.53.175;rport=39681
From: <sip:6000@mysipdomain.com;transport=UDP>;tag=67627279
To: <sip:6000@mysipdomain.com;transport=UDP>;tag=as3b299f26
Call-ID: C2U83-iQT3PW2dquqU7JuQ..
CSeq: 6 REGISTER
Server: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="237a78df"
Content-Length: 0

Android Zoiper Client can be registered without VOIP trunk:

<--- SIP read from UDP:111.222.53.175:56682 --->
REGISTER sip:mysipdomain.com;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 111.222.53.175:56682;branch=z9hG4bK-524287-1---6fb233a4fd0b4d5d;rport
Max-Forwards: 70
Contact: <sip:6000@111.222.53.175:56682;rinstance=064e6ef7996c7575;transport=UDP>
To: <sip:6000@mysipdomain.com;transport=UDP>
From: <sip:6000@mysipdomain.com;transport=UDP>;tag=400e6306
Call-ID: QnihAnqb1DEXIrus0Npejg..
CSeq: 1 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
User-Agent: Zoiper r29851
Allow-Events: presence, kpml
Content-Length: 0

<--- Transmitting (NAT) to 111.222.53.175:56682 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 111.222.53.175:56682;branch=z9hG4bK-524287-1---6fb233a4fd0b4d5d;received=111.222.53.175;rport=56682
From: <sip:6000@mysipdomain.com;transport=UDP>;tag=400e6306
To: <sip:6000@mysipdomain.com;transport=UDP>;tag=as41853ff4
Call-ID: QnihAnqb1DEXIrus0Npejg..
CSeq: 1 REGISTER
Server: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="309ac8d4"
Content-Length: 0

<--- SIP read from UDP:111.222.53.175:56682 --->
REGISTER sip:mysipdomain.com;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 111.222.53.175:56682;branch=z9hG4bK-524287-1---45218ce0082429e3;rport
Max-Forwards: 70
Contact: <sip:6000@111.222.53.175:56682;rinstance=064e6ef7996c7575;transport=UDP>
To: <sip:6000@mysipdomain.com;transport=UDP>
From: <sip:6000@mysipdomain.com;transport=UDP>;tag=400e6306
Call-ID: QnihAnqb1DEXIrus0Npejg..
CSeq: 2 REGISTER
Expires: 60
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
User-Agent: Zoiper r29851
Authorization: Digest username="6000",realm="asterisk",nonce="309ac8d4",uri="sip:mysipdomain.com;transport=UDP",response="2084e3b6e881ad1bc29f4057ab05f11b",algorithm=MD5
Allow-Events: presence, kpml
Content-Length: 0

<--- SIP read from UDP:111.222.53.175:56682 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 210.99.89.80:5060;branch=z9hG4bK462e8c65;rport=5060
Contact: <sip:111.222.53.175:56682>
To: <sip:6000@111.222.53.175:56682;rinstance=064e6ef7996c7575;transport=UDP>;tag=e5438317
From: "asterisk" <sip:asterisk@210.99.89.80>;tag=as31b5b010
Call-ID: 45dc513339fbffc90baa73a36512bf45@210.99.89.80:5060
CSeq: 102 OPTIONS
Accept: application/sdp, application/sdp
Accept-Language: en
Allow: INVITE, ACK, CANCEL, BYE, NOTIFY, REFER, MESSAGE, OPTIONS, INFO, SUBSCRIBE
Supported: replaces, norefersub, extended-refer, timer, outbound, path, X-cisco-serviceuri
User-Agent: Zoiper r29851
Allow-Events: presence, kpml
Content-Length: 0

<--- SIP read from UDP:111.222.53.175:56682 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 210.99.89.80:5060;branch=z9hG4bK16e024b8;rport=5060
Contact: <sip:111.222.53.175:56682>
To: <sip:6000@111.222.53.175:56682;rinstance=064e6ef7996c7575;transport=UDP>;tag=a72ecb39
From: "asterisk" <sip:asterisk@210.99.89.80>;tag=as2f555d78
Call-ID: 527869630e436dfb4d672b107ae2bcc6@210.99.89.80:5060
CSeq: 102 NOTIFY
User-Agent: Zoiper r29851
Content-Length: 0

Thanks.

Dear All

I have performed quite number of testing in the past few days and I found a tricky thing. When the SIP Trunk successfully registered, some Extensions will not be able to connect to server with Error 401 Unauthorized. When the SIP Trunk failed registered, the extensions can be connected again. This really make me crazy …

:cry:

401 is not an error. It is normal stage in the registration process. If the registering device doesn’t proceed beyond the 401, it means it does not know how to authenticate itself.

Thanks david55.

I know 401 is normal registration process. I just absolutely no idea that why the SIP client can response the authentication challenge when the SIP trunk was not registered but the same SIP Client cannot response it when the SIP trunk was registered. :cry: :cry: :cry: