Build Your Own PBX With Asterisk and Linux - Page 2

 By Paul Rubens
Page 2 of 2   |  Back to Page 1
Print Article

The next step is to compile the source code, starting with libpri, followed by DAHDI and DAHDI tools, and finally Asterisk itself.

To compile libpri, go to the command line and type:

# cd libpri-1.4.10
# make clean
# make install
# cd ..

Then compile DAHDI:

# cd dahdi-linux-2.2
# make all
#make install
#cd ..

When this is complete, compile and install DAHDI tools:

# cd dahdi-tools-2.0.0
# ./configure
# make
# make install
# make config
# cd ..

Finally, it's time to compile Asterisk.

# cd asterisk-
# make menuselect

This will bring up a text-based menu offering various modules that you can select to compile, as well as various other options. To prevent unnecessary error message while learning to use Asterisk, deselect pbx_ael . Save the changes by pressing x, then continue to:

# make
#make install
#make samples (to install sample config files which are useful when learning to configure Asterisk)
# make config

Finally, reboot the system.

When the system comes back up, Asterisk should start automatically. To check that everything is working, check DAHDI is loaded by opening a terminal window and, with root privileges, typing:

# lsmod | grep dahdi

You should see references to several dahdi modules, including dahdi_dummy, dahdi_transcode, crc_ccitt, and dahdi_voicebus.

Check Asterisk is running and log on to the Asterisk command line with:

#asterisk –r

You should see some version and license information along with a "Connected to Asterisk" message and prompt.

To stop asterisk from the Asterisk command line type

CLI> stop now

or from the Linux command prompt type

# service asterisk stop


Configuring an Asterisk system and getting it fully working is beyond the scope of this piece, but here are some pointers to get started.

When using Asterisk, calls are treated as having two parts: a call in to the Asterisk box, and another call out to its destination. Pairing these two calls so that you end up talking to the person you want to is handled by Asterisk's configuration files, which are mostly to be found in the /etc/asterisk/ directory.

To configure the system to handle calls to and from SIP devices (either physical SIP phones or software-based SIP softphones), the SIP devices first have to be registered in the relevant configuration file, which, logically enough, is called sip.conf. You can edit Asterisk’s many .conf files using any text editor, such as nano or gedit

You'll also have to edit the extensions.conf file to assign an extension number to that device. This tells Asterisk that when it receives a call for extension 6001, for example, it should make an outward call to connect to the appropriate phone. You can optionally add other behaviors, such as that a different phone extension, or perhaps the mailbox system, should be called if the first phone is not answered within a given period of time.

Confused? It’s inevitable really: it takes a while to get your head round the basics – which have barely been touched upon in this article - but if you persevere it all begins to make perfect sense surprisingly quickly.

If you want to learn more about how to configure your running Asterisk installation to make and receive calls, you’ll need to buy a book like Asterisk The Future of Telephony published by 0’Reilly, find an online tutorial, or – as mentioned earlier – go on a three day Asterisk Fast Start course.

Don’t expect to master Asterisk quickly, but also don’t forget that if you succeed you’ll be in a very good position to make some significant savings for your company.

This article was originally published on Sep 9, 2009
Get the Latest Scoop with Networking Update Newsletter