Hi,
I have the following pjsip.config. Server is behind NAT and Client is running on mobile phone.
[general]
context=internal
allowguest=no
allowoverlap=no
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5061
local_net=10.1.2.0/24
external_media_address=XX.XXX.XX.XX:5061
external_signaling_address=XX.XXX.XX.XX:5061
[auth200]
type=auth
username=200
password=XXXX
auth_type=userpass
[200]
type=aor
max_contacts=3
qualify_frequency=60
[200]
type=endpoint
context=internal
auth=auth200
aors=200
disallow=all
allow=ulaw,alaw
transport=transport-udp
direct_media=no
force_rport=yes
rewrite_contact=yes
rtp_symmetric=yes
ice_support=yes
<— Received SIP request (560 bytes) from UDP:49.37.203.219:35896 —>
REGISTER sip:sip.xxx.in:5061 SIP/2.0
Via: SIP/2.0/UDP 192.168.29.14:35896;branch=z9hG4bK-524287-1—9f6f01536956e22b;rport
Max-Forwards: 70
Contact: sip:200@192.168.29.14:35896;rinstance=19d6c5f15e105a46
To: "200"sip:200@sip.xxx.in:5061
From: "200"sip:200@sip.xxx.in:5061;tag=4f33e837
Call-ID: nwh-lXJYQsRgT2PWC-g02A…
CSeq: 20403 REGISTER
Expires: 600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, SUBSCRIBE, UPDATE, INFO, MESSAGE
Supported: path, replaces, timer, norefersub
User-Agent: SessionTalk 7.0.4
Content-Length: 0
<— Transmitting SIP response (517 bytes) to UDP:49.37.203.219:35896 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.29.14:35896;rport=35896;received=49.37.203.219;branch=z9hG4bK-524287-1—9f6f01536956e22b
Call-ID: nwh-lXJYQsRgT2PWC-g02A…
From: “200” sip:200@sip.xxx.in;tag=4f33e837
To: “200” sip:200@sip.xxx.in;tag=z9hG4bK-524287-1—9f6f01536956e22b
CSeq: 20403 REGISTER
WWW-Authenticate: Digest realm=“asterisk”,nonce=“1702479060/3ab18678e9b6ce2f0b68bf5bcf43248f”,opaque=“0c77b899300ceaa5”,algorithm=MD5,qop=“auth”
Server: Asterisk PBX 20.5.0
Content-Length: 0
<— Received SIP request (841 bytes) from UDP:49.37.203.219:35896 —>
REGISTER sip:sip.xxx.in:5061 SIP/2.0
Via: SIP/2.0/UDP 192.168.29.14:35896;branch=z9hG4bK-524287-1—1837fb668fa3df44;rport
Max-Forwards: 70
Contact: sip:200@192.168.29.14:35896;rinstance=19d6c5f15e105a46
To: "200"sip:200@sip.xxx.in:5061
From: "200"sip:200@sip.xxx.in:5061;tag=4f33e837
Call-ID: nwh-lXJYQsRgT2PWC-g02A…
CSeq: 20404 REGISTER
Expires: 600
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, SUBSCRIBE, UPDATE, INFO, MESSAGE
Supported: path, replaces, timer, norefersub
User-Agent: SessionTalk 7.0.4
Authorization: Digest username=“200”,realm=“asterisk”,nonce=“1702479060/3ab18678e9b6ce2f0b68bf5bcf43248f”,uri=“sip:sip.xxx.in:5061”,response=“414696efd290405718449cfa06502e5b”,cnonce=“72831051180d6d9a063ab60423063e8e”,nc=00000001,qop=auth,algorithm=MD5,opaque=“0c77b899300ceaa5”
Content-Length: 0
Added contact ‘sip:200@49.37.203.219:35896;rinstance=19d6c5f15e105a46;x-ast-orig-host=192.168.29.14:35896’ to AOR ‘200’ with expiration of 600 seconds
<— Transmitting SIP response (491 bytes) to UDP:49.37.203.219:35896 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.29.14:35896;rport=35896;received=49.37.203.219;branch=z9hG4bK-524287-1—1837fb668fa3df44
Call-ID: nwh-lXJYQsRgT2PWC-g02A…
From: “200” sip:200@sip.xxx.in;tag=4f33e837
To: “200” sip:200@sip.xxx.in;tag=z9hG4bK-524287-1—1837fb668fa3df44
CSeq: 20404 REGISTER
Date: Wed, 13 Dec 2023 14:51:00 GMT
Contact: sip:200@192.168.29.14:35896;rinstance=19d6c5f15e105a46;expires=599
Expires: 600
Server: Asterisk PBX 20.5.0
Content-Length: 0
<— Transmitting SIP request (467 bytes) to UDP:49.37.203.219:35896 —>
OPTIONS sip:200@49.37.203.219:35896;rinstance=19d6c5f15e105a46 SIP/2.0
Via: SIP/2.0/UDP 10.1.2.114:5061;rport;branch=z9hG4bKPj79d2a96d-baed-4843-af82-9978810f7f27
From: sip:200@10.1.2.114;tag=4dc16994-8a4d-4c5b-9a6c-23bde5b399d8
To: sip:200@49.37.203.219;rinstance=19d6c5f15e105a46
Contact: sip:200@10.1.2.114:5061
Call-ID: 347454dd-2228-4048-9ae1-acbc4acd7075
CSeq: 33927 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 20.5.0
Content-Length: 0
<— Received SIP response (593 bytes) from UDP:49.37.203.219:35896 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.1.2.114:5061;rport=5061;branch=z9hG4bKPj79d2a96d-baed-4843-af82-9978810f7f27;received=182.66.XXX.XX
Contact: sip:192.168.29.14:35896
To: sip:200@49.37.203.219;rinstance=19d6c5f15e105a46;tag=8566c618
From: sip:200@10.1.2.114;tag=4dc16994-8a4d-4c5b-9a6c-23bde5b399d8
Call-ID: 347454dd-2228-4048-9ae1-acbc4acd7075
CSeq: 33927 OPTIONS
Accept: application/sdp
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, SUBSCRIBE, UPDATE, INFO, MESSAGE
Supported: path, replaces, timer, norefersub
User-Agent: SessionTalk 7.0.4
Content-Length: 0
Endpoint 200 is now Reachable
Contact 200/sip:200@49.37.203.219:35896;rinstance=19d6c5f15e105a46;x-ast-orig-host=192.168.29.14:35896 is now Reachable. RTT: 99.616 msec
<— Transmitting SIP request (467 bytes) to UDP:49.37.203.219:35896 —>
OPTIONS sip:200@49.37.203.219:35896;rinstance=19d6c5f15e105a46 SIP/2.0
Via: SIP/2.0/UDP 10.1.2.114:5061;rport;branch=z9hG4bKPjafc5b326-4429-48fa-b946-a226b627d304
From: sip:200@10.1.2.114;tag=692c1e77-4570-4f4d-bf68-e83d3156e811
To: sip:200@49.37.203.219;rinstance=19d6c5f15e105a46
Contact: sip:200@10.1.2.114:5061
Call-ID: 732bd749-f0b8-4827-a91a-d4ced2a38feb
CSeq: 24345 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 20.5.0
Content-Length: 0
<— Received SIP response (593 bytes) from UDP:49.37.203.219:35896 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.1.2.114:5061;rport=5061;branch=z9hG4bKPjafc5b326-4429-48fa-b946-a226b627d304;received=182.66.XXX.XX
Contact: sip:192.168.29.14:35896
To: sip:200@49.37.203.219;rinstance=19d6c5f15e105a46;tag=51c3d67e
From: sip:200@10.1.2.114;tag=692c1e77-4570-4f4d-bf68-e83d3156e811
Call-ID: 732bd749-f0b8-4827-a91a-d4ced2a38feb
CSeq: 24345 OPTIONS
Accept: application/sdp
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, SUBSCRIBE, UPDATE, INFO, MESSAGE
Supported: path, replaces, timer, norefersub
User-Agent: SessionTalk 7.0.4
Content-Length: 0
<— Transmitting SIP request (466 bytes) to UDP:49.37.203.219:35896 —>
OPTIONS sip:200@49.37.203.219:35896;rinstance=19d6c5f15e105a46 SIP/2.0
Via: SIP/2.0/UDP 10.1.2.114:5061;rport;branch=z9hG4bKPjdc2d41d0-3356-4817-a51c-e130f8e4c73d
From: sip:200@10.1.2.114;tag=44a95ce2-404e-4e32-847c-492830b3d9ab
To: sip:200@49.37.203.219;rinstance=19d6c5f15e105a46
Contact: sip:200@10.1.2.114:5061
Call-ID: 93f02d98-eef4-47d5-bcd2-22591a739470
CSeq: 4853 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 20.5.0
Content-Length: 0
<— Transmitting SIP request (466 bytes) to UDP:49.37.203.219:35896 —>
OPTIONS sip:200@49.37.203.219:35896;rinstance=19d6c5f15e105a46 SIP/2.0
Via: SIP/2.0/UDP 10.1.2.114:5061;rport;branch=z9hG4bKPjdc2d41d0-3356-4817-a51c-e130f8e4c73d
From: sip:200@10.1.2.114;tag=44a95ce2-404e-4e32-847c-492830b3d9ab
To: sip:200@49.37.203.219;rinstance=19d6c5f15e105a46
Contact: sip:200@10.1.2.114:5061
Call-ID: 93f02d98-eef4-47d5-bcd2-22591a739470
CSeq: 4853 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 20.5.0
Content-Length: 0
<— Transmitting SIP request (466 bytes) to UDP:49.37.203.219:35896 —>
OPTIONS sip:200@49.37.203.219:35896;rinstance=19d6c5f15e105a46 SIP/2.0
Via: SIP/2.0/UDP 10.1.2.114:5061;rport;branch=z9hG4bKPjdc2d41d0-3356-4817-a51c-e130f8e4c73d
From: sip:200@10.1.2.114;tag=44a95ce2-404e-4e32-847c-492830b3d9ab
To: sip:200@49.37.203.219;rinstance=19d6c5f15e105a46
Contact: sip:200@10.1.2.114:5061
Call-ID: 93f02d98-eef4-47d5-bcd2-22591a739470
CSeq: 4853 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 20.5.0
Content-Length: 0
Endpoint 200 is now Unreachable
Contact 200/sip:200@49.37.203.219:35896;rinstance=19d6c5f15e105a46;x-ast-orig-host=192.168.29.14:35896 is now Unreachable. RTT: 0.000 msec