You are on page 1of 4

Asterisk PBX Installation

Adam Vartanian, Hassan Ajmal October 10, 2006

Overview

In this lab, we installed and congured Asterisk, an open source software PBX system. Asterisk is dual-licensed under both the GPL and a proprietary license under which GPL-incompatible code may be combined. Though we will not use them in this lab, Asterisk provides many advanced features, such as voicemail, interactive menus, and interserver communication. In this lab, we installed Asterisk, congured it, and used it to route calls between soft and hard phones.

Installation
Download source archive at http://ftp.digium.com/pub/asterisk/asterisk1.2-current.tar.gz Unpack archive make make install make samples

Installing Asterisk is straightforward.

Asterisk Conguration

Asterisk is congured through the use of conguration les stored in the /etc/asterisk directory. Conguration les are organized into sections, which are delimited by brackets, and then a set of instructions of the type either marker => instruction or name=value There are two steps to conguring Asterisk for our environment: conguring the SIP accounts, and conguring the extensions. To congure the accounts, one must edit the sip.conf le. There is a section called general, which denes how the SIP server should act, and then a set of sections whose names are the accounts and whose values are specic to those accounts. The le we used is shown below 1

[general] port=5060 bindaddr=192.168.0.1 context=default [BOB] type=friend secret=12345 host=dynamic mailbox=2345,1234 [JOE] type=friend secret=12345 host=dynamic mailbox=123345,4745 [FRED] type=friend secret=12345 host=dynamic mailbox=1764,34745

Each account may also have a transport=tcp line added to force interaction to be performed over TCP instead of the default of UDP. The information about the dened extensions is kept in the extensions.conf le. By default, the le contains a large number of sample rules, which we left in place. We also added several rules of the form exten => (extension),(priority),(action), where the extension is the extension to dial, the priority is the order in which rules should be executed, and the action is what action to take. Actions for our purpose are in the form of Dial(information), though many other actions are implemented, such as transferring to other systems, recording voicemail, or playing a message. To congure the extensions, we rst added rules for dialing each phone individually. exten => 5566,1,Dial(SIP/JOE) exten => 5567,1,Dial(SIP/BOB) exten => 5568,1,Dial(SIP/FRED) Here, all we have is extensions which ring the specied phone. Next, we added rules to support forking. To perform parallel forking, we set the action to Dial(SIP/JOE&SIP/FRED), which makes the phones associated with both JOE and FRED ring until one picks one up. To perform serial forking, we provide a timeout to the rst action, then provide a second action with another priority which rings the second phone, which will occur when the rst action times out. exten => 5600,1,Dial(SIP/JOE&SIP/FRED) 2

exten => 5561,1,Dial(SIP/JOE,10) exten => 5561,2,Dial(SIP/FRED) While these features are fairly well documented in the Asterisk handbook, more advanced features are not covered well at all, and nding the handbook on Asterisks website can be dicult. Its also important to note that no spaces are allowed in the action specications. After conguration, starting Asterisk is as simple as performing asterisk -vvvc, where the v options indicate that Asterisk should be especially verbose, and the c option indicates that it should provide a console and not detach from the controlling terminal. At the console, several commands are useful, most especially the sip [no] debug command, which turns on or o SIP debugging messages. These messages include all incoming and outgoing SIP packets, and are especially helpful in investigating conguration problems.

Soft Phone Conguration - SJPhone

We tested the SIP proxy using the SJPhone available from http://www.sjlabs.com/sjp.html, which works on Windows, Linux, and Mac OS X. To congure it to use our Asterisk server was comparitively simple. We went into the preferences dialog, went to the Proles tab, and added a new prole of the Calls through SIP Proxy type. In the prole setup, we added the proxy address and port to the SIP Proxy tab. Then, we simply switched to that prole in the preferences dialog, and the phone connected after prompting us for our username and password.

Hard Phone Conguration - Grandstream

For hard phones, we rst set up the Grandstream phone. All of the phones conguration is done through the phone itself, which is a very poor interface for setting complex conguration parameters such as usernames and passwords. To access the settings, you push the center button in the directional button area of the phone, which is very counterintuitive. At that point, you scroll down to the Settings menu item and select it. The particular settings needed to get the phone working were in the Network and SIP sections of the phone. For network settings, we needed to provide the IP address and netmask. For the SIP settings, we needed to provide the SIP proxy, outbound proxy, display name, authentication name, and password. For the SIP proxy and outbound proxy, it was fairly simple to add the addresses, as they were numerical and the asterisk key can be used for periods. For the names and password, though, we could nd no convenient interface to enter letters. Thus, we ended up adding the names by entering a number and then using the directional keys to scroll through all the characters until the letters until we reached the given letter, then repeated it for each letter. As a result of this, we changed all the account names to be in all caps (as the capital letters are before the lowercase letters in 3

the sequence) and the passwords to all be numerical. The phone also has a very strange eect where after you save a name, it puts a space after it, which causes Asterisk to treat it as a dierent name than what is in its conguration les, and thus reject the logon attempt. Thus, to properly congure the phone, you need to enter the name and then go back into the settings and delete the extra space. This problem was not experienced for the password for some reason. Once the phone was setup and rebooted, it worked as expected.

Hard Phone Conguration - Snom

Finally, we congured a Snom hard phone. The Snom hard phone provides a convenient web interface which makes conguration much easier than for the Grandstream phone. To set up the web interface, rst we accessed the settings menu through the settings button, chose the DHCP entry (despite using a xed IP address), then followed the prompts to set the IP address and netmask of the phone. Once that was established, we could access the phone by pointing a web browser at its IP address. The web interface allows you to enter information for up to 15 identities, which are dierent congurations of SIP proxies and related information. After entering the necessary information into the form and submitting it, the phone connected to the proxy.

Results

Once all the components were congured, we were able to establish calls between all endpoints and perform both serial and parallel routing. In testing the protocol types, all three phones supported both UDP and TCP connections.

You might also like