[Freeswitch-users] How to configure Freeswitch for SIP over WebSocket behind server-side NAT?

Bernhard Wendel bernhard at zeppelindesk.com
Sun Jun 22 01:42:55 MSD 2014


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 at domain.tld>;tag=8a01krubf0
     To: 
<sip:a3352c35-7a6d-4c9e-aeea-1a5f74e90b6f at domain.tld>;tag=p2K9pvtH70Nmm
     Call-ID: l6ijpvvic6l1ung778sr
     CSeq: 6213 INVITE
     Contact: 
<sip:a3352c35-7a6d-4c9e-aeea-1a5f74e90b6f at 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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20140621/9a50bd89/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list