D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] SIP calls via Asterisk through NAT

 


On 10/09/2013 10:44, Gordon Henderson wrote:
On Tue, 10 Sep 2013, Rob Beard wrote:

Basically I'm wondering if we need to open ports in NAT for every IP phone or just Asterisk itself?

Just Asterisk. You can not/must not do every phone - they talk to the PBX. The PBX talks to the world.

You need to specify the port range in the router to match not only 5060 but the range of RTP ports you use. The default RTP range for Asterisk is 10000 through 20000. Remember you're forwarding UDP not TCP. Hope your router can (a) manage that huge range, and (b) doesn't overflow it's NAT translation table with many calls running.

You can change the RTP port range in rtp.conf (I've never bothered). You need port 5060 plus 2 RTP ports to establish a SIP call. The protocol is shite and not NAT friendly at all. SIP encoded the internal IP address of the end point into the data packet - so the remote end picks the data packet apart and finds 192.168.x.y or whatever. Great. Not.

You also need to tell Asterisk it's external IP address. This is not always needed, but it solves the above. Sometimes. Use the locanet= and externip= in sip.conf somewhere.

You *must* also turn off SIP-ALG support in the routers. Nearly all are broken and will get in your way.

If you have remote SIP phones, then your sip.conf file should take into account the fact they're running behind NAT, but it's less important for you and more important for the service sending you calls - they should do the right thing anyway.

Basically SIP and NAT is a PITA, but its solvable, however you'll not be able to do cool things (easilly) like media hand-off (where the media goes from the phone to the remote end, bypassing the PBX).

Good luck...

Gordon


Thanks Gordon,

I'll continue looking at the router settings. It's a Draytek Vigor 2820. I'll do a bit more investigation, it's not mission critical at the moment, I just keep confusing the poor folks who are answering the phones to a silent line :-P

Rob


--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq