How to Install Asterisk on Ubuntu (extensions only)
Monday, July 5, 2010 9:02:36 AM
1) IMPORTANT!! MUST CHECKOUT SOURCE CODES FROM ASTERISK SVN MANUALLY!! DO NOT
USE ANY PRE-COMPILED PACKAGES!! (change to the latest version if needed).
# svn checkout http://svn.digium.com/svn/asterisk/trunk asterisk
# svn checkout http://svn.digium.com/svn/zaptel/branches/1.4 zaptel
# svn checkout http://svn.digium.com/svn/libpri/branches/1.4 libpri
2) Apt-get install packages for compilation & others.
# apt-get install linux-headers-$(uname -r) build-essential ...
3) tar & make & make install the three packages!!
=> for zaptel: tar, ./configure, make, make install, make config.
=> for libpri: tar, ./configure, make, make install.
=> for asterisk: tar, ./configure, make, make install,
make samplles, make config.
4) Edit /etc/asterisk/sip.conf to define internal extensions:
[1234]
username=1234
type=friend
secret=12345678
qualify=yes
nat=yes
host=dynamic
dtmfmode=rfc2833
context=internal
canreinvite=no
5) Add the following lines to /etc/asterisk/extensions.conf to enable
internal extensions:
; User defined
[internal]
exten => _X.,1,Dial(SIP/${EXTEN})
; for the specific extension: 6.
exten => 6,1,Dial(SIP/${EXTEN})
6) Fireup Asterisk!!!
# asterisk -vvv &
7) Reload Asterisk if configuration is modified:
# asterisk -r
localhost*CLI>reload
8) Firewall rules for Asterisk
#Asterisk
# SIP on UDP port 5060. Other SIP servers may need TCP port 5060 as well
iptables -A INPUT -p udp -m udp --dport 5060 -j ACCEPT
# IAX2- the IAX protocol
iptables -A INPUT -p udp -m udp --dport 4569 -j ACCEPT
# IAX - most have switched to IAX v2, or ought to
iptables -A INPUT -p udp -m udp --dport 5036 -j ACCEPT
# RTP - the media stream
iptables -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT
# MGCP - if you use media gateway control protocol in your configuration
iptables -A INPUT -p udp -m udp --dport 2727 -j ACCEPT
9) Startup commands for Asterisk in rc.local (not workable...)
# asterisk
# /etc/init.d/zaptel start
# /usr/sbin/asterisk -f
Therefore, manually start Asterisk via asterisk -vvv & is still needed...
REFERENCES:
http://hubpages.com/hub/How-to-Install-Asterisk-on-Ubuntu-Setting-up-Asterisk-
PBX
http://www.asterisk.org/developers/get-source
http://i-yow.blogspot.com/2008/10/sip-serverasterisk.html
Asterisk firewall rules
http://www.voip-info.org/tiki-index.php?page=Asterisk+firewall+rules
http://www.asteriskguru.com/tutorials/extensions_conf.html
USE ANY PRE-COMPILED PACKAGES!! (change to the latest version if needed).
# svn checkout http://svn.digium.com/svn/asterisk/trunk asterisk
# svn checkout http://svn.digium.com/svn/zaptel/branches/1.4 zaptel
# svn checkout http://svn.digium.com/svn/libpri/branches/1.4 libpri
2) Apt-get install packages for compilation & others.
# apt-get install linux-headers-$(uname -r) build-essential ...
3) tar & make & make install the three packages!!
=> for zaptel: tar, ./configure, make, make install, make config.
=> for libpri: tar, ./configure, make, make install.
=> for asterisk: tar, ./configure, make, make install,
make samplles, make config.
4) Edit /etc/asterisk/sip.conf to define internal extensions:
[1234]
username=1234
type=friend
secret=12345678
qualify=yes
nat=yes
host=dynamic
dtmfmode=rfc2833
context=internal
canreinvite=no
5) Add the following lines to /etc/asterisk/extensions.conf to enable
internal extensions:
; User defined
[internal]
exten => _X.,1,Dial(SIP/${EXTEN})
; for the specific extension: 6.
exten => 6,1,Dial(SIP/${EXTEN})
6) Fireup Asterisk!!!
# asterisk -vvv &
7) Reload Asterisk if configuration is modified:
# asterisk -r
localhost*CLI>reload
8) Firewall rules for Asterisk
#Asterisk
# SIP on UDP port 5060. Other SIP servers may need TCP port 5060 as well
iptables -A INPUT -p udp -m udp --dport 5060 -j ACCEPT
# IAX2- the IAX protocol
iptables -A INPUT -p udp -m udp --dport 4569 -j ACCEPT
# IAX - most have switched to IAX v2, or ought to
iptables -A INPUT -p udp -m udp --dport 5036 -j ACCEPT
# RTP - the media stream
iptables -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT
# MGCP - if you use media gateway control protocol in your configuration
iptables -A INPUT -p udp -m udp --dport 2727 -j ACCEPT
9) Startup commands for Asterisk in rc.local (not workable...)
# asterisk
# /etc/init.d/zaptel start
# /usr/sbin/asterisk -f
Therefore, manually start Asterisk via asterisk -vvv & is still needed...
REFERENCES:
http://hubpages.com/hub/How-to-Install-Asterisk-on-Ubuntu-Setting-up-Asterisk-
PBX
http://www.asterisk.org/developers/get-source
http://i-yow.blogspot.com/2008/10/sip-serverasterisk.html
Asterisk firewall rules
http://www.voip-info.org/tiki-index.php?page=Asterisk+firewall+rules
http://www.asteriskguru.com/tutorials/extensions_conf.html






