login | register
Wed 09 of Jul, 2008 [07:36 UTC]

voip-info.org

History

tips

Created by: adla,Last modification on Tue 10 of Oct, 2006 [21:01 UTC] by kowalma
When sip is behind a NAT do not forget to specify:

in sip.conf

[general]
nat=yes
externip = X.X.X.X
fromdomain = yourdomain.com
localnet = 192.168.X.0/255.255.255.0
qualify=yes

The host specified by externip can be either a fully qualified domain name (FQDN) or an IP address.

For versions of Asterisk pre v1.2, the hostname associated with externip is only looked up when Asterisk startups up or if a 'sip reload' is executed.

You should also add qualify=yes (it wasn't said here before) if You don't add this line You won't be able to do or receive any SIP-call from behind NAT

Comments

Comments Filter
222

333Asterisk 1.2.7.1 -- Contact Binding header

by jzavala59, Friday 26 of October, 2007 [00:47:06 UTC]
Hello,
I am new to Asterisk and have a problem:
First my setup:
1.- Asterisk box (172.18.18.5) running on port 5061 is behind a Linksys router (172.18.18.2 on the LAN side, dynamic IP on the WAN side, I am using DynamicDNS).
2.- The Linksys does all the port forwarding to Asterisk
3.- I am using X-Lite softphones as clients and they succesfully register into Asterisk (I see the 200 OK).
4.- The problem is that I can't hear any sound. To test I dial *43 from the X-Lite and although it says connected and the server plays back the echo-test I do not hear anything (I telnet the Asterisk box to see the output in the asterisk*CLI).
5.- On an Ethereal trace I see this header after the INVITE when Asterisk sends a Status:100 Trying (1 bindings) packet to the client:
Contact: <sip:9978597@17.18.18.5:5061>
Contact Binding: <sip:9978597@172.18.18.5:5061>
  URI: <sip:9978597@172.18.18.5:5061>
      SIP contact address: sip:9978597@172.18.18.5:5061

The server is telling the client its internal IP instead of the public IP used by the Linksys (who is doing the NATing)
From this point forward the X-Lite uses this internal IP as the destination one to talk to the Asterisk box and of course it does not work.

During registration the server does send the WAN IP address of the Linksys as its address indicating NATing is working fine but for calls the problem mentioned above happens.

I have tried many ideas on the conf files, the last one is this (I use my real domain in mydomain.com):
externip = mydomain:5061
fromdomain = mydomain.com
localnet = 172.18.18.0/255.255.255.0
qualify=yes

No change, any idea please? is this a bug in Asterisk 1.2.7.1?
Thanks in advanced
222

333Re: Externip (NAT)

by mindfox, Friday 23 of February, 2007 [09:05:33 UTC]
Why do you need 2 exterips?
The externip is used only for NATed environments. Normally, the asterisk subnet should have access to your corporate network with simple routing and not by address translation. Are you sure that you need 2 externips instead of 2 localnets?

If you have more than one local networks, then you should add one "localnet" lines for each one of them. For your case:

localnet=10.180.201.0/255.255.255.0
localnet=10.5.0.0/255.255.255.0

Note: Please make sure that the netmask is valid for your networks (as I don't know how you have them configured)

222

333Externip (NAT)

by Flare, Thursday 01 of February, 2007 [19:25:51 UTC]
Please, someone knows how to add two externip? I have one connection to internet( IP: 200.X.X.X) and a corporative network(10.5.0.X). The asterisk has the 10.180.201.X ip.
Any idea?
Thanks.
222

333Externip (NAT)

by Flare, Thursday 01 of February, 2007 [19:24:18 UTC]
Please, someone knows how to add two externip? I have one connection to internet( IP: 200.X.X.X) and a corporative network(10.5.0.X). The asterisk has the 10.180.201.X ip.
Any idea?
Thanks.
222

333canreinvite

by perlmonkee, Thursday 15 of June, 2006 [18:00:35 UTC]
If you're still having problems, do not forget to play with the value for `canreinvite`.
222

333Re: externip with dynamic ip

by chandave, Thursday 30 of March, 2006 [05:18:36 UTC]
You can use a fully qualified domain name for the value of externip. I've updated the wiki page. There is a caveat about using hostnames.

See ya...

d.c.
222

333externip with dynamic ip

by joee, Thursday 30 of March, 2006 [04:29:19 UTC]
Is there an alternative to externip, possibly externhost where it does the dns lookup instead of having to specify an ip? I have a dynamic ip address. What I figure I can do is to have this:

sip.conf:
[...]
#include sip_nat.conf


sip_nat.conf:
nat = yes
fromdomain = host.dyndns
localnet = 192.168.1.0/255.255.255.0
#include sip_nat_externip.conf


sip_nat_externip.conf:
externip = 123.234.123.234


I can write a script to get the external ip and write it to sip_nat_externip.conf but I want to know if there's a better solution with dynamic ip's since I now have to figure out how to reload the config in asterisk when the ip changes.
222

333From a newbie

by ivanosito, Wednesday 02 of November, 2005 [05:20:16 UTC]
Is it for when I have an * server behind a Router and want to route calls from SIP clients located outside the Router, to, for example, an IAX server (also outside the router)?

If so, let me ask:

In "externip = X.X.X.X ", X.X.X.X would be the address my router has on its Internet port (WAN)?
In "fromdomain = yourdomain.com ", youdomain.com can be a no-ip or dyndns domain wich resoved to X.X.X.X ?

Thanks!