HOW TO SETUP ASTERISK@HOME
NOTE: This article was written for Tom's Hardware, but was never
published
on their website. Therefore, we decided to release it.
How to set-up a simple, IP-based PBX (private branch exchange)
Have you ever wanted one of those nifty office telephone systems? You know, with
extensions, your very own receptionist, voicemail for every cubicle, an intercom
system and all the other bells and whistles. Unfortunately, a typical office
PBX (private branch exchange) that would provide those features costs thousands
of dollars to get up and running - and that's one of the cheaper
solutions.
What if you could do almost as much for virtually nothing? Interested? It's
called Asterisk, an open-source, fully-loaded and surprisingly scalable software
PBX solution. In this article, we'll walk you through setting up a basic
Asterisk installation, as well as show you a couple of tweaks that we found
useful. If this sounds daunting, don't worry, we'll spoon-feed
you ever step of the way.
The final result will be your very own IP-based PBX that will allow anyone
on your LAN (if authorized) to be given a telephone extension and voicemail
inbox, make and receive calls from within or without your LAN - with
nothing but a VoIP line, a microphone and a pair of headphones. Of course,
when you are done with the basic setup, feel free to add hardware VoIP phones,
POTS (analog) phones, a digital receptionist and numerous other amenities to
your SOHO telephone solution.
Ready to begin?
What you'll need
Basically, a crummy computer with Ethernet as your server, and a networked
computer with a microphone and speakers or VoIP phone for every "extension" / "virtual
phone outlet" you plan on having.
You'll also need at least one blank CD and a computer capable of burning
CDs, as well as a functioning LAN with a router or an equivalent internet connection
sharing solution.
Finally, you'll need any VoIP provider that supports SIP termination
or IAX/IAX2 protocols (these can be extremely cheap). We used VOIPjet (http://www.voipjet.com/),
but BroadVoice is also supposed to be excellent.
Tom's Hardware used this as our server.


For testing (client / "extension") machines, we used a Compaq
Evo n610c clocked at 2.0ghz with 768mb of RAM, and a typical P4 grey-box with
nothing special.
Part 1: Acquiring the Asterisk@Home CD-ROM image.
First, you'll have to download the Asterisk@Home image, and burn it to
disc. Asterisk at home is essentially the Asterisk software PBX packaged with
Linux in an easy-to-install installaion CD-ROM.
You can get the version we used (1.4) here: http://prdownloads.sourceforge.net/asteriskathome/asteriskathome-1.4.iso?download.
Any of the newer versions should also be fine, most contain a few bug fixes.
For the very latest version, visit: http://sourceforge.net/projects/asteriskathome/.
Select a mirror and download the 459.771 MB (approx.) file.

Once that's done, burn the image to a disc using your favorite CD Burning
software. We used NERO (http://www.nero.com/).



Part 2: Installing the Operating System with Asterisk
Pop the CD you just burnt into the "crummy" machine that will act
as your PBX server. Turn on the computer, having ensured it is set to boot
off the CD before any other media (such a IDE Hard Drives).

When prompted for user input, simply press ENTER and the automated installation
will begin.

Depending on how crummy your computer actually is, this could take a while.
Don't be scared by what you might see on the monitor, it's probably
normal.


Once "Anaconda" starts running, amongst other things, it will
proceed to format your file system.

Then, it will copy the installation files onto the freshly formatted hard
drive.

It will also install the appropriate packages required for the Asterisk@Home
PBX software.

The machine should automatically eject the installation disc. Remember to
remove the disc from the CD-ROM drive bay before rebooting.

Once rebooted, you should see the following boot menu. You don't actually
have to press anything, it will default to the correct Operating System after
a few seconds.

As soon as it loads CentOS, it will continue with the Asterisk@Home installation.
You should see lots of text like this,

or like this,

or even like this,

and it's all a normal part of the installation.
Once the installation is complete, continue to the next section to configure
the OS.
Part 3: Configuring the Operating System
At the login screen, log into CentOS with the following credentials:
login root
password password
Ignore any "mail" CentOS may claim you have.

First, change the root password to something a little more secure than password.
The root password gives unrestricted access to the operating system (analogous
to an administrator password on a Windows OS). To change the root password,
type passwd and hit ENTER.
You'll have to enter a password twice, and
it won't show up on the screen as you type. If nothing went wrong, it
should say All authentication tokens updated successfully.
Next, configure the IP address of the server by typing netconfig and hitting
ENTER.

Input your desired network settings. The IP address should be on the same
subnet as your router and all computers and VoIP phones you will be using in
your IP-based PBX solution.

If you aren't exactly sure what all these settings mean, try this out:
ensure that the first three "sections" (the groups of numbers separated
by periods) of the IP address are the same as those on our other, networked
computers and router. As well, you will probably use a Netmask of 255.255.255.0,
and your Default Gateway and Primary Nameserver (DNS server) are likely the
IP address of your router.
We do not recommend using dynamic IP configuration (BOOTP/DHCP) unless you
are 100% certain that your DHCP/BOOTP server will never give out a different
IP address to your server. Therefore, ensure that Use dynamic IP configuration
(BOOTP/DHCP) is unchecked.
Confirm the selections by pressing OK, and that should bring you back to the
Linux console.
Next, we have to change the other passwords from their default, insecure settings.
We'll start with the Maintenance Password for the Asterisk web configuration
interface. To change the password, type passwd-maint and hit ENTER. As with
the root password, you'll have to enter it in twice and it won't
show up on screen as you type it in.

Now we'll change the AMP Password. For simplicity's sake, we suggest
using the same password for both the AMP Password and Maintenance Password,
just make sure it's a fairly strong/secure password. Use the command
passwd-amp.
Then, change the MeetMe Password using the command passwd-meetme.
Finally, change the *nix System Password using the command passwd
admin - no
dash between the two words. This password should be unique and very strong/secure.
Now, ensure the computer is plugged into the internet and reboot the machine.
This will apply all the settings we have just changed, including the IP configuration.
Use the command reboot (then press ENTER).
Part 4: Configuring Asterisk
Once it boots up successfully, you shouldn't ever have to physically
touch the server again (unless something goes very wrong). Henceforth, configuration
of the PBX server will be done remotely, from any other computer on the network.
Either we'll be using Asterisk's built in web configuration interface,
or we'll "SSH in" to gain terminal/console access to the
machine.
For now, we will begin with the web based control panel. Launch your favourite
browser and enter your PBX server's IP address as the URL. Select Asterisk
Management Portal from the menu. An authentication dialog box should appear.
Enter main as the user name and your Maintenance/AMP password as the password.

You should now be in the AMP (Asterisk Management Portal) Control
Panel. Click
on Maintenance and that should bring you to the Asterisk@Home system status
page. Make sure everything says running. If anything doesn't, reboot
and try again.

Next, click Setup at the top right. Click extensions on the left to set-up
each telephone extension number.

For initial testing purposes, Tom's Hardware recommends setting up a
minimum of two extensions, and using the password "1234" for both
voicemail and PBX authentication.

You can leave the other options at their defaults for now. Then click the "Add
Extension" button at the bottom of the page.

Repeat this procedure and add a second extension. Now you should have two extensions,
we have one for a user named "John Doe" and we made another one
for "Jane Doe". We strongly recommend that you add all extensions
you can anticipate having to use, because it will be much harder to add new
extensions later.
Once all your extensions have been added, click the red bar at the top to
apply the changes.

At this point, your two extensions should be functioning over your very own
IP-based PBX (private branch exchange). That means Jane Doe should able to
communicate with John Doe over your network.
Part 5: Getting a Softphone Working - X-Lite
In order to test the functionality of your new PBX, you either need a special
VoIP based telephone or software that emulates one. We opted for the latter
while testing, and used X-lite Softphone.
You can get it here: http://www.xten.com/index.php?menu=X-Series
Run the installer, and once it's installed launch the program. You may
be brought through an audio tuning wizard, don't worry this is normal.
Just ensure that your microphone and speakers are plugged in and ready for
use before completing the audio-tuning wizard.
Next, you will see the X-lite interface appear and a configuration menu should
also have appeared. If it doesn't show up, click on the button directly
above the number 3 on the keypad (this is the menu button). Click System
Settings then SIP Proxy then Default. That should bring you to this screen, unless you
were already there from the start.

Enter the appropriate settings into each field. It's worth noting that
SIP Proxy and Domain should be the address of your PBX server.
To confirm your selection, click "back" at the bottom and close
the menu. Now you should be back at the main X-lite screen. Dial "*65" and
press enter. You should hear a voice announce your extension number.

Repeat this process of configuring X-lite for all extensions on all computers
that you will be using. If you only have one testing computer, you can only
test one extension at a time. To test a second extension, simply change the
X-lite Default settings for each computer, using the appropriate extension
and password (i.e. Jane Doe's extension is 201, as opposed to John Doe's
which was 200).
Once you have two or more computers and extensions set-up with X-lite, try
phoning another computer by dialing the other computer's extension number
and pressing enter. You can also try leaving messages on the other's
person's voicemail account if they don't pick up in time. Asterisk
can even be configured to send an email notification every time someone leaves
a message.
If everything is working, it's time to set-up external calling.
Part 6: Setting up External Calling using VoIP
For outgoing calls, or incoming external calls, you need to either purchase
hardware that connects the PBX server to an analog phone line, or be subscribed
to a VoIP provider. Tom's Hardware opted for the latter, as it is far
less expensive.
There are several providers to choose from, but we recommend VoIPJet (http://www.voipjet.com/)
for testing purposes because it's extremely inexpensive. However, it
doesn't allow you to receive incoming external calls - it is outgoing
only, since you don't get assigned a phone number. Broadvoice (http://www.broadvoice.com/)
is a little more expensive, but allows you to make both incoming and outgoing
external calls since they assign you a unique telephone number. In fact, you
can use any VoIP provider that supports SIP or IAX/IAX2 protocols with Asterisk.
If you are impatient, the good news about most VoIP providers is that they
give you nearly instant access after signing up. We had our VoIPJet account
up and running in less than thirty minutes after first visiting their website.
To configure outgoing calling, open up your favorite browser and browse to
your PBX Server's IP address once again. In the AMP, the same place where
you set-up the extensions, on the left, click Outbound Routing.

If there are any existing routes (at the top right), click them. Then, in
the Edit Route page, hit the Delete Route link which is right underneath the
Edit Route text.

Click the red bar at the top to apply the changes.
Next, on the left, select Trunks. Do not delete
the existing trunks yet. Here is where VoIPJet and Broadvoice differ: VoIPJet
is IAX/IAX2, whereas Broadvoice
is SIP. If you are using VoIPJet, click add
IAX2 trunk, if you are using Broadvoice,
click add SIP trunk.

If you are using VoIPJet or an IAX/IAX2 provider, that should bring you to
the following page.

On this page, you will have to configure outgoing dialing options. Firstly,
replace 514 with your local area code, or it will mess up outgoing calls. Fill
in the appropriate settings as shown. Leave the incoming settings (not shown
in the screenshot) blank, only if using VOIPjet. All of the information that
you are inputting on this page should be provided by your VoIP provider (VOIPJet,
Broadvoice, etc.).
You can use the following image as a model for your settings.

Submit the changes, and then, as before, click the red bar at the top to apply
the changes.
Now, click the ZAP trunk at the top right. On the Edit
Trunk page, click the
Delete Trunk link.

As before, click the red bar at the top to apply the changes.
Part 7: Setting up External Calling using VoIP (cont'd)
Once again, on the left, click Outbound Routing. That should bring you back
to this page. If not, click the route that you added previously (just before
creating the trunk) at the top right, just under the text Add Route.

Fill in the information as shown in the screenshot, replacing 514 with your
local area code. The 011 allows you to call internationally, the 1514 allows
you to call within the 514 area code, the NXXNXXXXXX lets you dial any other
area code, then NXXXXXX lets you dial a local number without having to input
a local area code.

Click Submit Changes. As usual, click the red bar at the top to apply the changes.
This was the last time we will use the web based control panel, as it is not
powerful enough to access certain options and has problems modifying select
configuration files. At this point, we again strongly urge you to add any extensions
that you anticipate using, because it will be much more complicated to do without
the web-based control panel. Unfortunately, any changes made without the web-based
control panel will be overwritten and lost retroactively if, subsequently,
you use the web-based control panel to modify any settings.
In short, if you have to, use the web-based control panel now (for the last
time), or risk losing any settings you make manually hereafter.
Part 8: Advanced Settings and Configuration (via SSH)
We will now be using SSH to configure the PBX server. We recommend using Putty (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html), which
is freeware.
Download the Putty executable. Make sure you save it somewhere; do not Run
from location, as what you are downloading is not an installation file, but
the entire program itself. Open Putty by double clicking the file you downloaded.
Enter your PBX server's IP address and click on SSH as per the screenshot
below.

Click Open. You may be prompted about a security certificate. Ignore it and
click Yes. Login with the following credentials:
username root
password <whatever you set as your *nix password earlier>
You should see a screen like this:

We will be modifying different configuration files with the VI text editor.
Unfortunately, the VI text editor is not exactly easy to use. It is essential
that you follow the few sets of instructions very precisely, as pressing just
one wrong keystroke can muddle everything up.
If you are familiar with *nix operating systems, we
have also included a ZIP file which you can get here. It contains the configuration files we used, which
are more or less the same as what you'll find in the screenshots.
We'll start by editing SIP.CONF.
Type in cd/etc/asterisk then press ENTER to move to the asterisk directory.
Next, type in vi sip.conf and press ENTER to launch the VI text editor.

Once VI is open, press a (don't press enter). This readies the file
for editing.
You should now be able to modify the file in much the same way as you would
with any very basic text editor.

Modify the file as per this image, replacing 192.168.1.254 with your PBX server's
IP address:

When you are done, press ESCAPE then type ZZ (all capitals, and don't
press enter). This will save the changes and exit the VI text editor.
Now we will repeat this process for the file SIP_ADDITIONAL.CONF.
Next, type in vi sip_additional.conf and press ENTER to launch the VI text
editor.
Once VI is open, press a (don't press enter). This readies the file for
editing.
Modify the file as per this image. Keep in mind that if you have more extensions,
or named your extensions differently (i.e. you didn't use the names John
and Jane Doe) you will have to adapt the settings to your particular set-up.

When you are done, press escape, then type "ZZ" (all capitals,
no quotes, and don't press enter), this will save the changes and exit
the VI text editor.
Now we will repeat this process for the file VM_EMAIL.INC.
Next, type in vi vm_email.inc and press ENTER to launch the VI text editor.
Once VI is open, press a (don't press enter). This readies the file for
editing.
You should see a blob of text and code. All that you have to modify is this
one snippet:

Replace 192.168.1.254 with your PBX server's IP address. Again, when
you are done, press escape, then type "ZZ" (all capitals, no quotes,
and don't press enter), this will save the changes and exit the VI text
editor.
Finally, type in asterisk -r and press ENTER to access the Asterisk
console.
Next, type in restart now and press ENTER.

This will reboot the server and all changes made to the configuration files
will now take effect. Remember not to use the web-based control panel to modify
any settings or you will lose any changes you made manually to the configuration
files.
Part 9: Conclusion
That should be it! One neat thing about the way we configured it is that you
don't actually have to be on the same network as the PBX server to
connect to it.
That means that if Jane Doe goes on vacation to Singapore, and she has internet
access in her hotel and she brought her laptop, she could connect to her PBX
back at home over the internet. That way, she can make a call to John Doe's
extension as though she were in the same office building - even though
she might be thousands of kilometers away. Furthermore, even from Singapore,
she could still make long distance calls using her PBX Server's VoIP
account! Just don't forget to open up ports 5060 and 10000 to 20000 in order
for this to work over the internet!
Of course, Asterisk is loaded with more features beyond the scope of this
DO-IT-YOURSELF guide. With a little more effort, you can interface the PBX
Server to analog telephones and telephone lines, set-up a "digital receptionist" and
much more.
For more information, check out the Asterisk@Home website at http://asteriskathome.sourceforge.net/.
A special thanks to Michael Soares, for all of his support and advanced troubleshooting.
Without his effort, problems wouldn't have been solved, documentation
wouldn't have been understood, and much of this article couldn't
have been written.
If you have any questions and/or comments, please submit them to Mike's e-mail
address: me[at]mikesoares[dot]com
ARTICLE BY: ALEX BLANK