[Freeswitch-users] NAT between FS and remote SIP phone

mail-lists mail-lists at peachnet.com
Mon Apr 20 08:15:20 PDT 2009

> Hello
> I'd like to know how to set things up when using the following scenario:
> - a VoIP gateway on the same LAN as the Freeswitch to handle incoming calls
> from a POTS line
> - a remote SIP phone somewhere on the Net
> - the FS server and the remote SIP phone are both behind a NAT router
> - the remote SIP user either doesn't have the computer skills to map ports
> on his NAT router, or doesn't have access to it (eg. staying in a hotel or
> connecting to FS from a wifi connection @ Starbucks)
> The questions I have:
> 1. What ports need to be mapped on each router?
> 2. If I understood it correctly, UPnP is a technology that can open ports
> dynamically. Are there ways to tell if a router supports UPnP, are there
> other ways to have a remote SIP phone work right out of the box, or are
> there cases where mapping ports manually is the only way to get SIP/RTP to
> work?

I'm not very familiar with freeswitch but have been running several 
asterisk deployments for some years. Freeswitch might be much better at 
resolving NAT issues than asterisk - I don't know.

In my experience your asking for nothing but headaches to have both 
devices behind NAT. If at all possible put the FS server on a public IP 
and you'll get rid of 99% of your problems. Most phones, soft-phones 
support some sort of keep-alive facility which keeps the NAT ports open 
and allows FS to communicate to the device behind the 'client' NAT.

If you can't assign a public IP to FS, the next best thing is to forward 
the ports on YOUR router. For starters 5060 needs to be forwarded to the 
FS server as well as whatever RTP ports freeswitch and the phone will 
talk on. You'll have to look up which ports that is. I usually specify a 
range of UDP ports from 20000 -> 60000.

Again, FS might handle dual NAT situations a lot better than asterisk. 
(I see a lot of NAT and STUN options available for SOFIA). However,
I quickly came to the conclusion that having both server and client 
behind NAT results in a lot of kicking and screaming.

> 3. When a call comes from the POTS line and meant for the remote SIP
> extension... do RTP packets flow directly from the Linksys VoIP gateway to
> the remote SIP phone, or do they go through the FS server?

I THINK this depends on how you set it up. From what I understand you 
can have FS proxy the media (and handle codec negotiations, etc) if you 
so choose. If both endpoints (linksys  gateway and phone) support the 
same codec you should be able to set FS to drop out of the media path.

I can't tell you how to set this up as I'm just starting out with FS - 
but from just reading over the config files this seems easy and logical.

Take a looke here:


for a thousand different ways to configure sofia (sofia is the sip 
module in FS)

Perhaps one of the many experts here can give you a little more detailed 


More information about the FreeSWITCH-users mailing list