I have two clients in Sandboxes on Windows 10 machines in a local network behind a router. First client is Linphone (client A) and second client is ZoiPer (client B), so the clients A and B are behind NAT. Also I have Linphone (client C), ZipPer (client D) and PortSIP (client F) on my Android mobile phone connected to the internet over 4G (so there is no NAT). The server is in the Docker container with default network configuration with all the ports mapped to the host.
I am not an expert in the area of networking. I am familiar with the basic things like IP tables, routing, NAT, TCP, UDP, and I do not understand all these options well enough, but fortunately everything started to work when I added the following to endpoints configuration:
media_address = developernote.com
rtp_symmetric = yes
direct_media = no
rewrite_contact = yes
force_rport = yes
ice_support = yes
I hear hello-world sound from all the clients and all the clients can call each other and talk to each other, see my new blog post for details and full confiugations. Also see the logs: A call from client C (1001) to client A(1002), A call from client B (1003) to client C (1003).
So basically everything works, except one thing: when I call in the reverse direction from client A(1002) to client C (1001) the client C does not accept the call, see the log:
<--- Received SIP request (1202 bytes) from UDP:91.122.37.167:60224 --->
INVITE sip:1001@developernote.com SIP/2.0
Via: SIP/2.0/UDP 172.28.33.149:5060;branch=z9hG4bK.oToGYJ3yg;rport
From: <sip:morpheus@developernote.com>;tag=tpOU6t7m3
To: sip:1001@developernote.com
CSeq: 20 INVITE
Call-ID: ~YSoeIdCOX
Max-Forwards: 70
Supported: replaces, outbound, gruu, path, record-aware
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, PRACK, UPDATE
Content-Type: application/sdp
Content-Length: 539
Contact: <sip:morpheus@91.122.37.167:60224;transport=udp>;+org.linphone.specs="lime"
User-Agent: Linphone-Desktop/5.2.6 (6f734bd0-54ba-4970-a73f-452bb5e8f241) windows/10 Qt/5.15.2 LinphoneSDK/5.3.72
v=0
o=morpheus 1747 1089 IN IP4 172.28.33.149
s=Talk
c=IN IP4 172.28.33.149
t=0 0
a=rtcp-xr:rcvr-rtt=all:10000 stat-summary=loss,dup,jitt,TTL voip-metrics
a=record:off
m=audio 51886 RTP/AVP 96 97 98 0 8 18 101 99 100
a=rtpmap:96 opus/48000/2
a=fmtp:96 useinbandfec=1
a=rtpmap:97 speex/16000
a=fmtp:97 vbr=on
a=rtpmap:98 speex/8000
a=fmtp:98 vbr=on
a=fmtp:18 annexb=yes
a=rtpmap:101 telephone-event/48000
a=rtpmap:99 telephone-event/16000
a=rtpmap:100 telephone-event/8000
a=rtcp-fb:* trr-int 1000
a=rtcp-fb:* ccm tmmbr
<--- Transmitting SIP response (468 bytes) to UDP:91.122.37.167:60224 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.28.33.149:5060;rport=60224;received=91.122.37.167;branch=z9hG4bK.oToGYJ3yg
Call-ID: ~YSoeIdCOX
From: <sip:morpheus@developernote.com>;tag=tpOU6t7m3
To: <sip:1001@developernote.com>;tag=z9hG4bK.oToGYJ3yg
CSeq: 20 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1739385758/30b4ee26aa7347d97a82879e410717be",opaque="54d9b6794678f7fe",algorithm=MD5,qop="auth"
Server: Asterisk PBX 22.2.0
Content-Length: 0
<--- Received SIP request (359 bytes) from UDP:91.122.37.167:60224 --->
ACK sip:1001@developernote.com SIP/2.0
Via: SIP/2.0/UDP 172.28.33.149:5060;branch=z9hG4bK.oToGYJ3yg;rport
Call-ID: ~YSoeIdCOX
From: <sip:morpheus@developernote.com>;tag=tpOU6t7m3
To: <sip:1001@developernote.com>;tag=z9hG4bK.oToGYJ3yg
Contact: <sip:morpheus@91.122.37.167:60224;transport=udp>;+org.linphone.specs="lime"
Max-Forwards: 70
CSeq: 20 ACK
Probably it is something specific to Linphone desktop client (A) that does not work behind NAT while ZoiPer desktop client (B) works.
Also when I add
use_avpf = yes
the clients can’t call each other at all and I got the following logs:
<--- Received SIP request (1211 bytes) from UDP:176.15.165.103:18674 --->
INVITE sip:1003@developernote.com SIP/2.0
Via: SIP/2.0/UDP 13.160.171.146:49167;branch=z9hG4bK.vsV6mfo5o;rport
From: <sip:neo@developernote.com>;tag=ksAWZdGPO
To: sip:1003@developernote.com
CSeq: 20 INVITE
Call-ID: rpYumD5CL~
Max-Forwards: 70
Supported: replaces, outbound, gruu, path, record-aware
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, PRACK, UPDATE
Content-Type: application/sdp
Content-Length: 549
Contact: <sip:neo@13.160.171.146:49167;transport=udp>;expires=3599;+org.linphone.specs="lime"
User-Agent: LinphoneAndroid/5.2.5 (A54 пользователя Dmitry) LinphoneSDK/5.3.47 (tags/5.3.47^0)
v=0
o=neo 2288 389 IN IP4 13.160.171.146
s=Talk
c=IN IP4 13.160.171.146
t=0 0
a=rtcp-xr:rcvr-rtt=all:10000 stat-summary=loss,dup,jitt,TTL voip-metrics
a=record:off
m=audio 40489 RTP/AVP 96 97 98 0 8 18 101 99 100
a=rtpmap:96 opus/48000/2
a=fmtp:96 useinbandfec=1
a=rtpmap:97 speex/16000
a=fmtp:97 vbr=on
a=rtpmap:98 speex/8000
a=fmtp:98 vbr=on
a=fmtp:18 annexb=yes
a=rtpmap:101 telephone-event/48000
a=rtpmap:99 telephone-event/16000
a=rtpmap:100 telephone-event/8000
a=rtcp:48215
a=rtcp-fb:* trr-int 1000
a=rtcp-fb:* ccm tmmbr
<--- Transmitting SIP response (466 bytes) to UDP:176.15.165.103:18674 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 13.160.171.146:49167;rport=18674;received=176.15.165.103;branch=z9hG4bK.vsV6mfo5o
Call-ID: rpYumD5CL~
From: <sip:neo@developernote.com>;tag=ksAWZdGPO
To: <sip:1003@developernote.com>;tag=z9hG4bK.vsV6mfo5o
CSeq: 20 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1739390212/e676c2b34b1c9d09105abf0156c941a2",opaque="58a0bf35256b5484",algorithm=MD5,qop="auth"
Server: Asterisk PBX 22.2.0
Content-Length: 0
<--- Received SIP request (365 bytes) from UDP:176.15.165.103:18674 --->
ACK sip:1003@developernote.com SIP/2.0
Via: SIP/2.0/UDP 176.15.165.103:18674;branch=z9hG4bK.vsV6mfo5o;rport
Call-ID: rpYumD5CL~
From: <sip:neo@developernote.com>;tag=ksAWZdGPO
To: <sip:1003@developernote.com>;tag=z9hG4bK.vsV6mfo5o
Contact: <sip:neo@176.15.165.103:18674;transport=udp>;expires=3599;+org.linphone.specs="lime"
Max-Forwards: 70
CSeq: 20 ACK
<--- Received SIP request (1493 bytes) from UDP:176.15.165.103:18674 --->
INVITE sip:1003@developernote.com SIP/2.0
Via: SIP/2.0/UDP 13.160.171.146:49167;branch=z9hG4bK.qEvnwQs0c;rport
From: <sip:neo@developernote.com>;tag=ksAWZdGPO
To: sip:1003@developernote.com
CSeq: 21 INVITE
Call-ID: rpYumD5CL~
Max-Forwards: 70
Supported: replaces, outbound, gruu, path, record-aware
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, PRACK, UPDATE
Content-Type: application/sdp
Content-Length: 549
Contact: <sip:neo@13.160.171.146:49167;transport=udp>;expires=3599;+org.linphone.specs="lime"
User-Agent: LinphoneAndroid/5.2.5 (A54 пользователя Dmitry) LinphoneSDK/5.3.47 (tags/5.3.47^0)
Authorization: Digest realm="asterisk", nonce="1739390212/e676c2b34b1c9d09105abf0156c941a2", algorithm=MD5, opaque="58a0bf35256b5484", username="neo", uri="sip:1003@developernote.com", response="8ff3f0330e4cbde0ee0d8a0d18493fe1", cnonce="~4anhCiuV~2ah9jf", nc=00000001, qop=auth
v=0
o=neo 2288 389 IN IP4 13.160.171.146
s=Talk
c=IN IP4 13.160.171.146
t=0 0
a=rtcp-xr:rcvr-rtt=all:10000 stat-summary=loss,dup,jitt,TTL voip-metrics
a=record:off
m=audio 40489 RTP/AVP 96 97 98 0 8 18 101 99 100
a=rtpmap:96 opus/48000/2
a=fmtp:96 useinbandfec=1
a=rtpmap:97 speex/16000
a=fmtp:97 vbr=on
a=rtpmap:98 speex/8000
a=fmtp:98 vbr=on
a=fmtp:18 annexb=yes
a=rtpmap:101 telephone-event/48000
a=rtpmap:99 telephone-event/16000
a=rtpmap:100 telephone-event/8000
a=rtcp:48215
a=rtcp-fb:* trr-int 1000
a=rtcp-fb:* ccm tmmbr
<--- Transmitting SIP response (292 bytes) to UDP:176.15.165.103:18674 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 13.160.171.146:49167;rport=18674;received=176.15.165.103;branch=z9hG4bK.qEvnwQs0c
Call-ID: rpYumD5CL~
From: <sip:neo@developernote.com>;tag=ksAWZdGPO
To: <sip:1003@developernote.com>
CSeq: 21 INVITE
Server: Asterisk PBX 22.2.0
Content-Length: 0
[Feb 12 19:56:52] e[1;31mERRORe[0m[34]: e[1;37mres_pjsip_session.ce[0m:e[1;37m946e[0m e[1;37mhandle_incoming_sdpe[0m: neo: Couldn't negotiate stream 0:audio-0:audio:sendrecv (nothing)
<--- Transmitting SIP response (346 bytes) to UDP:176.15.165.103:18674 --->
SIP/2.0 488 Not Acceptable Here
Via: SIP/2.0/UDP 13.160.171.146:49167;rport=18674;received=176.15.165.103;branch=z9hG4bK.qEvnwQs0c
Call-ID: rpYumD5CL~
From: <sip:neo@developernote.com>;tag=ksAWZdGPO
To: <sip:1003@developernote.com>;tag=db96d465-c127-4fed-bbee-9fd85d86e04d
CSeq: 21 INVITE
Server: Asterisk PBX 22.2.0
Content-Length: 0
<--- Received SIP request (384 bytes) from UDP:176.15.165.103:18674 --->
ACK sip:1003@developernote.com SIP/2.0
Via: SIP/2.0/UDP 176.15.165.103:18674;branch=z9hG4bK.qEvnwQs0c;rport
Call-ID: rpYumD5CL~
From: <sip:neo@developernote.com>;tag=ksAWZdGPO
To: <sip:1003@developernote.com>;tag=db96d465-c127-4fed-bbee-9fd85d86e04d
Contact: <sip:neo@176.15.165.103:18674;transport=udp>;expires=3599;+org.linphone.specs="lime"
Max-Forwards: 70
CSeq: 21 ACK
Also, as you can see, there are the following error messages in the logs even when the calls are successful:
PJ ICE Rx error status code: 370400 'Bad Request'.
are they critical?