Difference between revisions of "Asterisk"

From LinuxMCE
Jump to: navigation, search
(NAT and Dynamic IP: -> qualify setting for phone lines)
(NAT and Dynamic IP)
 
Line 12: Line 12:
 
== NAT and Dynamic IP ==
 
== NAT and Dynamic IP ==
  
If you do not use LinuxMCE as a firewall/router directly connected to the internet, but use a NAT-router inbetween (for example for security reasons or if you do not want your internet connection to rely on your home-automation-system), there are some errors that occure.
+
If you do not use LinuxMCE as a firewall/router directly connected to the internet, but use a NAT-router inbetween (for example for security reasons or if you do not want your internet connection to rely on your home-automation-system), there are some errors that occur.
  
 
The problem is, that in SIP communication the IP-Address to connect to as well as the port is being reportet by the asterisk server when registering with the sip-provider. But as the Asterisk server cannot know the external (internet) IP and the NAT router traverses the sender port, the address and port reported by Asterisk to the SIP provider are wrong. Some SIP providers compensate for this by recognizing diffences between the reported address and port within the sip packet and the sending address and port, and use the later.
 
The problem is, that in SIP communication the IP-Address to connect to as well as the port is being reportet by the asterisk server when registering with the sip-provider. But as the Asterisk server cannot know the external (internet) IP and the NAT router traverses the sender port, the address and port reported by Asterisk to the SIP provider are wrong. Some SIP providers compensate for this by recognizing diffences between the reported address and port within the sip packet and the sending address and port, and use the later.

Latest revision as of 05:24, 27 April 2008

How does it work?

On the LinuxMCE Admin page: Wizard/Devices/Core check the box for "Asterisk". This will install both the Asterisk pbx software, and also the LinuxMCE Asterisk DCE Device, which is just a thin wrapper that passes messages/events between LinuxMCE and Asterisk making the two appear seamlessly integrated.

When you check that box, it also adds a few more pages to the LinuxMCE Admin web site where you can configure your phone system, choose voicemail options and so on. Each of those pages has their own context-sensitive help. You will not need to touch Asterisk's configuration files--they are maintained automatically by the LinuxMCE Asterisk DCE Device.

The IP-based telephones that LinuxMCE supports are all plug-and-play, such as the Snom 200. Just plug the phone into any jack and all the Orbiters will display a message to let you know that your new phone has been detected.

To configure your phone you may use AMP (Asterisk Management Portal) which is included in LinuxMCE-admin site

I already know Asterisk

We use Ubuntu's package of asterisk with few addons and custom packaged AMP. If you already have your own Asterisk installation running, you should be able to run the LinuxMCE Asterisk DCE Device against it.

NAT and Dynamic IP

If you do not use LinuxMCE as a firewall/router directly connected to the internet, but use a NAT-router inbetween (for example for security reasons or if you do not want your internet connection to rely on your home-automation-system), there are some errors that occur.

The problem is, that in SIP communication the IP-Address to connect to as well as the port is being reportet by the asterisk server when registering with the sip-provider. But as the Asterisk server cannot know the external (internet) IP and the NAT router traverses the sender port, the address and port reported by Asterisk to the SIP provider are wrong. Some SIP providers compensate for this by recognizing diffences between the reported address and port within the sip packet and the sending address and port, and use the later.

If your provider does not, you have to add a port-forwarding of the defined sip-port (by default 5060) from the external ip in the router to your asterisk server and add the following into a file /etc/asterisk/sip_nat.conf:
externip=my.external.ip.address
externhost=myhost.dyndns.org
localnet=192.168.80.0/255.255.255.0
The localnet is the network, where your ip-phones are, so asterisk knows where to use its own ip-address instead of the internet wide.


If additionally you have an internet provider that does not assign you a static IP address and maybe even forces your internet connection to be canceled every 24 hours and assigns you a different dynamic IP address you should register with a dynamic-dns-provider, so everytime you reconnect, a dns-record is generated with your IP and you have to forward the sip-port as well and write to the file /etc/asterisk/sip_nat.conf something like this:
externip=myhost.dyndns.org
externhost=myhost.dyndns.org
externrefresh=5
localnet=192.168.80.0/255.255.255.0

This way, the external host's ip-adress is refreshed and checked for changes every 5 minutes.

Additionally I recommend setting for your phone-lines
qualify=10

This has to be done in the /etc/asterisk/sip_additional.conf (Warning: It will be overwritten by the wizard-skripts !!!). This makes asterisk check the connection of the line every 10 seconds with a SIP-Options-Packet, so that connection-losses and reconnection will not go undetected and also to keep the udp-session open in some nat-routers.

Additional Information

VoIP-Wiki and Forum

The Asterisk Documentation Project

Asterisk-Guru

IP-Phone-Forum (German)

Asterisk-Buch (German)