How To Install Asterisk For Your First PBX Solution

Want to support HowtoForge? Become a subscriber!
 
Submitted by vikaskumar2020 (Contact Author) (Forums) on Thu, 2009-08-20 10:53. :: Linux

How To Install Asterisk For Your First PBX Solution

Asterisk is one of the best telephony solutions which is free to use. There are others such as yate that provide same type of solutions and even more custom ones. Due to the easy of implementation Asterisk has become more popular than anything else. Asterisk is very easy to use and lots of open source and closed source panels provide a GUI for it.

 

Installation of asterisk server:

Pre-requites for asterisk installation:

Asterisk requires a system running with kernel 2.6 and the header files must be present to compile asterisk on our system. Asterisk is written in c; we require gcc with the supporting libs such as termcap, and openssl. Asterisk add-ons require the mysql header files so please install mysql lib, mysql client and the headers to compile asterisk-addons.

 

Download all files:

  1. Zaptel
  2. libpri
  3. asterisk
  4. asterisk-sounds
  5. asterisk-addones

 

Installation of asterisk:

Copy all the files to you server (I'm assuming you have copied all files to /usr/src/).

31 Steps for installing asterisk on your system:

  1. tar -xzf zaptel-1.4.12.1.tar.gz
  2. tar -xzf libpri-1.4.9.tar.gz
  3. tar -xzf asterisk-1.4.20.tar.gz
  4. tar -xzf asterisk-sounds-1.2.1.tar.gz
  5. tar -xzf asterisk-addons-1.4.7.tar.gz
  6. cd zaptel-1.4.12.1
  7. ./configure
  8. make
  9. make install
  10. make config
  11. service zaptel start
  12. cd ..
  13. cd libpri-1.4.9
  14. make
  15. make install
  16. cd ..
  17. cd asterisk-1.4.20
  18. ./configure
  19. make
  20. make install
  21. make samples
  22. make config
  23. cd ..
  24. cd asterisk-sounds
  25. make install
  26. cd ..
  27. cd asterisk-addons-1.4.7
  28. ./configure
  29. make
  30. make install
  31. service asterisk start

If all above comands run well then we have installed a new asterisk server on our system.

 

Creating first sip extension:

Please add the following lines to sip.conf (/etc/asterisk/sip.conf):

[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

[1002](common)
username=1002
secret=1002

[1003](common)
username=1003
secret=1003

[1004](common)
username=1004
secret=1004

Above we have created 5 extensions that can be used any sip client (xlite,cisco sip phone, ATA). All users will get registered. If it does not work then check out the firwall settings. Please disable those settings until setup is completed.

 

Creating first Dialplan:

No extension can talk to each other unless we configure its dial plan. We have to open extension.conf (/etc/asterisk/extension.conf). Add the following lines:

[internal]
exten=> _XXXX,1,Dial(SIP/${EXTEN})

Now all configured phones can talk. This makes asterisk a simple platform in PBX; not many skills are required to develop an office PBX.

 

Creating first Sip trunk:

Asterisk can make outbound and inbound calls, for outbound we require a provider to terminate our calls and to get calls routed to our system so for that we need a public IP.

Add following code to sip.conf:

[trunk]
type=friend
context=internal
host=<providers IP>
disallow=all
allow=ulaw
allow=alaw
allow=g723
allow=g729
dtmfmode=rfc2833

After the update our sip.conf looks as follows:

[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

[1002](common)
username=1002
secret=1002

[1003](common)
username=1003
secret=1003

[1004](common)
username=1004
secret=1004

[trunk]
type=friend
context=internal
host=<providers IP>
disallow=all
allow=ulaw
allow=alaw
allow=g723
allow=g729
dtmfmode=rfc2833

Now you have to add one line to extension.conf:

exten => _XXXXXXX.,1,Dial(SIP/trunk1/${EXTEN})

So our extension.conf looks like:

[internal]
exten=> _XXXX,1,Dial(SIP/${EXTEN})
exten => _XXXXXXX.,1,Dial(SIP/trunk1/${EXTEN})

With the above settings it is simple to create an IP-PBX with outbound trunk.

For any queries write us: Gventure.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Rich.Cooper (not registered) on Fri, 2012-10-12 14:16.

I dont think that all this worth the trouble.

Switch PBX and you do not have to do all this... I use Ozeki Phone System XE that has a perfect, and simple graphical user interface that allows me to configure things easily.

Here is where you can get started:  http://www.ozekiphone.com/what-is-asterisk-341.html

regards,

richard

Submitted by Rohith (not registered) on Thu, 2013-01-17 15:24.
I got really simple method to install asterisk and conect two softphones and make calls, without all this fuzz.

Give a look at http://rohu.in/easiest-way-to-install-asterisk-and-make-calls-between-two-voip-phones/
Submitted by Anonymous (not registered) on Sat, 2013-10-12 05:56.

Hi,

 The url is not working. Kindly update the url or delete the post.

Submitted by Anonymous (not registered) on Sat, 2009-08-22 05:27.
the download link for libpri-1.4.9 does not exist any longer at the location specified = http://downloads.digium.com/pub/libpri/libpri-1.4.9.tar.gz looks like u need to grab 1.4.10.1 @ http://downloads.digium.com/pub/libpri/libpri-1.4.10.1.tar.gz
Submitted by Andrew Z (not registered) on Fri, 2009-08-21 22:21.

I implemented Asterisk on Linux at a 25-person non-profit as a simple PBX where I was "the [only] IT guy."  It worked great!

Then I went to a big non-profit (2000 employees around the world) with a 50-seat call center.  This place loves Microsoft (maybe because of the 90% non-profit discount) and buys everything MS makes.  Unfortunately I couldn't recommend Asterisk over the current, expensive system (CIC by I3) because CIC actually works very well: easy for others to administer via GUI (I prefer CLI), nice reporting, ACD email, existing customization investments, reasonably well supported by many companies, etc etc. 

I say this even after a catastrophic server failure which I believe would have been much less painful on a Linux platform (compared to MS Windows 2003).

 I hope Asterisk fills this space!

Submitted by Anonymous (not registered) on Sat, 2009-08-22 09:32.
Instead of making all this from scratch there are ready solutions for asterisk such as trixbox or elastix.
Submitted by Peter (not registered) on Thu, 2009-08-20 15:31.
Wonderful document. Well explained in step by step procedure.Thanks for sharing such a useful information.
Submitted by Leonardo (not registered) on Thu, 2009-08-20 14:37.

Nice Post, i will try that for sure.

Submitted by Matt Riddell (not registered) on Thu, 2009-08-20 11:27.

Zaptel actually isn't recommended anymore as it has been replaced by DAHDI in May this year:

 http://blogs.digium.com/2008/05/19/zaptel-project-being-renamed-to-dahdi/

It's more than just a renaming - all development is continuing in this branch and there are quite significant changes such as file names and locations.