How to Install Asterisk on Ubuntu – Setting up Asterisk PBX
By expectus
Asterisk on Ubuntu
Asterisk is one of the most popular free telephony solutions available as it is very simple to setup, has great community support and can be customized for any application. It also features easy to use GUI interface.
This hub will go through setting up asterisk from the
packages instead of just downloading an already pre-made image of Asterisk like
AsteriskNOW , Tribox or systems similar.Asterisk on ubuntu guide goes through version 1.4 I belive 1.6 recently came out aswell as the changes to the packages.
Packages Required for Asterisk Installation
There are quite a few packages ubuntu will require in order to complete the installation of asterisk on ubuntu successfully, these include running kernel 2.6 of linux, and appropriate packages to execute C programs.
To install the required packages enter root mode using
Sudo su
Apt-get –y install linux-headers-$(uname -r) build-essential
automake autoconf bison flex libtool libncurses5-dev libssl-dev
subversion svn-buildpackage
apt-get –y install cvs build-essential automake autoconf bison flex libtool libncurses5-dev libssl-dev libgsm1 libgsm1-dev
apt-get –y install sysvconfig **required to start services**
Note: if packages fail to install try separating the packages and installing them individually.
Download Asterisk Packages
Goto Directory /usr/src/:
Cd /usr/src/
Downloading Packages through Ubuntu (type following in Ubuntu CLI)
wget http://downloads.digium.com/pub/zaptel/zaptel-1.4.12.1.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4.10.1.tar.gz
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.20.tar.gz
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-sounds-1.2.1.tar.gz
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-addons-1.4.7.tar.gz
Installation Steps
Extract Files – Configure each Package – Run Services
tar –xzf zaptel-1.4.12.1.tar.gz
tar –xzf libpri-1.4.10.1.tar.gz
tar -xzf asterisk-1.4.20.tar.gz
tar -xzf asterisk-sounds-1.2.1.tar.gz
tar -xzf asterisk-addons-1.4.7.tar.gz
- cd zaptel-1.4.12.1
- ./configure
- make
- make install
- make config
- service zaptel start
- cd ..
- cd libpri-1.4.10.1
- make
- make install
- cd ..
- cd asterisk-1.4.20
- ./configure
- make
- make install
- make samples
- make config
- cd ..
- cd asterisk-sounds
- make install
- cd ..
- cd asterisk-addons-1.4.7
- ./configure
- make
- make install
- service asterisk start
If asterisk fails to start try starting asterisk from
directory /etc/asterisk
Asterisk start
Setting up Sip Extensions
Now that asterisk is installed its time to create some users so that we can register ourselves on the asterisk server with a soft phone and then start to make calls over the network.
Edit the file /etc/asterisk/sip.conf
Using “nano /etc/asterisk/sip.conf” or “vim /etc/asterisk/sip.conf”
Copy the following into your sip.conf, If you can’t copy and paste try connecting to your server with Putty once you have installed openssl
[common](!) ; this is template.
type=friend
context=internal
host=dynamic
disallow=all
allow=ulaw
allow=alaw
allow=g723
allow=g729
dtmfmode=rfc2833
; [1000](common)
username=1000
secret=1000
; [1001](common)
username=1001
secret=1001
Here we have setup two users with extensions 1000 and 1001 , you can now registry your softphone with the server using these two extensions and secrets.
Remember to reload your asterisk server when changes have been made. Enter the command line “asterisk –r” and type “reload”
Setting up Dialplan’s so we can make Call’s
We cannot make calls until we have setup the dialplan file which will specify how a particular number shall be interpreted and where the call should be sent.
Edit sip.conf to look like the following
[internal]
exten=> _XXXX,1,Dial(SIP/${EXTEN})
The above diaplan specifies anyone that dials 4 digits e.g 1001 , the number one priority will be to Dial, the Sip extension 1001.
X refers to any number from 0 – 9
That’s it for the basic’s in setting up your Asterisk PBX server on ubuntu, next time I will go through creating trunk’s to reach the PBX , setting up ENUM and a few other things.
Asterisk Related Links
- Installing Asterisk NOW and Configuring Soft Phones - Setup a simple VOIP system at home or office
WIth the new AsteriskNOW its very simply to setup an Asterisk PBX (Private Branch Exchange) and make calls over your network for free. You can also link up Asterisk server to make calls over the PSTN (Public... - Random Technology Walkthroughs: Setup ENUM Server with Linux and Bind9
- Random Technology Walkthroughs: Setting up enumlookup Asterisk 1.4
- Random Technology Walkthroughs: How to Install Free Registry of Enum and Domains on Ubuntu Debian Li
Comments
thanks for the very encouraging comments dusanotes :) I am still pretty new to asterisk but its great to write a hub to help people get started using it. The book idea sounds great as there's a lack of good clear info on asterisk on the web :)
You surely have lots of informative hubs.
thanks ABTEODORO
This is great. I hadn't heard of Asterisk, but luckily I stumbled upon this awesome Hub. This is exactly the solution I need. Thanks!
thanks for the comment Carl :) glad you found it useful
Very clear and simple step to start the installation of Asterisk for new bigenners like me.
thanks Himanshu glad it helped you
Looks simple, will try it out, though i'm still new to Ubuntu. Any Words of advice?
its pretty straight forward really, just got to make sure all packages install properly or you'll have major problems when trying to run asterisk
Its really very well explained. I am waiting from so long for installing Asterisk on my Ubuntu system. Thanks, I found this hub really impressive and informative.In addition i appreciate for sharing web links too.
glad it helped you
Hi, I tried this but I got a few problems:
1- when trying to install sysvconfig I got error says sysvinit-utils can replace it, I have sysvinit-utils installed.
2- wget http://downloads.asterisk.org/pub/telephony/libpri was not found so I tried libpri-1.4.10.2.tar.gz and it was OK.
3- in /usr/src/zaptel-1.4.12.1 when I try "make" I get errors like:
/usr/src/zaptel-1.4.12.1/kernel/ztdummy.c:202: error: ‘struct hrtimer’ has no member named ‘expires’
make[3]: *** [/usr/src/zaptel-1.4.12.1/kernel/ztdummy.o] Error 1
make[2]: *** [_module_/usr/src/zaptel-1.4.12.1/kernel] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-2.6.31-21-generic'
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/src/zaptel-1.4.12.1'
make: *** [all] Error 2
4- make install shows the same errors too :(
5- when I try: service zaptel start
I get: ztcfg not executable
6- I tried the following commands with no errors but when I reached : service asterisk start
I got:
/etc/init.d/asterisk: 95: Bad substitution
*please can u help me? what's wrong? I installed all the packages well..
I remember having an error similar did you run
apt-get install update & upgrade
you have to make sure you system is up to date, let me know if that changes anything, and reinstall it again
Hi! Nice post, well explained. Lot's of things to learn from you dude.
@Reem
If having problems compiling zaptel on Ubuntu or Debian-like distributions you can try using module assistant, that would do it in an "easy way":
sudo apt-get install module-assistant
sudo m-a a-i zaptel
If still having problems, ignore zaptel 1.4.12.1 which seems it's a little bit tricky on some setups. Try grabbing a different version from SVN.
That link helped me a lot:
http://downloads.asterisk.org/pub/telephony/libpri
is not working... is there an alternative way to solve that problem ???
This was a great read! I'm starting a small office once my design firm takes off. Thanks to your article, I will have a solid solution for my sales reps.
Hi, I am completely new to both Ubuntu/Linux and Asterisk.
Tried to run "automake autoconf ..." and no input files were found (autoconf,bison, etc.). How do I get them?
Tks
Fernando
Solved that issue and was able to make it work! Tks for the great post!
On Reem's issue "95 Bad Distribution": doing the "Asterisk start" on etc/asterisk solved the issue for me. Rgs
Fernando
Perhaps you could use some pastebin or code type boxes? Just a suggestion. It's a bit confusing for someone who is a novice to CLI.
hello, thank you so much for this site it really helps me a lot. May God Bless YOU Always & YOur family TOo...
from: ferragamo
Hi, just came across your site, and enjoyed the simplicity. I will be trying this install, but had to comment after ready such great reviews. thanks for the great work, keep it up. After my system is up and running, I will update you all.
@Fernando , How did you resolve the "no input files were found" error.I am facing the same issue.
Great! thanks a lot but i have an issue, when y call between extensions 1000 and 1001 (using the examples) the server replyes
[Sep 26 15:11:48] NOTICE[16115]: chan_sip.c:14033 handle_request_invite: Call from '1001' to extension '1000' rejected because extension not found.
how can i resolve this any ideas?
@xhavick, The lines for the context,
[internal]
exten=> _XXXX,1,Dial(SIP/${EXTEN})
should be added in the file extensions.conf instead of sip.conf.
This should resolve the issue.
Hello all, how can i hide my cli?
These days you're better off installing something like Trixbox to get an Asterisk system up and running. I know a lot of hardcore phone guys that do high-end consulting and swear by Trixbox vs. configuring your system the old way via text files.
1) http://downloads.asterisk.org/pub/telephony/libpri
is not working... is there an alternative?????????
2) 3- in /usr/src/zaptel-1.4.12.1 when I try "make" I get errors like:
/usr/src/zaptel-1.4.12.1/kernel/ztdummy.c:202: error: ‘struct hrtimer’ has no member named ‘expires’
make[3]: *** [/usr/src/zaptel-1.4.12.1/kernel/ztdummy.o] Error 1
make[2]: *** [_module_/usr/src/zaptel-1.4.12.1/kernel] Error 2
make[2]: Leaving directory `/usr/src/linux-headers-2.6.31-21-generic'
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/src/zaptel-1.4.12.1'
make: *** [all] Error 2
tell me the solution of above mentioned problem
regards..
Casey, I totally disagree, having run Asterisk for many businesses (including my own) I can say that installing a minimal install of Linux (CentOS or Ubuntu work will) with and building your own config files will give you a more stable system than a GUI install.
@supergirl - Supergirl, try following this guide for Asterisk 10 on Ubuntu http://linuxmoz.com/ubuntu-asterisk-10-install-gui
@Teresa - Teresa if you start asterisk as a service you don't need to have the Asterisk console open (CLI). To do this type:
sudo /etc/init.d/asterisk restart
If it fails to start follow the guide in the link I posted above, hope that helps you two out :)
thank you very much
dusanotes 2 years ago
WOW! Expectus, you outdid yourself. I'm going to save this for future reference. Your mind is so far more advanced than mine, it's not even possible for me to stay up with you. But I'm going to try. This kind of material is valuable. Have you thought of cataloging it and sharing it in the form of a book? Neat stuff. Don White