How to configure Freeswitch for SIP over WebSocket behind server-side NAT?
Dear all, I have a FreeSWITCH server that lies behind a NAT on the server side. While usual SIP-Calls (using UDP) are working, I'm facing issues when it comes to the WebSocket Server. While specifying the external IP in the profile definition (<param name="ext-sip-ip" value="$${external_rtp_ip}"/>), on WebSocket the server sends the private instead of the public ip. The reverse proxying is done using nginx. As I didn't found an answer on the web, I hope you can help me! Here is a snippet of the ws communication (FreeSWITCH is answering the INVITE; 172.XX.42.1 is the private gateway and public nginx server; 172.XX.0.3 is the private IP the FreeSWITCH server uses): SIP/2.0 200 OK Via: SIP/2.0/WS ii6c2sdshbua.invalid;branch=z9hG4bK7579777;received=172.XX.42.1;rport=43567 From: <sip:13c0f2b0-b5b8-4822-afe6-38930cddc646@domain.tld>;tag=8a01krubf0 To: <sip:a3352c35-7a6d-4c9e-aeea-1a5f74e90b6f@domain.tld>;tag=p2K9pvtH70Nmm Call-ID: l6ijpvvic6l1ung778sr CSeq: 6213 INVITE Contact: <sip:a3352c35-7a6d-4c9e-aeea-1a5f74e90b6f@PUBLIC.IP:5060;transport=udp> User-Agent: FreeSWITCH-mod_sofia/1.3.4-n20140511T185316Z-1~trusty+1+git~20140509T214701Z~7e0995d069~64bit [...] o=FreeSWITCH 1403358295 1403358296 IN IP4 *172.XX.0.3* s=FreeSWITCH c=IN IP4 *172.XX.0.3* [...] a=ice-pwd:6MXY3JdpOCdmDT9W a=candidate:0823320109 1 udp 659136 *172.XX.0.3* 25176 typ host generation 0 The nginx proxy configuration looks like the following: location /sip { access_log off; proxy_pass http://172.XX.0.3:5066; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # WebSocket support (nginx 1.4) proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_redirect off; } What configuration options do I have to set, so that FreeSWITCH uses the public IP for candiate creation and all other occurences instead of the private one? Or is it easier to adjust nginx configuration to replace the IP? Kind regards Bernhard
Use ext-rtp-ip to fix that Sent from my iPhone
On Jun 21, 2014, at 4:42 PM, Bernhard Wendel <bernhard@zeppelindesk.com> wrote:
<param name="ext-sip-ip" value="$${external_rtp_ip}"/>
Hi Brian, that didn't helped. I already had that param in my configuration, but even when specifying the exact public IP, FreeSWICTCH still uses the private one on WebSocket. I even tried with agressive-nat-detection, but that didn't worked either. Here is the output of "sofia status profile internal" which shows the public IP in Ext-RTP-IP and Ext-SIP-IP: Dialplan XML Context public Challenge Realm auto_from RTP-IP 172.XX.0.3 Ext-RTP-IP 8X.XX.XX.XX SIP-IP 172.XX.0.3 Ext-SIP-IP 8X.XX.XX.XX URL sip:mod_sofia@8X.XX.XX.XX:5060 BIND-URL sip:mod_sofia@8X.XX.XX.XX:5060;maddr=172.XX.0.3;transport=udp,tcp WS-BIND-URL sip:mod_sofia@172.XX.0.3:5066;transport=ws HOLD-MUSIC local_stream://moh OUTBOUND-PROXY N/A Can someone please confirm, that the WS-BIND-URL looks correctly? Thanks Bernhard Am 22.06.2014 22:05, schrieb Brian West:
Use ext-rtp-ip to fix that
Sent from my iPhone
On Jun 21, 2014, at 4:42 PM, Bernhard Wendel <bernhard@zeppelindesk.com> wrote:
<param name="ext-sip-ip" value="$${external_rtp_ip}"/>
Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi all, after all, I found the problem. When I directly forward the WS connection (without nginx as reverse proxy), there are no issues at all. Using my first configuration, the IP FreeSWITCH saw as the originator of the ws connection was the Gateway-IP. With my current configuration FS sees the servers public IP which is enough to report the public IP. Will the X-Forwarded-For header be supported in the near future? Regards Bernhard Am 23.06.2014 18:48, schrieb Bernhard Wendel:
Hi Brian,
that didn't helped. I already had that param in my configuration, but even when specifying the exact public IP, FreeSWICTCH still uses the private one on WebSocket. I even tried with agressive-nat-detection, but that didn't worked either.
Here is the output of "sofia status profile internal" which shows the public IP in Ext-RTP-IP and Ext-SIP-IP:
Dialplan XML Context public Challenge Realm auto_from RTP-IP 172.XX.0.3 Ext-RTP-IP 8X.XX.XX.XX SIP-IP 172.XX.0.3 Ext-SIP-IP 8X.XX.XX.XX URL sip:mod_sofia@8X.XX.XX.XX:5060 BIND-URL sip:mod_sofia@8X.XX.XX.XX:5060;maddr=172.XX.0.3;transport=udp,tcp WS-BIND-URL sip:mod_sofia@172.XX.0.3:5066;transport=ws HOLD-MUSIC local_stream://moh OUTBOUND-PROXY N/A
Can someone please confirm, that the WS-BIND-URL looks correctly?
Thanks Bernhard
Am 22.06.2014 22:05, schrieb Brian West:
Use ext-rtp-ip to fix that
Sent from my iPhone
On Jun 21, 2014, at 4:42 PM, Bernhard Wendel <bernhard@zeppelindesk.com> wrote:
<param name="ext-sip-ip" value="$${external_rtp_ip}"/>
Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Bernhard Wendel
-
Brian West