You are on page 1of 31

PracticalGuide

HowtosetupVoIP Infrastructureusing AsteriskNOW

TableofContents
1.Background............................................................................................................ ...............1 2.TheVoIPscenarios...............................................................................................................2 3.Beforegettingstarted...........................................................................................................3 3.1TrainingKits.................................................................................................................. .3 3.2Softwarerequirements.....................................................................................................3 3.3Conventions....................................................................................................................4 3.4Knownissues................................................................................................................... 4 4.Virtualizationversusdedicatedhardware..............................................................................5 5.InstallingAsteriskNOW........................................................................................................5 5.1InstallationScreenshotsdiscussed...................................................................................7 6.ConfiguringAsteriskNOWforScenario123.................................................................10 6.1ConfigurationthoughtheAsteriskGUISetupWizard................................................11 6.1.1Step1:Hardwaredetection...................................................................................11 6.1.2Step2:Localextensionssettings...........................................................................13 6.1.3Step3:Configuringserviceproviders....................................................................14 6.1.4Step4:Outboundcallingrules..............................................................................17 6.1.5Step5:Voicemailsettings.....................................................................................19 6.1.6Step6:Userextensions.........................................................................................20 6.1.7Step7:Incomingcallsrules...................................................................................23 6.1.8Advancedoptions:AsteriskGUI...........................................................................24 7.ConfigurationofATAs........................................................................................................24 8.QuickInstallationGuide.....................................................................................................26 8.1Scenario1.................................................................................................................. ....26 8.2Scenario2.................................................................................................................. ....27 8.3Scenario3.................................................................................................................. ....28 9.Verifyyourresults...............................................................................................................29 9.1Scenario1.................................................................................................................. ....29 9.2Scenario2.................................................................................................................. ....29 9.3Scenario3.................................................................................................................. ....29

1. Background
ThefirsteditionoftheVoIP4DPrimer,Buildingvoiceinfrastructureindevelopingregions released in December 2006 covered the basic aspects of IP Telephony and provided configurationguidelinesfortheAsteriskPBXforthreebasicscenarios.Thisdocumentaims tomaketheinstallationofsuchscenarioseveneasier.WhileinthefirstversionoftheGuide weconfiguredAsteriskbyeditingtheconfigurationfiles,inthisguidewearegoingtousea graphicaluserinterface(GUI).Wehavereviewedseveralinitiativesthatprovideagraphical interfacetoAsteriskanddecidedtopreparethispracticaltutorialbasedontheAsteriskGUI availableinAsterisk1.4.xseries. AnewdistributionknownasAsteriskNOW,includesastraightforwardinstallerandallthe softwarepackagesforAsteriskproductionanddevelopment.Althoughthedistributionisstill inbetastage(beta5inNovember2007),ithasbeendesignedwithaverycleaninterfaceand averyintuitivewizard. 1

Ananalysisofotherinitiativesisavailableinthedocument:MakingIPtelephonyknowledge accessible(prestudy1).

2. TheVoIPscenarios
Thethreescenariosdescribedinthisdocumentaresimilartotheonesdescribedindetailedin theVoIP4DPrimer. Scenario1 Creatingalocalprivatetelephonynetwork inaruralcommunity ThisscenarioconsistsofasinglePBXwith a set of clients. Clients can be either softphones,VoIPphonesorATAs.

Scenario2 Interconnectingcommunities InthisscenarioweinterconnecttwoPBXs. Local extensions of one PBX are made availabletotheotherandviceversa.

Scenario3 ConnectingcommunitiestothePSTN In this final scenario, we have interconnected two PBXs and allow the possibilityofreachingthePSTNfromany ofthem.

1 Canbedownloadedfromwww.voip4d.org,underDocumentation

3. Beforegettingstarted
IfyouhavenotreadtheVoIP4DPrimer(www.voip4d.org)havealooktothefirstchapter asitwillprovideyouwiththenecessarybackgroundtounderstandthebasicconceptsofIP Telephony. The very minimum hardware requirements for Scenario 1 and 2 is a single PC running WindowsandhostingtwovirtualizedinstallationsofAsterisk.Youcantestthecallsusinga softphoneandthevoicemailservice. For Scenario3,youwillneedtwocomputers,oneofthemwithadedicatedcommunication cardTDM400p.Alternatively,youcanusetwoAsteriskappliancessuchastheIP04s2.

3.1 TrainingKits
IfyouwanttorunaVoIPtrainingsessionbasedonthismaterial,consideratleasthaving onetrainingkitpergroupasfollows:

2PCswithnetworkcards 24ATAsor(24VoIPPhones) 24analoguephones(ifusingATAs) 1TDM400pcardwith1FXSand1FXOports 14portswitch(betterahub,ifyoucanfindone!) AccesstoaPSTNline

Alternativelyyoucanusethefollowingtrainingkit

2IP04(3FXS,1FX0) 24analoguephones 14portswitch AccesstoaPSTNline

3.2 Softwarerequirements

ISOImageofAsteriskNOW VMwareImageofAsteriskNOW http://www.asterisknow.org/downloads VMwarePlayer http://www.vmware.com/products/player/ Softphones;XLite,Kiax,etc http://www.voipinfo.org/wikiAsterisk+IAX+clients Wireshark(fordebugging,advanceusers) DHCPServer

2 http://www.rowetel.com/ucasterisk/

LatestFirefoxversion>=2.0.0.9 Documentation

AsteriskNOWquickstartguide VoIP4DPrimer

Thisdocument(SettingupVoIPInfrastructureusingAsteriskNOW)

3.3 Conventions
This documentation has used the IP address 192.168.46.135 for the majority of the screenshots.BeawarethatyouneedtouseyourownIPaddressesforyoursetup. 1. WewillcreatefourlocalextensionsineachPBX,withthenames1000,2000,3000, 4000. 2. Wewillusethesamenumberasusername,calleridandpassword,i.e.username= callerid=password=1000(or2000,3000,4000)). 3. Thevoicemailextensionis8500. 4. Scenario2and3includetwodifferentPBXsthatshouldhavedifferentIPaddresses. 5. EachofthePBXsseestheotherPBXasaVoIPServiceProvider. 6. Theaccount username:4646password:4646iscreatedineachofthePBXsforthe purposeofroutingcallsbetweenthem

3.4 Knownissues
Thesearesomeoftheissuesfoundduringthepreparationofthistutorial: 1. Ifyouhaveproblemsduringauthentication,considerusingthelatestFirefoxversion and/orremovingthecacheandthecookiesofyourbrowser. 2. VMplayer can not boot your image if you have a Windows machine with FAT16 filesystemwithasizebiggerthan2GB. IncludethelinediskLib.sparseMaxFileSizeCheck="false"attheendoftheVMXfile toovercometheproblem. 3. AsteriskNOWisstillinbetastage.Insomecasesitisnotpossibletoeditentriesafter runningthewizard.Considerdeletingandrecreatingtheentryinsteadofeditingit.

4. Virtualizationversusdedicatedhardware
ThereareseveralwaystoinstallAsteriskNOWona computer. The method to use depends on your answerstothefollowingtwoquestions: 1. DoesyouVoIPsetupneedtobeconnected tothePSTN(TDMsupport)? 2. Do you have a dedicated machine for the VoIPsetup? IfyouanswerisYestothefirstquestion,youneed toinstallAsteriskNOWinadedicatedmachine. IfyoudonotneedtobeconnectedtothePSTN, youhavetwooptionsdependingonifyouhavea machine available for the implementation (Dedicatedmachine). Ifyoudonothaveadedicatedmachineyouneedto install VMware player in your machine and the boot the VMware AsteriskNOW ISO. Thereafter youcaninstallAsteriskNOWvirtually,usingyour VMwareinstallation. Ifyouhaveadedicatedmachine,bootfromaCD thatcontainstheAsteriskNOWISO.

5. InstallingAsteriskNOW

InstallAsteriskNOW Thedistributionisavailableinthreemainflavours: 1. Aversionthatrunsonthex86,32bit/64bitprocessorssuchasIntelP4andAMD AthlonXP. 2. AversionthatrunsontheXenvirtualmachine. 3. AversionthatrunsontheVMwarePlayer. Ifyoudonothaveadedicatedmachineavailableoryouwanttotestthesoftware distribution,youshouldconsiderusingtheVMwareISOimage.Pleasenotethatusing theVMwareimagewillnotallowyoutouseanyspecializedhardwareasthePCI TDM400pcard. Although, it is not mandatory, consider having a DHCP server available on the network.

Logintothewebinterface Openabrowserandgoto: https://192.168.46.135

Thewebinterfaceprovidesyouaccesstothreemainconfigurationareas: 1. AsteriskGUIconfigurationwizard Astepbystepconfigurationwizardthatguideyouthrough7stepstogetyourPBX upandrunning https://192.168.46.135/static/config/setup/install.html 2. TheAsteriskGUI Once you have run the wizard for the first time you can edit and modify the parametersusingtheURL https://192.168.46.135 https://192.168.46.135/static/config/cfgbasic.html 3. TheAppliancePlatformConfigurationWizard ThiswizardallowstoconfigureparametersthatarenotAsteriskspecific,forexample therootpasswordofthesystem,theIPaddress,backupschedule,etc. https://192.168.46.135 :8003/rAA/ Importantnotice!ThistutorialcoversonlyhowtousetheAsteriskGUIconfiguration wizardtosetupthescenariospresented.Foracompletedescriptionofalloptionsavailable intheothergraphicalinterfaces,consulttheAsteriskQuickstartGuide3.

3 http://www.asterisknow.com/files/downloads/quickstart_asterisknow.pdf

5.1 InstallationScreenshotsdiscussed
Areaswithagreybackgroundareadvancedtips.IfyouarenotfamiliarwithAsterisk,simply ignorethem. GETTINGSTARTEDInstallingaVMwareimage DESCRIPTION IfyouinstallAsteriskNOWusinga ISOimage: Install VMware player and make sure that your Ethernet is in bridgemode. By putting the interfacein Bridge Mode,yourAsteriskNOWwillfetch and IP address via DHCP after booting. Important: You need to have a DHCP server available in your network. asterisk0.9.6.5x86.vmx CONFIGURATIONFILES

Ifduringtheprocessofbootingthe Configurationfilestartsby VMwareplayercomplainsaboutthe #!/usr/bin/vmplayer size of your FAT filesystem (> 2 GB):
Appendthisline:

Locatetheconfigurationfileofthe diskLib.sparseMaxFileSizeCheck="false" guestapplication,afilethatfinishes withVMX. UseatexteditorlikeWordpad,and appendanextraline.

GETTINGSTARTEDMakesureAsteriskNOWhasanIPaddress DESCRIPTION If your DHCP is working, your AsteriskNOWwillinformyouofthe IP address that your box has obtained. The AsteriskNOW Console allows you to update, restart and shutdownthesystem. Using the Console you can also operate a command line interface (theasteriskCLI>).

AccessingtheboxviaSSH

CONFIGURATIONFILES

You can access the AsteriskNOW IfyoulogintotheboxusingSSH,pleasehavealook boxatanytimeviaSSH. atthe/etc/passwordand/etc/sudoresfiles. You can see that the user admin can get administrative The account is admin with the privileges.Considerchangingthedefaultpasswordof defaultpasswordpassword. theuseradmin. Youcangetadminprivilegesusing It is important to notice that there are 3 different sudo. adminusersineachinstallation: (1)Theadminuserthatletyoulogintotheboxvia SSH. (2) The admin user that have access to the AsteriskGUIviaHTTPSand (3)Theadminuserthatcanconfiguretheappliance settings(rPath). Yes,threedifferentpasswords!

GETTINGSTARTEDLogintoAsteriskNOWwebinterface DESCRIPTION Open a browser andgo to the IP address that AsteriskNOW has obtained. Inourexample http://192.168.46.134 Logintotheinterfaceusingtheuser admin and the default password password.

/etc/asterisk/manager.conf

CONFIGURATIONFILES
[general]

AsteriskGUIusesAsteriskmanager displaysystemname=yes commands(AsteriskManagerAPI) enabled=yes webenabled=yes tocommunicatewithAsterisk. The user and password of the AsteriskGUI is available in the manager.confconfigurationfile

port=5038 bindaddr=0.0.0.0 [admin] secret=password read=system,call,log,verbose, command,agent,user,config write=system,call,log,verbose,command, agent,user,config

6. ConfiguringAsteriskNOWforScenario123
Inanutshell,theprocessofconfiguringeachofthePBXscanbesummarizedin7basicsteps:

(Step1)Verifyifanyzaptelcardhasbeendetected. Anyzaptelcompatiblecardshouldbedetected.Cardssupportedbyzaptelinclude: Digium,Sangoma,XorcomAstribank(inbeta6.5),RhinoandOpenvoxcards. This step will report no hardware detected if you are configuring a PBX without zapatacompatiblehardwareorrunningtheVMwareversionofAsteriskNOW. OnlyScenario3willuseanddetectazaptelcard. (Step2)Indicatethefirstextensionnumberandthelengthofthelocal extensions. Hereyouindicatethenumberofdigitsthatyourlocalextensionshaveandwhatthe firstextensionnumberis.Inourscenariowewilluse4digitsandextension1000as thefirstone. (Step3)CreateServiceProviders Inthisstepwespecifywhotheserviceprovidersofoutgoingcallsare. Scenario1:thePBXisstandaloneandhasnoexternalserviceproviders. Scenario2:eachPBXseestheotherPBXasVoIPserviceprovider. Scenario3:thePBXwithaTDMcardneedstobeconfiguredwithtwodifferent service providers. The first provider is the other PBX (VoIP) and the second provideristheAnaloguePortoftheTDMCard. (Step4)Configure(Outbound)CallingRules In this step we specify what the calling rules are to reach the different service providers. Scenario1:doesnotneedanyoutboundcallingrules. Scenario2:needtoindicatethattoreachtheotherPBX'slocalextensionsweneed todial9+<localextension#>. Scenario3:SamecallingruleasinScenario2toreachtheotherPBX.Also,we needtoaddanoutgoingcallingrulethatindicateshowtoreachthePSTN.To reachthePSTN,weneedtoappenda0tothePSTNnumber(0+<PSTN#>). (Step5)Voicemailextension Inthisstepwewillconfiguretheextensionnumberusedtoreachthevoicemail.The defaultnumberforallthreescenariosis8500. (Step6)Usersextensions HereweconfigurealllocalextensionsassociatedtoeachofthePBXs.Weneedto createfourlocalextensionsinallthreescenarios(1000,2000,3000and4000). ThelocalextensionscanbeeitherVoIPclientsrunningIAXorSIP,oranalogueports ifavailable. Forscenario2and3,wewilladdthespecialextension4646thatisusedtoroutecalls betweenthePBXs.

10

(Step7)Configure(Inbound)CallingRules InScenario1and2,wedonotneedtocreateanyspecialrulesforincomingcallsasall callswillbegeneratedlocally. InScenario3,wewillneedtoindicatewhichlocalextensionwillringwhenthereisan incomingcallfromthePSTN.

6.1 ConfigurationthoughtheAsteriskGUISetupWizard
This section guides you though the graphical configuration setup wizard provided by AsteriskNOW.IfitisthefirsttimethatyoulogintotheAsteriskGUI,youwillberedirected straighttothesetupwizard.Thesetupwizardwillguideyouthroughseven(7)stepsto configureyourVoIPsetup. Thisguideincludesbothbasicandadvancedconfigurationtips.Areaswithgreybackground areadvancedtips.IfyouarenotfamiliarwithAsterisk,pleaseignorethem.

6.1.1 Step1:Hardwaredetection
STEP1HARDWAREDETECTION (Scenario1and2) DESCRIPTION This screenshoot shows Step 1 of the wizard for Scenario 1 and 2, where our PBX does not include anyPCIexpansioncards.

CONFIGURATIONFILES It is possible to run the wizard again by accessing the following Allthestaticwebpagesofthewizardareavailablein URL: thefollowingpath:
http://<IP>/static/config/ setup/install.html /var/lib/asterisk/statichttp

11

STEP1HARDWAREDETECTION(2/2) (Scenario3) DESCRIPTION IfyouhaveaPCIcardasthe TDM400,thewizardwilldetectthe modulesautomatically. Intheexample,wehave1FXOand 1FXSportwiththefollowing functionality: FXOport:wecanattachanexternal PSTNline. FXSport:wecanattachaphone. /sbin/zapscan CONFIGURATIONFILES

Thezapscanutilitydetectstheports #grepv"#"/etc/zaptel.conf andgeneratesthe/etc/zaptel.conf loadzone=us configurationfile. defaultzone=us Theconfigurationfilesshowsthe typeofsignallingneededforeachof theports. fxsks=1meansthatport#1isa FXOthatneedsFXSKewlstart signalling.
fxsks=1 fxoks=2

12

6.1.2 Step2:Localextensionssettings
STEP2LOCALEXTENSIONSSETTINGS (Scenario1,2and3) DESCRIPTION Inthesecondstepofthe configurationweindicatethelength ofthelocalextensions.Inoursetup wearegoingtousefourdigitsand theextensionnumber1000asthe firstextension. Thisconfigurationiscommontoall threeScenarios.

/etc/asterisk/users.conf Thisparameterthatwesetupin thewizardcanbefoundinthe users.confwiththenameuserbase insideofthesection[general]

CONFIGURATIONFILES
[general] userbase=1000 localextenlength=4

13

6.1.3 Step3:Configuringserviceproviders
STEP3CONFIGURINGSERVICEPROVIDERS(1/3) (Scenario2and3) DESCRIPTION In Scenario 2 and3, we wantour PBX to be able to communicate with another PBX and vice versa. Todothat,weneedtocreateanew ServiceProvider. In this example, we add a new serviceproviderthatisreachableat theIPaddress192.168.46.136. We indicate that we want to communicate using the protocol IAX using an account with username 4646 andpassword 4646. Thisaccountwillbeusedbetween the PBXs for authentication and routingcalls. /etc/asterisk/users.conf /etc/asterisk/extensions.conf Thecreationofnewserviceprovider involves: (1)Anewsectionintheusers.conf fileand (2)A new entry point in the extensions.conf(dialplan) In our example we are creating a serviceprovider[trunk_1]reachable at192.168.46.136. Weareusingtheaccountuser:4646 password:4646. Incoming calls from this provider fallinthesection[DID_trunk_1]of thedialplan CONFIGURATIONFILES
/etc/asterisk/users.conf [trunk_1] disallow= allow=all callerid= contact= context=DID_trunk_1 dialformat=${EXTEN:1} fromdomain= fromuser= group= hasexten=no hasiax=yes hassip=no host=192.168.46.136 insecure= port=4569 provider= registeriax=yes registersip=no secret=4646 trunkname=CustomInterIAXCalls trunkstyle=customvoip username=4646 /etc/asterisk/extensions.conf [DID_trunk_1] include=default

14

STEP3CONFIGURINGSERVICEPROVIDERS(2/3) (Scenario3) DESCRIPTION IfyourPBXcontainsaTDMcard with a FXO port (Scenario 3) we can communicate with the telephonenetwork(PSTN). In the third scenario, you need to create a new Service Provider associatedtotheAnalogPort. In our example, the TDM card containsaFXOportinslot#1. /etc/asterisk/users.conf /etc/asterisk/extensions.conf Thecreationofnewserviceprovider via the PSTN also modifies two files: (1)anewsectioninthe users.conf fileand (2) a new entry point in the dialplan. In our example the AsteriskGUI createsanewserviceproviderwith the name [trunk_2] reachable via theanalogport#1 Incomingcallsfromthisprovider fallinthesection[DID_trunk_2]of thedialplan CONFIGURATIONFILES
/etc/asterisk/users.conf [trunk_2] disallow= allow= callerid=asreceived contact= context=DID_trunk_2 dialformat= fromdomain= fromuser= group=1 hasexten=no hasiax=no hassip=no host=dynamic insecure= port= provider= registeriax= registersip= secret= trunkname=Port1 trunkstyle=analog username= zapchan=1 /etc/asterisk/extensions.conf [DID_trunk_2] include=default

15

STEP3CONFIGURINGSERVICEPROVIDERS(3/3) (Scenario3) DESCRIPTION You can create as many service providersasyouwish. OneofthePBXoftheScenario3, hastwodifferentServiceProviders. OneprovideristheotherPBXthat can be reached via a VoIP connection(CustomVoIP)andthe secondproviderisreachableviathe Analog(TDM400)expansioncard. /etc/asterisk/users.conf CONFIGURATIONFILES

The configuration file users.conf Theusers.confcontainsthreetypesofsections wasintroducedintheAsterisk 1.4 [general] series. Thissectionincludesdefaultvalues. Inthe1.2.xseries,eachuserorpeer wasdefinedinsip.conf oriax.conf. Theentitywasclassifieddepending on the protocol. The users.conf merges iax.conf,sip.conf and some of the options of zapata.conf into onesinglefile.
[trunk_#]

Thesesectionsincludetheconfigurationofthe differentserviceproviders.
[XXXX]

Thesesectionsincludetheconfigurationofthelocal extensions(1000,2000,3000,4000).Theycanbe analogportsorIAXorSIPusers.

16

6.1.4 Step4:Outboundcallingrules
STEP4OUTBOUNDCALLINGRULES(1/2) (Scenario2and3) DESCRIPTION Once we have configured the service providers we can configure our dialplan. InScenario2and3,weneedtocreatea ruletobeableroutecallsbetweenthe PBXs. In the example, we create a calling rule with the name InterIAX Calls. In this menu, we describe the dialing rules that need to be applied whenwewanttoreachtheextensionsof theVoIPprovider(theotherPBX)that wepeerwith. We indicate that to reach the other PBX, we need to dial 9 before the extension number. To reach the extension 1000 in the other PBX, we needtodial9+1000. /etc/asterisk/extensions.conf AsteriskNOW allows you to create differentdialplans.ThedefaultDialPlan associated to the context of local extensionsis numberplancustom1. Outgoing calls between the PBX are routed using the trundial Macro, that placesacallusing:
Dial(IAX2/4646:4646@192.168.46.136 /${EXTEN:1})

CONFIGURATIONFILES
/etc/asterisk/extensions.conf [numberplancustom1] plancomment=DialPlan1 include=default exten=_9XXXX.,1,Macro(trunkdial,${trunk_1}/ ${EXTEN:1}) comment=_9XXXX.,1,InterIAXCalls,standard

and uses the account 4646 data for authentication.

17

STEP4OUTBOUNDCALLINGRULES(2/2) (Scenario3) DESCRIPTION In Scenario 3, we need to create another calling rule that indicates thatanylocalextensionscanreach thePSTNbyPort#1(theanalog serviceprovider). Select Defineacustompattern and fill in your outbound calling rule according to the screenshot to the right. Intheexample,acallisplacedby appending a 0 to a valid PSTN number,whichisdefinedtobe 6 ormoredigits. /etc/asterisk/extensions.conf Inthisexamplewehavetwoservice providers.Thefirstserviceprovider is a VoIP provider (another PBX) and the second provider is the analogPSTNline. To reach the VoIP provider: 9 + extension# To reach the PSTN via analogue port:0+PSTN# CONFIGURATIONFILES
[numberplancustom1] plancomment=DialPlan1 include=default ;CallsbetweenPBXs.9+<localextension#> exten= _9XXXX!,1,Macro(trunkdial,${trunk_1}/${EXTEN:1}) comment=_9XXXX!,1,InterIAXCalls,standard ;CallstothePSTN.0+<PSTN#> exten= _0XXXXXX.,1,Macro(trunkdial,${trunk_2}/${EXTEN:1}) comment=_0XXXXXX.,1,outgoingPSTN,standard

18

6.1.5 Step5:Voicemailsettings
STEP5VOICEMAILSETTINGS (Scenario1,2and3) DESCRIPTION Thedefaultextensionforvoicemail is8500. Thedefaultpasswordforvoicemail isthepasswordoftheextensionitis associatedwith. When the configuration wizard is completed, you can change the password of your voicemail to any sequenceofdigits.Youwillfindthe optionVWpasswordunderUsersin themainmenu. /etc/asterisk/voicemail.conf /etc/asterisk/users.conf When voicemail is activated in a local extension the setting hasvoicemailissettoyes. By settings the voicemail we also modified the way that extensions are called. Instead of a normal Dial(),Asterisk1.4.xwillcallmacro the[macrostdexten]. If not other value is specified the default the Voicemail password is thesamethatyouraccountsecret. The vmsecret option allowsyouto set a different password for your voicemail. Intheexampleextension3000uses thesecret3000forauthenticationof calls and the password 1234 to reachthemailbox. CONFIGURATIONFILES
[3000] callwaiting=yes cid_number=3000 context=numberplancustom1 email= fullname=3000 group= hasagent=yes hasdirectory=no hasiax=yes hasmanager=no hassip=yes hasvoicemail=yes host=dynamic mailbox=3000 secret=3000 threewaycalling=yes vmsecret=1234 zapchan= registeriax=yes registersip=yes canreinvite=no nat=no dtmfmode=rfc2833 disallow= allow=

19

6.1.6 Step6:Userextensions
STEP6USEREXTENSIONS(1/3) (Scenario1,2and3) DESCRIPTION Inthisstepwewillcreatethefourlocal userextensions.Theextensionscanbe associatedtoanIAXorSIPdevicesuch asanATAorVoIPPhone,orassociated toaanalogueportavailableinthePBX.

/etc/asterisk/users.conf Each of the new extensions will have entryofthetype[1000],[2000],[3000], etc. IfthelocalextensionisaSIPorIAX device it will be indicated with the values:
hassip=yes hasiax=yes

CONFIGURATIONFILES

20

STEP6USEREXTENSIONS(2/3) (Scenario2and3) DESCRIPTION InScenario2and3weneedtocreate extension 4646, which needs to be availableinbothPBXs. This extension is created to accept incomingcallsfromtheotherPBX.

/etc/asterisk/users.conf This extension is not visible to the usersanditisusedforthepurposeof routingandauthenticatingcallsbetween thePBXs. InScenario3weareusingIAXasthe protocolfor interconnecting thePBXs. IAXismoreNATfriendlyandefficient intermsofbandwidth.

CONFIGURATIONFILES
[4646] callwaiting=yes cid_number=4646 context=numberplancustom1 email= fullname=4646 group= hasagent=yes hasdirectory=no hasiax=yes hasmanager=no hassip=yes hasvoicemail=yes host=dynamic mailbox=4646 secret=4646 threewaycalling=yes vmsecret= zapchan= registeriax=yes registersip=yes canreinvite=no nat=no dtmfmode=rfc2833 disallow= allow=

21

STEP6USEREXTENSIONS(3/3) (Scenario3) DESCRIPTION In Scenario 3, we need to define whichlocalextensionthatshouldbe associatedwiththeAnalogPort#2 (the phone). In this example, we havechosenExtension1000forthat task. Wedefinetheassociationbyediting the existing User Extension for Extension 1000 and select Analog Port#2asAnalogPhone. /etc/asterisk/users.conf Althoughitmightlooksurprising,it is possible to have an extension associated to more than one communicationtechnology. In the example, extension 1000 is reachableintheAnaloguePort#2 andviaSIPandIAX.
hasiax=yes hassip=yes zapchan=2

CONFIGURATIONFILES
[1000] callwaiting=yes cid_number=1000 context=numberplancustom1 email= fullname=1000 group= hasagent=no hasdirectory=no hasiax=yes hasmanager=no hassip=yes hasvoicemail=yes host=dynamic mailbox=1000 secret=1000 threewaycalling=yes zapchan=2 registeriax=yes registersip=yes canreinvite=no nat=no dtmfmode=rfc2833

Thisallowsustohaveasmanyas threedevicesassociatedtothesame extension number. The three deviceswillringsimultaneously.

22

6.1.7 Step7:Incomingcallsrules
STEP7INCOMINGCALLSRULES (Scenario3) DESCRIPTION In Scenario 3, we need to decide whattodowiththecallsoriginated inthePSTN. Intheexample,weindicatethatall calls from the PSTN should be forwardtothelocalextension1000.

/etc/asterisk/users.conf /etc/asterisk/extensions.conf

CONFIGURATIONFILES
[trunk_2] disallow= allow= callerid=asreceived contact= context=DID_trunk_2 dialformat= fromdomain= fromuser= group=1 hasexten=no hasiax=no hassip=no host=dynamic insecure= port= provider= registeriax= registersip= secret= trunkname=Port1 trunkstyle=analog username= zapchan=1 [DID_trunk_2] include=default exten=_X.,1,Goto(default|1000|1) exten=s,1,Goto(default|1000|1)

Port#1isaFXOportconnectedto thePSTN(zapchan=1). Incoming calls fall in the context DID_trunk_2. In the dialplan, under the context [DID_trunk_2] we see that by defaultallcalls(_X.,s)areforward toextension1000
Goto(default|1000|1)

23

6.1.8 Advancedoptions:AsteriskGUI
ADVANCEDOPTIONSASTERISKGUI DESCRIPTION Aftercompletingthesevenstepsyou canhavealooktotheAsteriskGUI interface. Thisinterfaceallowstomodifyyour entries via the wizard and create moreadvanceservices. Whenyouhavemadechangestothe configuration,donotforgettopress thebuttonActiveChanges,inorder applythechanges.

7. ConfigurationofATAs
NomatterwhichATAorIPPhoneyouneedtoconfigure,youwillfindthattheycanbe configuredinasimilarmanner.ThisexampleshowstheconfigurationprocessofaLinksys PAP2InternetPhoneAdapter.TheconfigurationisthesameforaSipura(SPA3000). IPsettings TheATAneedstohaveanIPaddressinordertobeabletocommunicatewithotherdevices ontheLANortheInternet.TheIPaddresscanbestaticordynamic.Inthisexample,we havechosentoobtainanIPaddressthroughDHCP. AllIPsettingsoftheATAareconfiguredusingthehandset. 1. 2. 3. 4. 5. AttachananalogphonetotheATA ConnecttheATAtotheLANwheretheDHCPisrunning EntertheconfigurationmenuoftheATAbypressing****onthephone. EnableDHCPbypressing101#followedby1. MakesurethattheATAhasobtainedanIPaddressbypressing110#.

Extensionnumber TheextensionnumberoftheATAisconfiguredthroughitswebinterface.Directyourbrowser tohttp://<IPaddressofyourATA>/admin/advanced GotothetabLine1,andfillinthefollowingfields:

24

ProxyandRegistration Proxy:192.168.46.135(theIPaddressofthePBXyouwanttoregister) Register:Yes SubscriberInformation DisplayName:1000 UserID:1000 Password:1000 UseAuthID:yes AuthID:1000

YoucanverifyfromthewebbasedAsteriskConfigurationPanelthattheATAisregisteredin thePBX. 1. GotoAsteriskCLIintheleftmenu 2. Onthebottomofthepage(inthepinktextfield),write 3. AllregisteredphonesandATAswillbelistedwithIPaddressandextensionnumber.


sipshowpeers

25

8. QuickInstallationGuide
Thissectionincludesa7stepquickinstallationguideforScenario1,2and3.Pleasenotethat theredcrossesinthetableindicatestepsintheconfigurationprocedurethatarenotneeded forthatspecificscenario.

8.1 Scenario1

26

8.2 Scenario2

27

8.3 Scenario3

28

9. Verifyyourresults
ThissectionincludesasetofCheckpointsforeachScenariothatyoushouldbeabletodo with your current VoIP setup. If you successfully manage all checkpoints listed for your Scenario,yourAsteriskbasedVoIPsetuphasbeenconfiguredcorrectly.

9.1 Scenario1
Checkpoint1:PlacelocalphonecallsfromoneextensiontoanotherwithinthesamePBX. Checkpoint2:Callalocalextensionandleaveavoicemessages(don'tpickupthephone!). Usethevoicemailtofetchthevoicemessageyoujustleft.

9.2 Scenario2
Checkpoint1:PlacelocalphonecallsfromoneextensiontoanotherwithinthesamePBX. Checkpoint2: PlacephonecallsbetweenthetwoPBX'sbyusingtheprefix9beforethe extensionnumber. Checkpoint3:Callalocalextensionandleaveavoicemessages(don'tpickupthephone!). Usethevoicemailtofetchthevoicemessageyoujustleft.

9.3 Scenario3
Checkpoint1:PlacelocalphonecallsfromoneextensiontoanotherwithinthesamePBX. Checkpoint2: PlacephonecallsbetweenthetwoPBX'sbyusingtheprefix9beforethe extensionnumber. Checkpoint3:Callalocalextensionandleaveavoicemessages(don'tpickupthephone!). Usethevoicemailtofetchthevoicemessageyoujustleft. Checkpoint4:CalltothePSTNfromanyofthePBXs(tryboth). Checkpoint5:CallintothePBXfromthePSTN.

29