Lab 1 - Asterisk

Embed Size (px)

Citation preview

  • 8/6/2019 Lab 1 - Asterisk

    1/4

    Asterisk PBX Installation

    Adam Vartanian, Hassan Ajmal

    October 10, 2006

    1 Overview

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

    2 Installation

    Installing Asterisk is straightforward.

    Download source archive at http://ftp.digium.com/pub/asterisk/asterisk-1.2-current.tar.gz

    Unpack archive

    make

    make install

    make samples

    3 Asterisk Configuration

    Asterisk is configured through the use of configuration files stored in the /etc/asteriskdirectory. Configuration files are organized into sections, which are delim-

    ited by brackets, and then a set of instructions of the type either marker =>instruction or name=value There are two steps to configuring Asterisk for ourenvironment: configuring the SIP accounts, and configuring the extensions.

    To configure the accounts, one must edit the sip.conf file. There is a sectioncalled general, which defines how the SIP server should act, and then a set ofsections whose names are the accounts and whose values are specific to thoseaccounts. The file we used is shown below

    1

  • 8/6/2019 Lab 1 - Asterisk

    2/4

    [general]

    port=5060bindaddr=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 interactionto be performed over TCP instead of the default of UDP.

    The information about the defined extensions is kept in the extensions.conffile. By default, the file contains a large number of sample rules, which we left inplace. 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 whichrules should be executed, and the action is what action to take. Actions forour purpose are in the form of Dial(information), though many other actionsare implemented, such as transferring to other systems, recording voicemail, orplaying a message.

    To configure the extensions, we first added rules for dialing each phone in-dividually.

    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 specified phone. Next, we

    added rules to support forking. To perform parallel forking, we set the action toDial(SIP/JOE&SIP/FRED), which makes the phones associated with both JOEand FRED ring until one picks one up. To perform serial forking, we provide atimeout to the first action, then provide a second action with another prioritywhich rings the second phone, which will occur when the first action times out.

    exten => 5600,1,Dial(SIP/JOE&SIP/FRED)

    2

  • 8/6/2019 Lab 1 - Asterisk

    3/4

    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 finding the handbookon Asterisks website can be difficult. Its also important to note that no spacesare allowed in the action specifications.

    After configuration, 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 fromthe controlling terminal. At the console, several commands are useful, mostespecially the sip [no] debug command, which turns on or off SIP debuggingmessages. These messages include all incoming and outgoing SIP packets, andare especially helpful in investigating configuration problems.

    4 Soft Phone Configuration - 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 configure it to use our As-terisk server was comparitively simple. We went into the preferences dialog,went to the Profiles tab, and added a new profile of the Calls through SIPProxy type. In the profile setup, we added the proxy address and port tothe SIP Proxy tab. Then, we simply switched to that profile in the prefer-ences dialog, and the phone connected after prompting us for our username andpassword.

    5 Hard Phone Configuration - Grandstream

    For hard phones, we first set up the Grandstream phone. All of the phonesconfiguration is done through the phone itself, which is a very poor interface forsetting complex configuration parameters such as usernames and passwords. Toaccess the settings, you push the center button in the directional button areaof the phone, which is very counterintuitive. At that point, you scroll down tothe Settings menu item and select it. The particular settings needed to get thephone working were in the Network and SIP sections of the phone.

    For network settings, we needed to provide the IP address and netmask. Forthe SIP settings, we needed to provide the SIP proxy, outbound proxy, displayname, authentication name, and password. For the SIP proxy and outbound

    proxy, it was fairly simple to add the addresses, as they were numerical and theasterisk key can be used for periods. For the names and password, though, wecould find no convenient interface to enter letters. Thus, we ended up addingthe names by entering a number and then using the directional keys to scrollthrough 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 accountnames to be in all caps (as the capital letters are before the lowercase letters in

    3

  • 8/6/2019 Lab 1 - Asterisk

    4/4

    the sequence) and the passwords to all be numerical. The phone also has a very

    strange effect where after you save a name, it puts a space after it, which causesAsterisk to treat it as a different name than what is in its configuration files,and thus reject the logon attempt. Thus, to properly configure the phone, youneed to enter the name and then go back into the settings and delete the extraspace. This problem was not experienced for the password for some reason.

    Once the phone was setup and rebooted, it worked as expected.

    6 Hard Phone Configuration - Snom

    Finally, we configured a Snom hard phone. The Snom hard phone provides aconvenient web interface which makes configuration much easier than for theGrandstream phone. To set up the web interface, first we accessed the settings

    menu through the settings button, chose the DHCP entry (despite using a fixedIP address), then followed the prompts to set the IP address and netmask of thephone. Once that was established, we could access the phone by pointing a webbrowser at its IP address. The web interface allows you to enter informationfor up to 15 identities, which are different configurations of SIP proxies andrelated information. After entering the necessary information into the form andsubmitting it, the phone connected to the proxy.

    7 Results

    Once all the components were configured, we were able to establish calls be-tween all endpoints and perform both serial and parallel routing. In testing the

    protocol types, all three phones supported both UDP and TCP connections.

    4