Вы находитесь на странице: 1из 357

VoIP Cookbook: Building your own Telecommunication Infrastructure

By Onno W. Purbo Anton Raharja

Edited By Nurlina Noertam

Funded By Internet Society Innovation Fund (ISIF)

One Destination Center


December 2011

TableofContents
ABOUTTHEAUTHORS.........................................................................................................................1 PREFACE...................................................................................................................................................2 CHAPTER1:VoIPOverview....................................................................................................................3 HowVoIPWorksforDummies.............................................................................................................3 WheretoStart?......................................................................................................................................4 WhatIsInternetTelephony?..................................................................................................................5 CHAPTER2:Becomingauser.................................................................................................................7 PCtoPCInternetTelephoneCall.........................................................................................................7 Usingsoftphone...................................................................................................................................11 InstallingXLite..............................................................................................................................11 XliteConfiguration........................................................................................................................15 InstallEkiga....................................................................................................................................19 ConfiguringEkiga...........................................................................................................................19 ConfiguringAccountinEkiga........................................................................................................27 TestyourSIPSoftphone......................................................................................................................30 CHAPTER3:VoIPHardwareforexperiencedUsers..............................................................................35 LinksysPAP2AnalogTelephoneAdapter........................................................................................36 LinksysIPPhoneSPA941..................................................................................................................41 WiFiIPPhone......................................................................................................................................46 LinksysWirelessGIPPhone.........................................................................................................47 HewlettPackardIpaq6395.............................................................................................................56 ActivatingIpaq6395'sWirelessCapability...............................................................................56 RunningSJPhone.......................................................................................................................58 SJPhoneFeatures.......................................................................................................................64 UsingSJPhonetoplacecallthroughIpaq6395........................................................................65 Nokia...............................................................................................................................................68 NokiaWirelessConfiguration..................................................................................................69 SIPServerandAccountConfigurationinNokiaE61................................................................73 InternetTelephoneConfigurationinNokia...............................................................................76 RegisteringtoVoIPSoftswitch..................................................................................................77 CallingusingInternetTelephoneinNokiaE61.........................................................................80 VoIPinADSLModem........................................................................................................................82 ADSLModemConfiguration........................................................................................................83 VoIPConfigurationinLinksysWAG54GP2..................................................................................86 CHAPTER4:InterconnectivityandTelephoneNumberAllocation.......................................................93 GettingFreeWashingtonStateTelephoneNumber.............................................................................94 FreeInternetCountry:CountryCode+882........................................................................................97 IntroducingyourcountrycodetoInternationalVoIPnetwork..........................................................104 VoIPRakyat'sENUM

...........................................................................................................................................................106 ConnectingtoPSTNandCellularUsingVoIPDiscount...................................................................116 VoIPCheap........................................................................................................................................118 CHAPTER5:AsteriskSoftswitch.........................................................................................................120 MinimalResourceforAsterisk.........................................................................................................121 AsteriskInstallation...........................................................................................................................121 CompileAsterisk...............................................................................................................................122 ConfiguringAsterisk.........................................................................................................................124 ENUM.CONFConfiguration............................................................................................................124 SIP.CONFConfiguration..................................................................................................................125 EXTENSIONS.CONFConfiguration...............................................................................................126 CHAPTER6:AsteriskforIncomingandOutgoingcalls.....................................................................129 DefiningSIPChannelinsip.conf.....................................................................................................129 AsteriskasSIPClient........................................................................................................................129 GenericSIPconfiguration................................................................................................................131 DAHDIUsageForVoIPCards..........................................................................................................141 DAHDIArchitecture.....................................................................................................................142 Kernel.......................................................................................................................................142 Tools.........................................................................................................................................142 DAHDISampleinstallation..........................................................................................................143 DAHDIextensions.conf.....................................................................................................................146 CHAPTER7:BrikerSoftswitch.............................................................................................................148 Briker'sInstallationProcess...............................................................................................................148 Briker'sConsole.................................................................................................................................154 Briker'sWebConfiguration...............................................................................................................156 ZaptelConfiguration.........................................................................................................................159 SIPTrunk...........................................................................................................................................160 IAX2Trunk.......................................................................................................................................163 H323Trunk........................................................................................................................................165 ZAPTrunk.........................................................................................................................................167 OutboundRoutes...............................................................................................................................168 InboundRoutes..................................................................................................................................170 InteractiveVoiceResponse................................................................................................................171 SetupRecordings...............................................................................................................................171 RingGroups.......................................................................................................................................172 PinSets...............................................................................................................................................174 CHAPTER8:OpenSIPSHighPerformanceSoftswitch........................................................................175 CompileOpenSIPS............................................................................................................................175 PrepareUserDatabaseServer............................................................................................................176 Useopensipsctl..................................................................................................................................178 SomeRoutingTechniqueinOpenSIPS.............................................................................................178 HowtoroutetoPSTNandCellular..............................................................................................179 HowtorouteusingAreaCodeforinterconnectedSIPServers....................................................180

HowtorouteENUMQueryinOpenSIPS....................................................................................181 TestENUMQueryinOpenSIP.....................................................................................................181 ENUMRoutingTableinOpenSIPSconfiguration.......................................................................182 CHAPTER9:ENUM.............................................................................................................................184 ExampleofENUMService...............................................................................................................184 DelegationConceptinENUM...........................................................................................................184 ENUMImplementation.....................................................................................................................186 BINDInstallation..........................................................................................................................186 SetupBINDforENUMServer.....................................................................................................186 TestDNSforENUMQuery..........................................................................................................188 ENUMDelegationinBIND..............................................................................................................189 CHAPTER10:ConferenceServeronAsterisk.....................................................................................191 ConfiguringConferenceRoomMeetMe...........................................................................................191 ConfiguringDialplanforConference...............................................................................................192 ActivatingConferencewhileOperating...........................................................................................193 CHAPTER11:TrunkPeeringinAsterisk..............................................................................................195 CHAPTER12:NATandFirewall..........................................................................................................196 CHAPTER13:VoicemailinAsterisk....................................................................................................198 CHAPTER14:MoreonAsterisk'sDialplan..........................................................................................201 PatternExtension..............................................................................................................................201 Attachingcontext..............................................................................................................................201 TheExtensionPattern.......................................................................................................................202 Extension......................................................................................................................................203 PredefinedExtensionNames.......................................................................................................203 DefiningExtension......................................................................................................................204 AninterestingExtensionExamples..............................................................................................206 VariableandEquation.......................................................................................................................208 Reloading...........................................................................................................................................208 ForwardingtoanotherAsterisk.........................................................................................................208 CHAPTER15:VoIPIPPBXHardware.................................................................................................210 LinksysSPA9000...............................................................................................................................210 LinksysSPA9000Configuration..................................................................................................211 ConfiguringVoIPonLinksysSPA9000......................................................................................214 CHAPTER16:AnalogTelephoneAdapterforconnectiontoPSTN....................................................219 LinksysSPA3000AnalogTelephoneAdapter.................................................................................220 ConfigureLinksysSPA3000.........................................................................................................221 LinksysSPA3000ATAStatus......................................................................................................225 LevelOneVOI2100AnalogTelephoneAdapter...............................................................................227 LinksysSPA400withfourFXOs......................................................................................................246 UsingtheSPA400withAsterisk..................................................................................................246 ConfigureAsterisktotalktoLinksysSPA400.............................................................................248 ConnectPSTNusingLinksysSPA9000andLinksysSPA400.....................................................251 ConfigureLinksysSPA9000totalktoLinksysSPA400..............................................................260

CHAPTER17:OpenBTS.......................................................................................................................261 OpenGSMInfrastructure..................................................................................................................261 History...............................................................................................................................................261 FieldTest............................................................................................................................................261 Niue...................................................................................................................................................262 GNURadio.........................................................................................................................................262 LibraryInstallation.......................................................................................................................263 WxWidgetInstallation..................................................................................................................263 SWIGInstallation.........................................................................................................................264 QWTInstallation..........................................................................................................................264 GNURadioInstallation.................................................................................................................265 USRPHandling............................................................................................................................265 USRPVerification........................................................................................................................266 OpenBTSInstallation........................................................................................................................269 AGlimpseonOpenBTSConfiguration............................................................................................270 smqueueConfiguration.....................................................................................................................272 AsteriskConfigurationtoworkwithOpenBTS................................................................................273 AutomaticSIMRegistration.........................................................................................................274 OpenBTSOperation..........................................................................................................................275 CHAPTER18:PeeringAmongProviders..............................................................................................276 FreeSIPProxyServers......................................................................................................................278 BecomingaPeerinSIPNetwork ...........................................................................................................................................................278 CHAPTER19:InternetTelephonyBandwidth.....................................................................................280 CodingDecoding(CODEC).............................................................................................................280 MeanOpinionScore(MOS)..............................................................................................................281 MOSandRFactorvaluesforG.711,G.723,andG.729....................................................................283 CalculatingTheRequiredBandwidth...............................................................................................284 CalculationforCallCenter................................................................................................................287 VoIPCapacityPlanning....................................................................................................................289 CHAPTER20:VoIPEvaluation............................................................................................................293 EvaluateVoIPPerformanceusingVQManager................................................................................293 VQManagerInstallation..............................................................................................................293 SomeoftheImportantScriptsofVQManager.............................................................................294 ActivateVQManagerWebService...............................................................................................295 ChangingtheMonitoredInterface................................................................................................303 InsertingnewInterface................................................................................................................303 MonitorVoIPPerformance...........................................................................................................304 EvaluateVoIPPerformanceusingSIPp.............................................................................................313 InstallationofSIPp........................................................................................................................313 InstallationofSIPpWebfrontend..................................................................................................313 TransactionOrientedTestusingSIPp...........................................................................................314 AccesstotheSIPpWebfrontend...................................................................................................317

CHAPTER21:VoIPTroubleshooting...................................................................................................328 CODECandVocoder........................................................................................................................328 PreparingAVoIPReadyNetwork.....................................................................................................329 Minimalrequirement/configuration................................................................................................329 Testpriortooperationofthesystem.................................................................................................329 SomeUsefulReferencesForVoIPTroubleshooting........................................................................330 References..............................................................................................................................................331 VoIPHardware...................................................................................................................................331 VoIPSoftswitch.................................................................................................................................331 VoIPClientSoftware.........................................................................................................................331 TestingSoftware................................................................................................................................331 APPENDIXA:Exampleof/etc/sip.conf...............................................................................................333 APPENDIXB:SIPpCOMMANDS......................................................................................................343 APPENDIXC:File/usr/local/etc/opensips/cfgtestuas.cfg................................................................350

ABOUT THE AUTHORS


OnnoWPurboisatechiewhowrotemanypracticalICTbooks.Hehasbeenapopularspeakerat
manyseminarsandconventions.HewithdrewfromhispositionasanIndonesiancivilservantand retiredasalecturerattheBandungInstituteofTechnology,becominganICTactivist.Hehaswritten thousandsofarticlesandpapersandauthoredmorethanfortybooksonICTandthereforereceived severalawards,includingaSabaticalAwardfromtheInternationalDevelopmentResearchCenter (IDRC),aCanadianCrowncorporationaimedathelpingdevelopingcountriesusescienceand technologytofindpractical,longtermsolutions.Hisprofileisat http://opensource.telkomspeedy.com/wiki/index.php/Onno_W._Purbo

AntonRaharjaisthefounderofthelargestcommunitybasedSIPSoftswitchVoIPRakyatin
Indonesia.HeisalsotheleaddeveloperofBriker,anopensourceSIPsoftswitchappliance.Besides Briker,Antonactivesindevelopingseveralopensourceapplications,suchas,PlaySMS(SMS Gateway),PlayVoIP(theVoIPRakyatEngine),PlayBilling(InternetCafeBillingSystem),WiFiRakyat etc.HehasservedinmanytalkandseminarsonVoIPandOpenSourcesoftware.Heiscurrentlythe TechnicalDirectorofPT.JelajahMediaInformatika,WANDKI,JakartaandtheCEOofPT.Infotech MediaNusantara,Jakarta.In2008,hereceivedaFOSSAwardfromtheIndonesianMinistryof InformationandCommunication.Hisprofileisathttp://www.antonraharja.web.id/curriculumvitae/

VoIPCookbook:1

PREFACE
Thisbookisaimedtoprovideapracticalknowledgetosetupacommunitybasedtelephonenetwork basedovertheInternetInfrastructureA.K.A.InternetTelephoneorVoiceoverInternetProtocol(VoIP). Manyrealworldexampleonequipmentandapplicationsoftwaresetupandinstallationsareprovided. Wewouldliketothankmanyfriendsathttp://www.asterisk.org,http://www.opensips.org, http://www.voiprakyat.or.idhttp://www.e164.org , aswellasmanyforumandmailinglistswithout whomitwouldbeimpossibleforustogainalotofknowledgeandideas. Iwouldliketothankmanyofourcomradesthatmanagedtokeeptheirspirithighinmakinga significantchangeinIndonesiantelecommunicationarea.SomeofthemareSumaryo,DonnyBU, BasukiSuhardiman,HariyantoPribadi,M.Ichsan,HeruNugroho,MichaelSunggiardi,andJudi Prasetyo;aswellasmanyfriendsonthemailinglists. OnnoW.PurbowouldliketothanktheInternationalDevelopmentResearchCenter(IDRC) http://www.idrc.catosupporthisearlierworkonVoIP.EspeciallytoICT4Dgroup,specially,Richard Fuchs,RenaldLafond,GrahamTodd,JoshSkinner,SteveSong,NancySmyth,HeloiseEmdon, MireilleLerouxandFrankTulus. WewouldliketothankInformationSocietyInnovationFundISIFhttp://www.isif.asia,especially SylviaCadenaandherteamforsupportingusindocumentingourknowledgeoncommunitybased InternetTelephony. Wehopethisbookwillenablemorecommunitybasedtelecommunicationandtelephoneprovidersover theregionalInternet.Furthermore,wehopeitwillenablealowcostaccesstotelecommunicationinthe region. Jakarta,February2011 TheAuthors

VoIPCookbook:2

CHAPTER 1: VoIP Overview


Inmanycountries,specially,thedevelopingcountries,peopleseeksforlowcostcommunication solutions.Today,Internetisbecomingmoreaccessibleformanypeopleandcorporatesinthese countries.HavingaccesstoInternet,onemayeasilydeployTelephonenetworkovertheInternet infrastructure.ItisknownasVoiceoverInternetProtocol(VoIP)alsoknownasInternetTelephony. ThecuurentVoIPtechnologyisquiteadvanced.Itiscurrentlysimilarifnotmoreadvanceandmay replacetheexistingtelephonetechnologyevenrecognizingthe+<countrycode><areacode><phone number>format.Interestingly,mostofthetechnologyisopensourceandreadilyavailableonthe Internet.Furthermore,ourexperienceshowsthatthecurrentSoftswitchperformanceonaXeonServer machineisfairlysimilartomediumsizeTelcoswitch.Thus,itwouldbebeneficialforthosewhowish toimplementtelecommunicationinfrastructuretoseeksolutioninVoIPtechnology. Thisbookisaimedtoprovideapracticalknowledgetosetupacommunitybasedtelephonenetwork basedovertheInternetInfrastructureA.K.A.InternetTelephoneorVoiceoverInternetProtocol(VoIP). Manyrealworldexampleonequipmentandapplicationsoftwaresetupandinstallationsareprovided. Itishopedtoenablemorecommunitybasedtelecommunicationandtelephoneprovidersoverthe regionalInternet.Intheend,itwillenablealowcostaccesstotelecommunicationintheregion.

How VoIP Works for Dummies.


AoverlysimplifiedfigureonhowVoIPnetworkworkisshowninFigure1.1.TheheartofVoIP networkisthesoftswitch.Itstoresallinformationonthesubscribers.Inasimpleview,aVoIP softswitchbasicallyhasatablemappingthephonenumberofthesubscriberandthecomputerorIP addressofthesubscriber. Everytime,asubscriberwantstomakeacalltoanothersubscriber.Theclientequipmentwillaskthe softswitchthedestinationaddressoftheothersubscriber.ThedestinationaddresscanbeanIPaddress. Thus,thesoftswitchbasicallystoreinitstable,thephonenumberofthesubscriberandtheirIP address. VoIPwillbemorefun,aswecanuseIPPhoneinsteadofacomputerassubscriberequipment.IP Phonelookssimilartonormalphone.However,itismuchsmallerthanacomputer.Thus,theclient equipmentmayberun24hourswithoutconsumingtoomuchelectricity.

VoIPCookbook:3

Figure1.1HowVoIPWorks. Formoreadvanceduser,wemayinsertananAnalogTelephoneAdapter(ATA)intothenetwork.An ATAisanothertypeofclientequipment.ItmayactasgatewaybetweenVoIPnetworkandlegacy phonenetwork.Thus,anyoneonVoIPnetworkmaycalltotheoldphonenetwork.

Where to Start?
Thebookisdesignedtomeettheneedfor ThosewhowishtotryandtobecomeaVoIPuseronly. ThosewhowishtoexploreonhowtosetupmoreadvanceVoIPuserappliances. ThosewhowishtofindVoIPcorporatesolutions. Thosewhowishtoexploreonsettingupahomebrewsoftswitch. AdvancedtechiesthatwantstoknowindepthhowtooperateaTelcooverInternet. ForVoIPnewbieusers,equipedwithPC,soundcardandaccesstotheInternet,mightwanttoread Becomingauser(CHAPTER2)andlittlebitofInterconnectivityandTelephoneNumber Allocation(CHAPTER4). VoIPCookbook:4

ForthosewhowishtoexploreVoIPappliancesmightinterestedinVoIPHardwareforexperienced Users(CHAPTER3).Chapter3coversalotofhardwares,including,IPPhone,WifiPhone,Analog TelephoneAdapter,ADSLModem. ThosewhoaremoreinterestedincorporatesolutionsmightbeinterestedinVoIPIPPBXHardware (CHAPTER15)andAnalogTelephoneAdapterforconnectiontoPSTN(CHAPTER16).Any materialsonVoIPHardwareforexperiencedUsers(CHAPTER3)wouldalsohelp. ForthosewhowishtosetupahomebrewVoIPsoftswitch,itisbeneficialtoreadBrikerSoftswitch (CHAPTER7)andwithlittleefforttoreadAsteriskSoftswitch(CHAPTER5)andOpenSIPS HighPerformanceSoftswitch(CHAPTER8).ForadvancehomebreweratopiconENUM (CHAPTER9)mightbeofinteresttosetthesystemtorecognize+<countrycode><areacode> <subscribernumber>numberingformatasusedinTelconetwork. Therestofthetopics,suchas,VoIPBandwidth,conferenceserver,detailedondialplan,trunking, peering,evaluationofVoIPperformance,VoIPtroubleshootingareaimedformoreadvancedusersthat reallywantstofinetunetheInfrastructure.

What Is Internet Telephony?


Inasimpledefinition,VoiceoverInternetProtocol(VoIP)orinternettelephonyisatelephonenetwork overtheinternet(TCP/IP)network.Thus,youcoulduseVoIPanywhereaslongasyouareconnectedto theinternet. Therearetwomaininternettelephonytechnology,i.e.,H.323andSessionInitiationProtocol(SIP)that arefrequentlyused.TheformerisanolderstandarddevelopedbytheInternationalTelecommunication Union(ITU),theleadingUnitedNationsagencyforinformationandcommunicationtechnologyissues. Thelatter,SIP,isamoreadvancedtechnologydevelopedbytheInternetEngineeringTaskForce (IETF),alargeinternationalcommunityconcernedwiththeinternetarchitectureanditsdevelopment. Inshort,itissufficientforyoutoknowthattheseprotocolsarethemainengineofVoIP communication.ThisbookwillconcentrateonSIPtechnologyasitiscurrentlythemainenginebehind manyadvancedVoIPdeploymentontheInternet. HowgoodthequalityofVoIPcommunicationdependsonthetypeofCodecemployedinagiven communication.ShortforCodingDecoding,Codecisaprocessofturninganalogsignaltodigital signalviceversa,allowingaudioandvideotobesentoverthecomputernetwork.Insuchprocess, codecminimizetheuseofbandwidthfortransferringthesignaldatawhileensuringthatthevoice receivedremainsclear.Avarietyofcodecshavebeendeveloped. VoIPCookbook:5

DespitethatVoIPcommunicationcanbeprovidedforfree,youstillneedtomeetsomebasic requirements.Theyincludetherequiredequipmentsandsoftware.Attheveryleast,youneedanIP basednetworkusingTCP/IPandacomputerwithsoundcards,headsets,microphonespeakerandhave thecomputerbeconnectedtoanetworkortheInternet.Softphone,thesoftwarerequiredforVoIP communication,isprovidedforfree. Ifyouhavemoremoneytospend,youcanbuyVoIPreadyequipmentsthatcanbeoperatedwithno needforconfigurationorveryminimalconfiguration.Inaddition,youcanavoidthehassleofturning onyourcomputereachtimeyouwanttocommunicatethroughVoIP.Attheminimum,youcanbuyan IPPhone,aphonethatcanbepluggedintoLANnetwork.SomeoftheseIPPhoneshaveWiFi capability,allowingyoutousethephonewhenconnectedtoahotspotnetwork.Therearemanydevices enablingVoIPcommunication,someofwhichmayormaynotneedconfigurations. Ifyou'rebuildingamuchmorecomplicatednetwork,youcanimplementIPPBXorInternetTelephony GatewayalsoknownasAnalogTelephonyAdapeter(ATA),amediumbetweeninternettelephony networkandconventionalphonenetwork.

VoIPCookbook:6

CHAPTER 2: Becoming a user


NowthatyouknowwhatVoIPis,youmaywanttolearnhowtocommunicateusingVoIPtechnology. Forpracticalreason,inthisearlystageoflearning,wewilluseaSIPprovidercalledVoIPRakyat http://www.voiprakyat.or.id.,inordertohelpyougraduallyunderstandhowtouseVoIP.Theserviceis notfavorableforusersoutsideIndonesia,asVoIPRakyat'sserverisphysicallylocatedinIndonesia, therebymakingtheVoIPaudioqualitygoodforthosewholiveinIndonesiabutnotsoforusersoutside Indonesia.However,theknowledgegainfromVoIPRakyatexperiencesmaybeusedforanyavailable SIPprovidersinyourcountry.

PC to PC Internet Telephone Call


ThispartwillexplainthesimplestVoIPcalltechniqueusingacomputertocallanothercomputeror VoIPnetwork.Allyouneedisacomputerwithasoundcard,headset,microphoneandinternet connectivity.Howmuchtheseequipmentswillcostdependonthespecificationyouuse.Butsince VoIPforpersonalusedoesnotrequiresophisticatedequipment,theseequipmentswillnotcostmuch. Oftheserequirements,bandwidthisperhapsthemostimportant,asitdetermineshowgoodthevoice qualityofyourVoIPcommunication. ForthisPCtoPCcommunication,youneedtoregisterwithaSIPprovider.Theoneweprovidedasan exampleinthisbookishttp://www.voiprakyat.or.id.Thenyouwilllearnhowtoinstallasoftphonein yourcomputerthesoftwarerequiredforVoIPcommunicationhowtoconfigurethesoftphoneto registeryourselfusingtheSIPaccountyouhavecreatedandhowtousethesoftphone.

VoIPCookbook:7

Figure 2.1 a free SIP provider called VoIP Rakyat

VoIPCookbook:8

Figure 2.2 Registration Process in VoIP Rakyat

ClickRegister(Free)inordertoobtainafreeVoIPRakyatnumber.WithRegister(Free)clicked,there aresomeinformationyouhavetofillin.Theseincludeyouremailaddress,name,address,cityand country.NickNamefieldisprovidedforJabber(chatting)account.Attheendofregistrationprocess, weneedtoentertheprovidedSecurityCode.

VoIPCookbook:9

Figure2.7: Choosewhether youwantto createadesktop icon,quicklaunch iconandlaunch theapplication whenWindows starts

Figure 2.3 Successful Registation Process

Afterallinformationisfilledincorrectly,VoIPRakyatprovidesuswithaVoIPnumber,thepassword, NicknamerequiredtoallowustomakeacallandchattingthroughVoIPRakyatnetwork.Pleasenote thattheservernameisvoiprakyat.or.id. Withtheaccountprovided,allwehavetodoistotransformourcomputerintotelephonehandsetso thattocanbeusedtocallovertheinternettelephonynetwork.

VoIPCookbook:10

Using softphone
Selecttherightsoftphoneforyourcomputer.MostofthesesoftphonescanbedownloadedfromVoIP Rakyathttp://voiprakyat.or.id/download/,oryoucanfindeachofthemfromitswebsite. Cubix Idefisk SJPhone Xlite Ekiga http://www.virbiage.com/cubix.php http://www.asteriskguru.com/idefisk/free/ http://www.sjlabs.com/sjp.html http://www.xten.com/index.php?menu=download http://ekiga.org

Youneedonlyoneofsoftphones,dependingonwhicheverworksorsuitableforyou;

InstallingXLite

Figure2.4: XLite Welcoming Installation Window

Oncexliteinstallerprogramisrun,wewillbedirectedtoaWelcomingDialogProperties.Clickon Nexttoproceedtothenextstepoftheinstallationprocess.

VoIPCookbook:11

Figure2.5: CounterpathEnd UserLicense Agreement

Whatappearsnextisthelicensingagreementbetweenxlitecreatorandyoubeingtheuser.This ensuresthatxlitewillnotbeliableforthepoorVoIPvoicequalityproducedbyxlite.Justlikeearlier, clickontheIaccepttheagreementbuttonandclickNext.

Figure2.6: Determinethe locationwherethe softwarewillbe installed

NextXlitewillaskwheretheprogramwillbeinstalled.Thedefaultfolderis C:\ProgramFiles\CounterPath\XLite,asshowninFigure2.6.Youcanchangethefolderifyouwant. VoIPCookbook:12

Whicheverfolderyouchoose,clickNexttocontinuetheinstallationprocess.

Forquickerandeasierwayofusingxlite,youcanaddxliteasadesktopiconorevensetittoactivate whenWindowsstarts(SeeFigure2.7).ClickNexttoproceed.

Figure2.8: Thedialog Windows indicating that installationis inprogress

Xlitethenextractsallfilesrequiredfortheprogram(SeeFigure2.8).

VoIPCookbook:13

Figure2.9:The Windows showingthatthe installation processis completed

Oncetheinstallationprocessiscompleted,youcandirectlyrunXLitebycheckingtheLaunchXLite boxandclickingFinishbutton.

VoIPCookbook:14

XliteConfiguration
AlthoughXLitecouldrunthemomentyoucompletedtheinstallationprocess,itdoesnotmeanyou canuseitimmediately.Youstillhavetoconfigurethesoftphone.Itsconfigurationmenucanbeopened byrightclickingonXlite.XLite3.0hastwolinesthatcanbeoperatedsimultaneously.Thisimplies wecanestablishtwoconcurrentcalls,eachtodifferentdestination. Figure2.18 XLiteappears justlikean ordinaryphone

Figure2.14: EntertheSIP accountyouhave createdinXLite Configuration DialogWindow

VoIPCookbook:15

InXLite3.0configuration,youcanentertheSIPaccount(s)givenbyyourprovider.However,thefree softwareversionofXLite3.0seemstolimitthenumberofSIPaccountsonlyoneaccount.The previousversion,XLite2.0,allows10SIPaccountstobestoredandused.ClickAddtoenterthe informationoftheSIPaccountyouhavejustcreatedinVoIPRakyatorofanyotherSIPaccounts.

Figure2.15:With theAddbutton clicked,youcan seetheProperties oftheSIPaccount. Whatappearsfirst istheAccounttab.

Intheaccounttab,youhavetofillinyourusername,authorizationusername,whichisthephone numbergivenbytheprovider,thepasswordobtainedfromVoIPRakyatoranyotherSIPproviders;the proxyaddress,whichisvoiprakyat.or.id,theaddressofVoIPRakyat.Otherinformationyoualsohave tofillaredomain,whichisvoiprakyat.or.id,andDisplayname,anynameyouwanttoenter.This functionsasaCallerIDinatelecomnetwork.

VoIPCookbook:16

Figure2.16: TheVoicemailtabis usedtosethowyou wouldlikeSJPhone managesyour voicemail

IntheVoicemailtab,wecandeterminetowherewehavetodialinordertolistentoourVoicemail.For VoIPRakyat,thenumberis904.Enterthisnumberinto"Numbertodialforcheckingvoicemail".If youuseothrprovider,usethenumberprovidedbytheproviderinstead.

VoIPCookbook:17

Figure2.16: Settheparameters undertheTopology tabtodetermine howSJPhoneworks withNAT/Firewall

IntheTopologytab,youcanactivateXlite'sabilitytopenetrateFirewall/NAT,toidentifythepublicIP addressthatisusedandsoon.Youcanalsousethedefaultsettingsthatwillautomaticallyknowthe publicIPaddressthatweuse.However,NATmaystillbeproblematic,asnotallconfigurationcanbe traversedbysignalingprotocolandmediausedaSIPprovider. ForPresenceandAdvancedtabs,usethedefaultvalues.Someparametersyoucanchangearethetime intervalsusedtoperiodicallyregisterouraccounttotheSIPserver.ThisensuresthattheSIPaccount remainsregistered.Afterall configurationsarecompleted, clickOktoactivatethe configurations. Figure2.17: Withthebox underEnabled columnticked, youcannowuse yourSIPaccount VoIPCookbook:18

Onceeverythingisproperlyconfigured,theSIPaccountyouhavejustconfiguredwillbecome available.TicktheboxunderthecolumnEnabledtoactivatetheaccount.ThenclickClosetoclose theSIPaccountmenu. Withtheconfigurationcompleted,youcannowstartusingXLite.Iftheregistrationprocessis successful,youwillgetamessagestatingLoginonthesoftphonescreenorotherwisethemessage statesRegistrationErrorandyouhavetocheckwhetheryouhaveproperlyconfiguredthesoftphone. Toplaceacall,clickonthenumbersalreadyavailableorclickthenumbersonthekeypad.

InstallEkiga
Ekiga(formelyknownasGnomeMeeting)isanopensourceSoftPhone,VideoConferencingand InstantMessengerapplicationovertheInternet.ItsupportsHDsoundqualityandvideouptoDVDsize andquality.Ekigaisinteroperablewithmanyotherstandardcompliantsoftwares,hardwaresand serviceprovidersasitusesboththemajortelephonystandards(SIPandH.323). ToInstallEkigainUbuntu, sudoaptgetinstallekiga

ConfiguringEkiga
Principally,Weneedtodo Ekiga>Edit>Accounts>AddaSIPAccount Theneededinformartionwouldbe Name Registrar User AuthenticationUser Password :VoIPnumber :SIPServer :VoIPnumber :VoIPnumber :passwordVoIP

IntheearlystartofEkiga,weneedtosetseveralparameters.Wemaycanceltheearlyconfiguration VoIPCookbook:19

processanddoitlaterthroughConfigurationAssistantmenufrom Ekiga>Edit>ConfigurationAssistant ThedetailedprocessofConfigurationAssistanceisasfollows,

Figure2.18WelcomeBanner AwelcomebannerisshownfromtheConfigurationAssistantmenu.PressForwardbuttonomove VoIPCookbook:20

forwardtheconfigurationprocess.

Figure2.19EnterFullName. Thefirststep,weneedtoenterourfullnameintoEkiga.ThenpressForwardbutton.

VoIPCookbook:21

Figure2.10VoIPAccount Thenextmenu,wecansubmitourAccountatEkiga.net.Ekiga.netmayofferanaccounttomake calloutcallfromVoIP.Ifwedon'thaveanyaccountatEkiga.net,wemaypressForwardtocontinue.

VoIPCookbook:22

Figure2.11TypeofNetwork. Next,weneedtosetthetypeofnetwork.ThiswillaffecttheCODECusedtocompresstheaudio.Fora goodperformanceinLANenvironment,pleaseselectLAN.PressForwardtocontinue.

VoIPCookbook:23

Figure2.12TypeofSoundCard Next,weneedtosetthetypeofsoundcardtobeusedinVoIP.Ekigaisfairlysmarttodetectthe availablesoundcard.WehardlyneedtochooseorchangetheEkiga'sselectedsoundcard.Next,we needtopressForwardbutton.

VoIPCookbook:24

Figure2.13TypeofVideoCard Next,wecanselectthetypeofvideodeviceifoneisconnected.Ekigaissmartenoughtodetectany videodeviceonthesystem.Tocontinue,pressForward.

VoIPCookbook:25

Figure2.14Finish. Finally,theconfigurationprocessofEkigaiscompleted.Itwillshowthesummaryoftheparameterin Ekiga.PressApplytobeginusesEkiga.

VoIPCookbook:26

ConfiguringAccountinEkiga
ConfiguringanAccountinEkigamaybedonethroughmenu Ekiga>Edit>Accounts or Ekiga>CtrlE

ThedetailedofVoIPAccountconfigurationinEkigaisasfollows,

Figure2.15StartAccountConfiguration. AftertheAccountmenuisactivated,wewillseetheabovefigure.

Figure2.16AddSIPAccount. ClickonAccounts>AddaSIPAccount

VoIPCookbook:27

Figure2.17AddSIPAccountinformation. IntheaboveExample,weentertheparametertouseSIPaccountinVoIPRakyat.Enterthedata, namely, Name Registrar User AuthenticationUser Password NabilSuhaemi voiprakyat.or.id 123456 123456 <yourpasswordinvoiprakyat.or.od>

VoIPCookbook:28

Figure2.18AddSIPAccountinformation. Intheabovefigure,wesettheparameterforlocalVoIPsoftswitchatIPaddress192.168.0.3.

Figure2.19EnableSIPAccount. MakesuretheaccountisactivatedbyclickinontheAcolumn.Tousetheaccount,weneedtomake suretheaccountisregisteredtothesoftswitch.

VoIPCookbook:29

Figure2.20EkigaReadytouse. ShownintheabovefigureisEkigaafteritsuccessfullyregisteredtothesoftswitch.Atthebottomof thesoftswitchwecanreallyseethatitRegisteredsip:....Atthispoint,wecanmakeacallby puttingthedestinationnumberinafterthesip:field.

Test your SIP Softphone


Nowthatyouhaveadjustedbothsoftphones(orjustoneofthem),thenextimportantthingyouhaveto doistotestwhetheritcouldrunproperly.Notethatthequalityofthevoiceproducedbythesoftphone duringthetestmayhavebeenjustfine,butwhenyoursoftphoneisconnectedtoaVoIPprovider,the voicequalitycouldbepoor,dependingonmanyotherthingssuchasbandwidthavailabilityandthe typeofcodecrunbythesoftphone.Forthistestpurpose,VoIPprovidersusuallyprovidethetelephone numbertowhichyoucandial. Ifyourcomputerisconnectedtoaninternetbehindafirewall,thefirewallmightblockyour connectivity.InordertomakeyourVoIPconnectivityworkingbehindthefirewall,youhavetoopen Port50606060toenableSessionInitiationProtocol(SIP)andPort800020000forvoicedatadelivery usingRealTimeProtocol(RTP).Butifyou'renotsurewhattodo,youcansimplyaskyournetwork VoIPCookbook:30

administratortodowhatistoldhere.

Figure 2.21: Just like other VoIP Providers, VoIP Rakyat provides its users with some numbers with which the users can use for testing their VoIP quality

GotoVoIPRakyat'sServiceNumberpage,http://voiprakyat.or.id/services/.Thispageprovidesyou withsomenumbersthatcanbeusedtotestyourVoIPconnectionandtheirfunctions.Someofthem are: 901whichindicatesthetimeJakarta'stimeandnearbycountries. 902noise 903echotest

VoIPCookbook:31

Figure 2.22: Through VoIP Rakyat's Phonebook, you can see who's online

Intestingthisconnectivity,whatuserswilloftendoistocallanyonefoundonlinein http://www.voiprakyat.or.id/?inc=online_phones.Sodon'tbesurprisedifsomeonedialsyournumber. Dependingonwheretheusersare,thecallcomesfromavarietyofcountries,includingtheU.S. ThereareofcourseotherVoIPphonenumberswhichyoucanusetotestyourVoIPconnection.These areprovidedinalonglistavailableinhttp://www.voipinfo.org/wiki/view/Phone+Numbers.Ifyouwant tocallusingSIPaddressformat(sip@domain.com),thefollowingisatableofsomenumbersyoumay use:

VoIPCookbook:32

Function

SIP Provider

SIP

Enum

Autoattendant BC Wireless 1000@mutual.bcwireless. 1 604 484 5289 x8600 (http://www.bcwireless.net/moin.cgi/N net through E164.org etworkServices/VoiceServices/PublicC onferenceRoom). Enum2go (http://enum2go.com/) Echo Test N3 Network Lab. (http://www.n3network.ch/) 878107472000010@sip2g o.com Echo test sip: echo@n3network.ch sip: 905100@n3network.ch (no G.729) Mouselike.org (http://www.mouselike.org/) VoipTalk (http://www.voiptalk.org/) Reread Called ID Welcome Line FWD Ewing IT Xmission (http://xmission.com/transmission) UCLA (http://internet2.edu/sip.edu) TELL U. Philippines (UK) 904@mouselike.org UK 904@voiptalk.org 95861111@mutual.bcwire less.net 55555@fwd.pulver.com 611300766674@sip.like2f one.com xmission@pbx.xmission.c om (tidak ada G.729) 13108254321@ucla.edu (tidak ada G.729) 18005558355@proxy01.si pphone.com 0116329818500@proxy01 .sipphone.com +441483604781

Personal Telco 274185@fwd.pulver.com (http://wiki.personaltelco.net/moin.cgi/

VoIPCookbook:33

SipPhoneDirectory) Patton Electronics (http://www.patton.com/support) Party Line support@patton.com (tidak ada G.729) 17475552663@proxy01.si pphone.com (VoIP conference setiap sabtu jam 20:00 GMT) music@trysip.ingate.com 16172531000@proxy01.si pphone.com

Ingate (http://www.ingate.com/trysip.php) MIT (http://sipphone.com/numbers)

VoIPCookbook:34

CHAPTER 3: VoIP Hardware for experienced Users


Onceyouareexperiencedinusingsoftphone,youmaystartwonderingwhetherthereisaneasierway tocommunicatethroughVoIP,asusingsoftphoneviaacomputerisnotpracticalyouneedtoturnon yourcomputereachtimeyouwanttocommunicatethroughVoIPorkeepyourcomputerrunningfora longdurationjusttoreceiveincomingcall.Thismaynotbeprudentatall,sincethepurposeofusing VoIPistominimizeyourcost.Besideswastingelectricalenergy,thecomputerinwhichthesoftphone isrunningcouldcrash. SoinsteadofusingacomputertocommunicatethroughVoIP,youcoulduseVoIPhardware, equipmentsthatenableyoutocommunicatethroughVoIPefficientlyandaseasyasyouuseyour conventionalphone. CalledInternetTelephoneappliance,thesehardwaretypicallyhavethefollowingcharacteristics:

itisphysicallysimple,withitsdimensionslightlybiggerthanthesizeofacigarettebox. Thereareportsforconnectingtothenetworkorcomputer,suchasLAN/UTP,USBorwireless at2.4GHzfrequency. ThereisoneportormoreforconnectingtotelephoneswithRJ11port. Itcanbeconfiguredthroughtheweb.

However,VoIPhardwareisnotfree,asyoustillhavetospendsomemoneyforbuyingtheequipment. ForaboutUS$100,youcangetasetofdecentVoIPhardwareproducedfromChinaorTaiwan.But despitethiscost,VoIPhardwarearehighlyrecommended,asyoumayfindthebenefitsthehardware bringoutweighthecostyouhavetocover,intermsofeaseofuseandenergyefficiency. ThisChapterwillexplainseveralhardwareavailableinthemarketandhowtoconfigurethem:IP Phone,InternetTelephoneGatewayorbetterknownasAnalogTelephoneAdapter(ATA),andWireless IPPhone.TheywayyouconfigureVoIPhardwareisnotmuchdifferentfromwhatyoudowith softphone.BasicallyallyouhavetoconfigurearetheIPsettings(IPaddress,subnetmask,and gateway)andregistrationtoSIPserverorproxyserver(Usernameortelephonenumber,passwordand hostnameserver).Often,IPsettingsisconfiguredautomaticallyusingDHCPserveroperatingina network,soyoudon'thavetosettheIPaddress,subnetmaskandgateway.

VoIPCookbook:35

Linksys PAP-2 Analog Telephone Adapter


Figure3.1: WithATA,you canuseyour PSTNphonefor VoIP communication

ThesimplesttypeofVoIPhardwareistheAnalogTelephoneAdapter(ATA),whichcaneasilybe connectedtoaconventionaltelephone.TheATAusedasanexampleinthisbookistheLinksysPAP2, whichhastwoRJ11ports(FXSports)thatcanbeconnectedtotwoconventionalphones.Eachofthese portscanberegisteredtoaSIPProxyserverindividually.Asaresult,wecouldhavetwoSIPaccounts, eachconnectedtoaconventionalphone. WhatwehavetounderstandisthatanATAhastwotypeofRJ11connections,namely,


FXOtobeconnectedtoPSTN/Telcoline/PABXextension. FXStobeconnectedtoTelephoneline/FAX.

AfterallUTP,LAN,powerandtelephonecablesarepluggedin,youhavetofirstofallfindouttheIP addressoftheLinksysPAP2sowewillbeabletoconfigureusingtheweb,bycarryingoutthe followingsteps:


Press*repeatedlyonthephonekeypaduntilyouhearsomeonetalkingthroughyourphone. Press110#tolistentotheIPaddressfortheLinksysPAP2configuration.

ThenextstepistoconfigureyourPCsothatyoucanconfigureLinksysPAP2throughtheweb.Allyou havetodoismatchthefamilyIPaddresstoPAP2's,bydoingthefollowing:GotoStart,OpenControl Panel,Networkconnections,localAreaConnection,InternetProtocol(TCP/IP)andProperties.Then gotoWebLinksysPAP2fromyourPCthroughthisaddresshttp://ipaddresspap2/. VoIPCookbook:36

Figure3.2:TheinitialmenuthatwillappearisthestatusofLinksysPAP2 ClickAdminLogin,whichisonthetoprighttobegintheconfigurationasanadministrator.

VoIPCookbook:37

Figure3.3:YoucandeterminewhetheryouwanttousedynamicorstaticIPaddress TovieworchangetheIPaddressconfiguration,clickSystem.CheckwhethertheIPaddress,Gateway andDNSputinplacearecorrect.Alternatively,setDHCPtoyessoLinksysPAP2willusetheIP addressthatisobtainedautomatically.

VoIPCookbook:38

Figure3.4:Eachline(line1and2)hasitsownsettingsintheadministrationpanel InLinksysPAP2wecansetuptwoSIPaccountsregisteredwiththeSIPProxy,witheachaccount connectedtoaphone.Theaccountsettingscanbedoneinmenu"Line1"and"Line2".

VoIPCookbook:39

Figure3.4:Line2taboftheadministrationpanel Fewimportantstepstodoinactivatinganaccountinbothmenus: SetLineEnabletoyes. Fillinyouraccountusingthefollowingparameters: Proxy UserID Password UseAuthID voiprakyat.or.id telephonenumbergivenbyVoipRakyat thepasswordgivenbyvoiprakyat no

IfyousetAuthIDtoyes,thenfillinAuthIDwiththetelephonenumbergivenbyVoIPRakyat.Dothe sameprocessforyourotherSIPaccount,theoneregisteredwithPAP2Line2.Actuallytherearemany VoIPCookbook:40

otherparametersthatcanbeconfigured,butforanormaloperation,itisnotnecessarytoconfigure them.Soitissufficientforustousethedefaultconfigurationvalues.

Linksys IP Phone SPA 941


UsingIPPhonemightbemoreattractivetomostuswhowanttouseVoIP,ascomparedtousing Softphone,IPPhoneismuchsimplertouse.Itisphysicallysimilartoaconventionalphone,butunlike conventionalphone,IPPhoneisdesignedtouseforVoIP,sothereisnoRJ11portliketheone availableinconventionalphones.

Figure3.5:AnIPPhoneFigure3.6:IPPhonetypicallyhastwoRJ45ports WhatIPPhonehasinsteadistheRJ45portforitsLANconnection(ethernetsocket).Asyoucanseeat thebackofIPPhone(showninfigure3.6),bothportsareofRJ45,onetobeconnectedtoaLAN whileanothertothecomputer.Thisallowsustousethephonewhileusingthecomputerforthe internet.Howeverkeepinmindthatyourbandwidthmaynotbesufficientforboth.Soonlyusebothat thesametimewhenyouthinkyouhaveenoughbandwidthtoensurethequalityofyourVoIP communicationremainsgood.AnIPPhonecanusuallybeconfiguredthroughtheweb. ThereareabundanttypesofIPPhoneinthemarket.Youcanfindthematthefollowinglink: http://www.voipinfo.org/wiki/view/VOIP+Phones. ThesortofIPPhoneweuseasanexampleisSPA941.ToobtainitsIPaddress,wehavetodothe following:

ClickMenu(illustratedaspapericonbelowthemailbutton) Clickthecursorsoitwillprovideadropdownmenu Findnetwork VoIPCookbook:41

ThereyouwillfindtheIPaddressofSPA941. NextyouhavetoconfigureyourPCsothatyouwillbeabletoconfigureLinksysSPA941throughthe web.GotoPC,matchtheIPaddresstothatofSPA941bychoosingStart,ControlPanel,Network connections,LocalAreaconnection,InternetProtocol(TCP/IP)andProperties.

Figure3.7:ThefirstappearanceyouwillseeisthestatusofLinksysSPA941. GotoLinksysSPA941webthroughhttp://ipadressspa941.

VoIPCookbook:42

Figure3.8:Choosewhichinternetconnectiontypeyouwanttohave Inthesystemmenu,wecanconfigureourIPaddress,netmask,gatewayandDNSofSPA941.Ifyou wishtohavetheIPAddressbedetectedautomaticallyusingtheinformationobtainedfromDHCP server,youcanjustsetDHCPtoyes.

VoIPCookbook:43

Figure3.9:ByclickingonExt2tab,youcansetsomeimportantparametersofExt2line. BylogginginasAdmin,wewillseethatSPA941hastwoexternallines:Ext1andExt2.Eachofthem canbeconfiguredsoastoberegisteredtodifferentSIPproxy.

VoIPCookbook:44

Figure3.10:ByclickingonExt1tab,youcansetsomeimportantparametersofExt1line TherearetwostepsneededtoactivateanaccountatmenuExt1orExt2: SetLineEnabletoyes. Fillinthethefollowingparameterswiththeinformationpertainingtoyouraccount: Proxy UserID Password UseAuthID voiprakyat.or.id thetelephonenumbergivenbyVoIPRakyat thepasswordgivenbyVoIPRakyat no

IfUseAuthIDissettoyes,thenfilltheinAuthIDwiththetelephonenumbergivenbyVoIP Rakyat.DothesamefortheotherSIPaccountyouwanttoregistertoExt2ofLinksysSPA941.

VoIPCookbook:45

Figure3.11:Thephonetabofadministrationpanel InLinksysSPA941,wearegiventhefacilitytoopenaspecificExtbyusingtheLineKeybuttononthe rightside.FourLineKeybuttonsareavailable.OnemayprogramthesefourbuttonstwoforeachExt Line.Todotheprogramming,youhavetobeanadmin,bycarryingoutthefollowingsteps:choosean extension(either1or2)foreachLineKeyandshownumberandfillinitwiththenumberorUserID givenbytheSIPProvider.

WiFi IPPhone
WiFiPhonescanbeusedforinternettelephonyconnectedtoIPPBXviaWiFiorHotSpot.Inother words,thephonecanbeusedasanextensionofaPABXoraphonewhichisconnectedtoahotspot. SomeoftheseWiFiPhonemayhavedualfunctionsGSMmodeandVoIPitallowsthepossibility ofreceivingaGSMcallorVoIPcallthroughWiFimodeasanextensiontoanIPPBX. VoIPCookbook:46

OperatingWiFiPhoneisnotdifficult.AllyouhavetodoareconfigureyourSIPaccountbyentering thenameoftheserver,telephonenumberandpassword;searchinganyavailableWiFiaccesspoint;and connecttoaWiFiAccessPointandgetanIPaddress. NowthatyouunderstandwhatWiFiPhoneisandhowtooperatethem,wewillprovidesomeexample onhowtoconfigureandoperateWiFiPhones.

LinksysWirelessGIPPhone
LinksyslaunchedaWirelessGIPPhoneadedicatedWiFiPhone.ItisnotaPDAnorordinary cellphone(Seefigure3.12).IfyouhavetheWiFiPhoneproperlyconfigured,connectedtotheWireless AccessPointandregisteredtoaVoIPSoftswitch,thenwhatshouldappearonthescreenofthephoneis thenameoftheaccesspointandthetelephonenumberofthephone.Underthiscircumstance,theWiFi Phoneisreadytobeusedforcalling.

Figure 3.12: Wireless-G IP Phone

Figure 3.13: WiFi Phone can be used for VoIP call when it is properly configured

InLinksysWiFiPhonemainmenu,thereareatleasttwo(2)thingsyouhavetoconfiguresothatyour phonewillfunctionwell.Firstly,thewirelesssettings,bywhichwecanscananyaccesspointwireless frequencyandconnectourphonetotheaccesspointsowecanbeconnectedtotheinternet.Secondtly, thePhoneSettings,allowsustoconfiguretheSIPserverthatweusetocall.Forthelatter,youneedto fillintheinformationpertainingtophonenumbers,passwordsandtheserversused.Sinceweareusing VoIPRakyatasanexample,theinformationshouldbethoseofVoIPRakyat.

VoIPCookbook:47


Figure3.14: Throughthephone menu,youcan makedirect configurationin ordertomakeyour phoneVoIPenabled

ConfiguringtheWiFiPhoneusingmenushowninthefigure3.14iseasy,butsincethereisnosoftware thatcouldhelpuscapturethescreensforconfiguringthephone,weusethewebconfigurationinstead forthepurposeofhelpingyouunderstandhowtoconfiguretheWiFiPhone.Thesameresultshould otherwisebesimilartothatofdirectphoneconfiguration.IncontrasttoWiFiPhonethatiscombined withPDAorGSM,LinksysWiFiPhonecanbeconfiguredusingtheweb,inadditiontofeature allowingyoutodirectlymakeconfigurationusingthemenuavailableinthephonescreen.

Figure3.15:Enter theusernameand passwordtologin theadministration panelsothatyoucan configurethephone

VoIPCookbook:48

Thewebwillappearaswhatisshownasfigure3.15.Itisthedisplaypromptingyoutoenteryouruser nameandthepasswordrequiredtoauthenticateyouraccount.Thedefaultfortheusernameand passwordisadminandadminrespectively.

Figure3.16:ThroughtheNetworkTaboftheadministrationpanel, youcansethowyouwillobtainyourIPaddress Onceyouhaveenteredtheusernameandpassword,youwillbebroughttotheadministrationpanel wherebyyoucanconfiguretheIPaddress.Normally,inahotspotthatprovidesanyuserconnectingto itwithfreeIPaddress,wejustneedtosettheconfigurationtoAutomaticConfigurationDHCP.In thecasewheretheIPaddressisnotprovidedautomaticallybythehotspot,youhavetomanuallyenter theinformationpertainingtotheIPaddress,subnetmask,gateway,primaryandsecondaryDNS.The MACaddressoftheWiFiPhoneappearsbydefault.Onceyouhavefinishedenteringtheseinformation, clickSaveSettingstosavethemintothememory.

VoIPCookbook:49

Figure3.17:ByclickingonthePhonebookmenu, youcanAddnewphonenumbersordeleteexistingones InthePhonebookmenu,wecanaddnewnumbersordeletetheonesalreadylistedthere.Wecanalso includemultiplenumbersforeachperson.

VoIPCookbook:50

Figure3.18:SIPSettings IntheSIPSettingstab,wecanconfiguretheIPaddressoftheSIPProxy,SIPPort(usually5060),the IPaddressoftheSIPRegistrar(usuallythesameasthatofSIPProxy),RegistrarPort(alsousually 5060),andSIPaccountnumberconsistingoftelephonenumberandthepasswordrelated.AsforVoIP RakyatSIPinformation,fillintheSIPProxyandSIPRegistrarwithvoiprakyat.or.id.

VoIPCookbook:51

Figure3.19:TheNATSettings IntheNATSettingsmenu,youcanconfiguretheProxyaddressandProxyPort.TheProxyaddressfor VoIPRakyatisvoiprakyat.or.id.AndtheProxyPortnormallyusedis5060.

VoIPCookbook:52

Figure3.20:TheSIPSDPSettingstab InSIPSDPSettingstab,wecanconfigureseveralthingsrelatedtothetypeofCodec,packettime, DTMFRelay,UDPPortandRTPPort.Theseparametersaregoodbydefault,sojustleavethemasis.

VoIPCookbook:53

Figure3.21:Byclickingonthewirelesstaboftheadministrationpanel, youcanfindouttowhichhotspotthephoneisconnected IntheWirelesssectionwecanseetowhichAccessPointtheWiFiPhoneisconnected.

VoIPCookbook:54

Figure3.22:ByclickingontheAdministrationtaboftheadministrationpanel, youcanchangeyourpassword Inadministrationsection,wecansettheadministrator'susernameandrelatedpasswordfortheWiFi Phone.Thedefaultconfigurationforusernameandpasswordarebothadmin.

VoIPCookbook:55

HewlettPackardIpaq6395
PersonalDigitalAssistance(PDA)whichusesPocketPC(PPC)operatingsystem,suchasIpaq6395or otherkindofIpaqhavingWiFicapability,canbeusedforVoIPcommunication.Oneofthesoftware thatcanbeusedforthisPDAisSJPhonePPC,whichcanbedownloadedfrom http://www.sjlabs.com/sjp.html.Alsoavailableinthissitearethemanualsnecessaryforoperatingthe softphone.SJPhoneinstallationcanbedoneinthefollowingsteps:connectIpaqtoPCthroughthe providedUSBcableandrunthesoftwareonPC,andSJPhonePPCwillbeautomaticallyinstalledin Ipaq.

Figure3.23:Hewlett PackardIpaq6395

ActivatingIpaq6395'sWirelessCapability

VoIPCookbook:56

InordertoaccessinternettelephonyusingPDAIpaq,weneedtoactivatethewirelessconnectivity featureavailableinIpaq.ThroughIpaqWirelessmenu,presstheWiFibuttonsothewireless connectivitybecomesactive.


Figure3.24: ThroughiPAQ WirelessSettings, youcanenablethe phone'sWiFi feature

Ifallgoeswell,thecoloroftheWiFibuttonwillturngreen,asignwhichindicatesthatthedeviceis properlyconnectedtothewirelessnetwork.
Figure3.26: Byclickingthe Settingsiconnextto theWiFiicon,you canseetowhich networkyourphone isconnected

Figure3.25: ThegreenWiFi iconindicatesthat you'reconnected toawireless network

IfyouwanttomakefurtherconfigurationonhowyouusetheWiFiaccess,clicktheSettingsIcon, whichwillbringyoutoamenushowingvariousaccesspointsmonitoredbyIpaq6395.Choosethe accesspointtowhichyouwanttobeconnected.

VoIPCookbook:57

RunningSJPhone

Figure3.27: Inordertorun SJPhone,tapthe icon

SJPhoneSoftwarecanbefoundasaprogramofPocketPC.Torunit,simplypressthebutton.Notethat thetechniqueforoperatingSJPhonethroughPocketPCisnotsodifferentfromthatwhichrunsinon PC.


Figure3.29:The appearanceof SJPhonedialing console

Figure3.28: Enteryour accountnumber andtherequired passwordin ordertoinitialize theprofile

IftheSIPaccounthasbeenproperlyconfiguredinSJPhone,whatwillbeaskedfirstwhenyouactivate SJPhoneistheaccountnumberandpasswordrequiredtoaccesssuchSIPaccount.SJPhonewill appearlikewhatisshowninFigure3.29,withitsdialingkeypadandallthebuttonsneededfordialing upandhangingup. VoIPCookbook:58

Figure3.30: Throughtheuser informationtabof SJPhonemenu,we canenterourname, emailandlocation. Wecaneveninclude commentsandour image

Tapthemenubutton.Inmenu,wecanentertheinformationpertainingtotheuser,whichincludes name,emailaddress,locationandevenanypicturewewanttouseasourimage.

Figure3.31: Settingsofincoming andoutgoingcalls, andNATMapping refresh

Tapthecalloptiontab.Throughthistab,youcanconfiguresomethingslike:

whetherwewanttoautomaticallyreceiveallincomingcalls.Thismenuisinfactveryusefulfor thesortofIpaqwithsmallscreenthatmakesusdifficulttoreceiveVoIPcallsmanually. Whetherwewanttobeleftundisturbed,ignoringallincomingcalls. TheIPaddressusedforoutgoingcalls. LimitingtheCallerIDinuse.

VoIPCookbook:59

Ingeneral,theseparametersdonotneedtobechanged,possiblyexceptfortheAutomaticallyAccept IncomingCallstocompensateforthesmallPDAscreen.
Figure3.32: Undertheprofilestab, youcaneithermake newprofile;edit,use, initialize,renameor deleteexistingprofile

Intheprofiledialog,wecanmakedetailconfigurationforeachaccount.Basically,aprofiledefinesan account.,whichcanbeeitheraSIPaccountorH.323account.Thelatterisatechnologyonceusedby manyVoIPproviders.TheformerisatechnologyusedinVoIPRakyat.Thereareseveraloptions availableintheprofilemenu: Newtocreatenewprofile Edittoeditexistingprofile Deletetodeleteexistingprofile Usetouseexistingprofile Initializetoinitializeaprofile Renametochangethenameofexistingprofile
Figure3.33: Enterthenameof theprofile,thetype ofinterfaceituses, andthenameofthe profilefile

VoIPCookbook:60

Wheneditingaprofileforthefirsttime,wewillbebroughttothegeneraltaboftheprofile.Herewe candefinethenameoftheprofile,thetypeandnameoftheprofilefile.ForVoIPRakyat,theinterface typeweuseisSIPProxy.

Figure3.34 Throughthe initializationtab, configurewhat needstobe inquired,savedor required

Ininitializationtab,wecansettheuserdatainitializationprocess,includingphonenumber/account, passwordandCallerID,whetheruserswillbeinquired,thedatapertainingtotheseparametersneedto besavedorrequired.Itisrecommendedthatyouusethedefaultsetting,leavingthethesettingsasis.

Figure3.35: Inordertoenable SIPProxy,enterthe requiredinformation intheSIPProxytab

VoIPCookbook:61

Ofallmenusrequiredforconfiguringaprofile,SIPProxyisperhapsthemostimportant.The informationenteredtherewilldeterminewhethertheSIPsoftphonecanactuallybeusedornot.The informationyouhavetoenterareasthefollowing: ProxyDomainisyourSIPProxyserver.ForVoIPRakyat,theproxydomainisvoiprakyat.or.id. TheProxyDomainPortisusually5060. UserDomainforVoIPRakyatisvoiprakyat.or.id. ClickRegisterwithproxy


Figure3.36: Additionalsettings availableinthe Advancedtab

InAdvancedtab,wecanconfiguremoresophisticatedfeaturessuchasvoicemailnumber,removing fancycharactersfromphonenumbers,acceptredirectionrepliesetc.However,tooperateSJPhoneina standardmode,wedon'thavetochangetheseparameters.

Figure3.37: SettingsofDTMF tab

VoIPCookbook:62

InDialToneMultiFrequency(DTMF),wecanchooseseveralthingsrelatedtoDTMF: DTMFissentasvoiceortextdatausingRFC2833. Thedurationofthetone.Thedefaultvalueusedis270ms. TypeofRealTimeProtocolusedinRFC2833is101. ThedefaultDTMFsignalvolumeis10dBm0 Thepausedurationduringwhichthesignalissentininbandmode.Thedefaultvalueis100 ms.


Figure3.38: STUNSettings

TheSTUNtaballowsustodeterminewhichserverwillbeusedtohelpSIPfindtheIPaddressweuse. ThedefaultSTUNserverusedisstun.softjoys.com,withport3478.SoifyouwanttoapplySTUNto VoIPRakyat,youcanuseUDPPort3478and3479.


Figure3.39: Theappearanceof theconsoleshowing successfulSIP registration

VoIPCookbook:63

Ifitissuccessfullyregistered,thenthedisplayofthescreenwillsaySIP:registeredasnumber@server SIP,withthehostnamealsoshownonthescreen.Underthiscircumstance,SJPhoneisreadytobe used.WecanplaceacallthewayweusearegularcellphonewithaPDA. SJPhoneFeatures

Figure3.40: Tapthephonebook iconinorderto savecontact numbersandcall them

ThereareseveralfeaturesprovidedbySJPhonetohelpusersinusingthephone,oneofthemisthe phonebookicon(looklikeanopenbook),whichislocatedatclosetothebottomofthescreen.Through thisoption,wecanenterthenamesandnumberofourfriends.


Figure3.41: Thephonebookis stillempty,with theAddiconthe onlyavailable optioninthe phonebooktab

VoIPCookbook:64

Toaddacontact,simplytapAdd,whichisavailableinPhonebooktab.

Figure3.42: Enterthe information pertainingtoa contact

Withtherespondentdialogpropertiesopen,weneedtoenterthename,nickname(optional),emailand phonenumber.Youcanalsocommentontheuser,perhapsjustincaseyouwillforgetwhothisperson is. UsingSJPhonetoplacecallthroughIpaq6395

Figure3.43: Dialsomenumbersin ordertoplaceacall

VoIPCookbook:65

Figure3.44: Acallis successfully connected

ToplaceacallusingSJPhoneinIpaq6395isnotdifficult.Allwehavetodoistoenterthedestination phonenumberandpressthedialkeylocatedonthetopright.Ifthecallisconnected,amessagesaying so,thedurationtimeoftheconversationandthecodecinusewillappearonthescreen.

Figure3.45: Bytappingonthe outgoingcallicon, youcanseethe listofthenumbers youhavecalled andtheduration ofthe conversation

OutgoingCallStatisticcanbeviewedbytappingonthephoneiconwithatriangulararrowpointing downward. VoIPCookbook:66

Figure3.46: Bytappingonthe incomingcallicon, youcanseethelist ofthenumbers dialingyour numberandthe durationofthe conversation

Incomingcallstatisticscanbeaccessedonthetabavailableatthebottomofthescreen,withthetab appearingasaphonewithatriangulararrowpointingtowardthephone.

Figure3.47: Bytappingonthe missedcallicon,you canseethelistof missedcalls

MissedCallstatisticscanbeviewedonthemenuavailableatthebottomofthescreen,withtheicon appearingasaphonewithastopsignbelowit. VoIPCookbook:67

Nokia
Aspartofcellularmajorindustry,Nokiaseemstohaverecognizedthatinternettelephonywillbe instrumentalinthefuture.AssuchNokiamakesitpossibleforSymbianoperatingsystemtooperatein Nokiahandphone,providingcustomerswithacellularthatcanbereadilyusedforinternettelephony.In theexample,wewilluseseveralNokiahandphone,suchas,NokiaE61,NokiaE71andNokiaN80.The formerismoreofPDAtypecellularphonewhilethelatterissmallintermsofdimension.NokiaE61, NokiaE71andNokiaN80areWiFiPhone. TheWiFiphoneconfigurationforallNokiaissomewhatsimilar,withminordifferencesintermsof menuappearance.Sogenerally,thosewhoareusedtoSymbianshouldnotencountersignificant challengesinturningtothesephones.

Figure3.48:NokiaN80

VoIPCookbook:68

Figure3.49:NokiaE61

NokiaWirelessConfiguration

Figure3.50: Nokia'sconsole

Nokia'sconsoledisplaylookslikewhatisshowninFigure3.51.Therearethingstobeconfiguredso thatNokiacanbeconnectedtobothWiFiandVoIP:

EnableWiFiandcreateaprofileofanaccesspointthatcanbeaccessed. CreateSIPaccount. CreateaProfilefrominternettelephonyfacility.

VoIPCookbook:69

Clicktheglobeicontoopenthemenu.
Figure3.51:Byclicking themenuicon,wecan selectavarietyofoptions .

Withthemenuopen,selecttools.Throughthisoption,wecanconfigureWiFi,SIP,internetphoneand othersettings.
Figure3.52: Therearemanyoptions availableinToolsmenu.

WiththeToolsiconselected,selectSettingsinordertoaccessconnectionmenuallowingusto configureWiFi,InternetTelephoneandSIPsettings.

VoIPCookbook:70

Figure3.53: UndermenuSettings, configuretheConnection

InSettings,thereareseveraloptionswecanchoose:Phone,Call,Connection,DateandTimeand Security.ToconfigureWiFiAccessPoint,SIPSettings,andinternettelephony,weneedtoconfigure usingtheConnectionsubmenu.


Figure3.54: Optionsavailableunder Connection

IntheConnectionmenuthereareafewmoreoptions.Weneedtoconfigureonlythreeofthem:Access Points,SIPSettingsandInternetTelephonySettings.SelectAccesspoints.

Figure3.57: Thereisnoaccesspoint yetshownonthescreen

VoIPCookbook:71

WiththeAccesspointmenuopen,wecanaddAccessPoint,byselectingtheOptionsmenulocatedat thebottomleftfthedisplay.
Figure3.58: Youcaneithermake newaccesspointoredit ordeleteexistingaccess points.

ThereareseveraloptionsavailableintheAccessPointsmenu:Edit,NewAccessPoint,Help,Delete andExit.ToaddanewAccessPoint,selectNewAccessPoint,whichwillbringtwomoreoptions:Use defaultsettingsandUseexistingsettings.Assumingthatthisisthefirsttimeyou'reusingthephone, selectUsedefaultsettings.


Figure3.59: Creatinganaccesspoint profile

ForcreatinganAccessPointprofile,weneedtosettheConnectionname,typeofconnection(Data bearer),andthenameofWLANnetwork.Fordatabearer,chooseWirelessLAN.

VoIPCookbook:72

Figure3.60: Youcaneitherenterthe networkinformationyou alreadyknoworsearch foranynetworksreached byyourcellular

Ifyouknowthenameofthenetwork,enteritmanually,byselectingEntermanually.Otherwise,letthe phonefindanyavailablenetwork,byselectingSearchfornetwork. SIPServerandAccountConfigurationinNokiaE61


Figure3.61: Youcandothe configurationofSIPserver andaccountbyselecting Options

ThroughSIPSettings,wecanconfigureSIPaccountsthatwillbeusedforcalling.Thesettingsisdone throughOptionsmenuinSIPSetting.

VoIPCookbook:73

Figure3.62: SettingsDemovoip Profile.

TherearesomeparametersofSIPSettingsthatneedtobeconfiguredcorrectly: CreateanameforProfilename. ChooseIETFforServiceProfile. FillDefaultAccessPointwithinformationofAccessPointprofileweusetoconnecttothe internetnetworkthroughWiFi. MakesurethatyoufillPublicusernameparameterwiththeproperformatofSIPnumberyou use.Forexample,23123@voiprakyat.or.idor2002@192.168.0.2.Theprefixsipwillbeadded automaticallyincasethatyouforgettoincludeit.

Figure3.63: SIPProfileinSIPSettings inNokiaE61

Nextweneedtosetthefollowingparameters: SetUsecompressionparametertoNo. SetRegistrationparemetertoWhenneededsothatNokiawillpromptuswhetherwewantto connecttoaSIPsoftswitcheachtimewewilluseSIPPhone. SetUseSecurityparametertoNo.

VoIPCookbook:74

Figure3.64: Proxyserversettings

ThroughtheProxyServerAddressmenu,weneedtoconfigurethefollowing: ProxyServerAddress. Realmforsomereason,itisbesttofillthisparameterwithatelephonenumbersimilartoour username.InAsteriskIPPBX,thedefaultrealmisasterisk. UsernametelephonenumberorSIPusername. Passwordleavethisblank. SetallowlooseroutingtoYes. FillinTransportTypewithUDP. FillinPortwith5060.


Figure3.65: Regist.serversettings

InRegistrarServer,weneedtoconfigurethefollowingparameters: FillinRegistrarServerAddresswithhostnameorIPaddressofourSIPserver.ForVoIP Rakyat,entervoiprakyat.or.id. FillinRealmwiththetelephonenumberorusername. FillinUsernamewithSIPtelephonenumber. Leavepasswordblank VoIPCookbook:75

InternetTelephoneConfigurationinNokia
Figure3.66: InternetTelephony settings

InInternetTelephonySettings,wecancreateaprofileofInternettelephonyfacilitythatwillbeused usingNokia.Tosettheprofile,selectOptionsoftheInternetTelephonySettings.

Figure3.67: Makesuretheprofile chosenistobeusedasa defaultprofile

InInternetTelephonyProfileSettings,weneedtoincludeonlytheprofilenameandSIPprofilethat willbeusedforInternettelephony.Becarefulwhenyou'redoingso.Makesurethattheprofileselected istobeusedasadefaultprofile,otherwiseourcallwillberejectedwhenweattempttodialusingour cellulartotheVoIPnumber.AllthisordealisunnecessaryifwehavejustoneSIPaccount.

VoIPCookbook:76

Figure3.68: Selectingaprofile

TheSIPProfileselectionwillbecarriedoutmanuallybyselectingavarietyofSIPProfileswehave createdthroughSIPSettings. RegisteringtoVoIPSoftswitch

Figure3.69: ConnectivitySettings

ForestablishingconnectiontoVoIP,selectInternettel.(shownasaglobeiconwithyellowphone).This isassumingthatyouhaveproperlyconfiguredInternetTelephonysettings.UnlikeNokiaE61,Nokia N80connectstoVoIPthroughoptionavailableinafolderlabeledInternet.Gointothefolderand chooseInternetTelephone.

VoIPCookbook:77

Figure3.70:Internet telephonysettings

InInternettelephony(shownasInternettel.),wewillbeprovidedwithtwoparameters: PreferredProfile,thenameofInternetTelephonyProfileweuse. RegistrationStatus,theregistrationstatusofSIPaccountwesetinSIPSettings.


Figure3.71: Internettelephonysettings

IfwechooseWhenneededintheRegistrationparameterinSIPSettings,thestatusofinitial conditionofinternettelephonysetting,whenInternettelephonyisactive,isNotregistered.
Figure3.72: EnableWLANconnection inofflinemodesoNokia E61canbeconnectedtoa WiFinetwork

VoIPCookbook:78

IfweattempttochangethestatusfromNotRegisteredtoRegistered,whatNokiawillfirstlytryto establishconnectiontotheAccessPointwhichwehaveconfiguredinSIPSettings.WhenNokiaasks whetheryouwanttocreateWLANconnectioninofflinemode,selectYes.Thisselectionwillconnect NokiaE61toaWiFinetwork. Offlinemodecansomewhatbeproblematic,becauseifweareinofflinemode,itmeansthatalthough weareregisteredwiththeSIPserver,peoplearestillunabletocontactus.Tomakesurethatwecanbe contactedviaGSM,weneedtoactivateNokiasoitbecomesonlinemode.Onlinemodewillbe possibleonlyifweareusingSIMcardinthephoneandareconnectedtoacellularnetwork.Inonline mode,otheruserswillbeabletocontactusthroughbothVoIPorGSM.

Figure3.73: Aregistrationattemptin progress

OnceconnectedtoaWiFinetwork,wehavetowaitforawhiletoletNokiaregisteritselfwiththe Softswitch.
Figure3.74: Theregistrationis completed

Ifregistrationwiththeinternettelephoneiscompleted,thereshouldbeanotificationsayingso,as showninfigure3.73.SuchnotificationindicatesNokiacannowbeusedforinternettelephony. VoIPCookbook:79

CallingusingInternetTelephoneinNokiaE61
Figure3.75: InitialdisplayofNokia E61

PlacingacallusinginternettelephoneinNokiaissimilartohowwecallusingotherphone:Wejust needtotypethephonenumbertowhichwewantdial.
Figure3.76: Oncethenumberis dialed,weneedtochoose thetypeofcall.

ThenNokiawillaskwhetherthecallisofVoicecall(GSM),videocallorinternetcall.SelectInternet Calltoplaceacallusinginternettelephony.IfwechooseVoicecall,thenthemodeofcommunication usedtoconnectourcallisofGSM.

VoIPCookbook:80

Figure3.77: Thephoneiconwitha smallglobenexttoit indicatesthatthecallis established

Whenthecallisestablished,wewillgetanotificationonthescreenthatourtelephonenumberis connectedtothedestinationnumber.
Figure3.78: Youcaneithermutethe sound,activatehandset, endactivecall,holdthe ]call,makethecallopen activestandbyandplace newcall

Todisconnectacall,simplyselectEndactivecall.

VoIPCookbook:81

VoIP in ADSL Modem


EvenwhenVoIPiswidelyusednowadays,thereareonlyfewADSLmodemswithbuiltinVoIP equipment.OneofthemisLinksysWAG54GP2,asmallmodemthathastwoVoIPequipments. Configurationcanbedoneentirelyusingtheweb,makingitveryconvenientforbothusersandsystem administrators.
Figure3.79: anADSLmodem

VoIPCookbook:82

ADSLModemConfiguration

Figure3.80:TheBasicSetupsubtabundertheSetupTabofthemodemadministrationpanel Afterenteringtheadministratorpasswordandusername(defaultisadminforboth),wewillbedirected tothesetuppageofWAG54GP2LinksysADSLModem.Throughthispageyoucanconfigureseveral thingssuchas:


ConfiguringtheconnectiontotheInternet,typeofmodulationused,encapsulation, multiplexingtechniquesused,VCIandVPIvalueoftheADSLconnection. ConfiguringPPP,usernameandpassword DNSProxyServer

VoIPCookbook:83

Figure3.81:Thestatustabofthemodemadministrationpanel Thesetuppagealsoprovidesinformationongateway,connectivityconnectivityconditioninPVC status,andinternetconnectivityconditionincludingtheIPaddress,Subnetmask,Defaultgateway,DNS andfacilityusedtoconnectordisconnectaconnectivity.

VoIPCookbook:84

Figure3.82:TheWirelesstaboftheadministrationpanel InadditionwecanalsoconfigureavarietyoffacilitiesavailableinLinksysWAG54GP2ADSLRouter throughtheweb: Wireless Security AccessRestrictions Application&Gaming Administrator

Eachofthesehassubmenu,whichwewillnotexplainanyfurther,aswewillfocusmoreontheVoIP featureofthemodem.

VoIPCookbook:85

VoIPConfigurationinLinksysWAG54GP2

Figure3.83:TheSystemtabofthemodemadministrationpanel ThemenuforconfiguringVoIPonWAG54GP2canbefoundinitsVoicemenu.Ingeneral,howto configurethedeviceisnotdifferentfromtheconfigurationotherLinksysequipments,withthe followingsteps: Usermodeisprimarilyusedtoviewanyexistingconfiguration. Adminmodeismainlyusedtochangetheconfiguration.

InordertosettheSIPaccount,weneedtochangethebasicviewtoadvancedviewintheAdminmode. VoIPCookbook:86

TheinformationrequiredtosettheSIPaccountareasfollows: Username/telephonenumber. Password. SIPServeraddress.

Figure3.84:TheInfotabofthemodemadministrationpanel ItisrecommendedthatyoulookintotheInfosubmenuavailableinVoicemenu.Whatyouhavetolook inparticularistheLinestatus,specificallytheregistrationstateparameter.Onceeverythingisproperly configured,ensurethatwhatisstatedintheRegistrationStateisRegistered.

VoIPCookbook:87

Figure3.85:TheSystemtabofthemodemadministrationpanel SystemconfigurationuseswebfromVoIPLinksysWAG54GP2throughaspecificport,with1880as itsdefaultvalue.Thisportcanbeenabledordisabledthroughsystemmenu.Don'tforgettoclickSave Settingstostoretheconfigurationsettings.

VoIPCookbook:88

Figure3.86:TheInfosubtabofVoicetabofthemodemadministrationpanel InAdvancedView,wewillobtainmoreinformation.WhatweneedtoaccessisLine1andLine2 menusoastoconfigureSIPaccountinSIPsoftswitchused.Otherparametersinothermenubeside Line1andLine2neednottobechanged.

VoIPCookbook:89

Figure3.87:TheSystemsubtaboftheVoicetabofthemodemadministrationpanel Insystemmenu,ifnecessary,wecanincludePrimaryandSecondaryDNSparameters.

VoIPCookbook:90

Figure3.88:TheSIPsubtabofVoicetabofthemodemadministrationpanel ThroughtheSIPmenuwecanconfiguretheports,payload,CODEC,etc.Basically,theseparameters neednottobechanged.Wecanstilluseitsstandardparameterstoachievegoodresults.

VoIPCookbook:91

Figure3.89:Line1subtaboftheVoicetabofthemodemadministrationpanel InLinemenuparameter,wecansetSIPaccountthatisusedtoregisterwithVoIPsoftswitch.The parameterswehavetosetareasfollows: LineEnablesettoYessothelinebecomesactive. Proxyfillinwithname/hostname/IPaddressofthesoftswitchtobeused. DisplayNamefillinwithVoIPphonenumber. UserIDfillwithVoIPphonenumber. PasswordfillwithVoIPpassword.

UseAuthparameterusuallyissettoNo.IfitissettoYes,weneedtofillintheAudthIDparameter withtheVoIPtelephonenumber.ThesamesettingsalsoappliestoLine2. VoIPCookbook:92

CHAPTER 4: Interconnectivity and Telephone Number Allocation


QuestionsmostlyaskedbyVoIPusersiswhetherVoIPcanbeusedtodialandreceivecallsfroma PSTNorcellularnumber,sinceoneofourpurposesinusinginternettelephonyisthatwewanttohave thistwowayinterconnectivity,particularlytobeabletoreceivecallsfromPSTNorcellular. Unfortunately,thismightnotbeaseasyaswethink,ascallsoriginatingfromPSTNorcellularcan reachoftenonlytelephonenumberslegitimatelyrecognizedbythePSTNorcellular.Thesenumbers areallocatedbyE.164,theofficialnumberingsystemacknowledgedbytheInternational TelecommunicationUnion. However,thegoodnewsisthattherearesomeleewaysmakingitpossibleforustocallPSTNor cellularnumbersusingVoIP.OneofwhichisbysubscribingtoaVoIPproviderthatprovidesuswith PSTNnumbers.Ontheotherhand,wecanalsoregisterourPSTNnumbertointernationalVoIP networksoourVoIPaccountcanberecognizedasalegitimatePSTNnumber.Thissectionwillhelp youunderstandindetailthetechniqueforobtainingthenumber.Wecouldgetafreephonenumber fromWashingtonState,US,(http://www.ipkall.com)whichenablecellular/PSTNuserstocalluson VoIPnetwork. NotethattoreceiveacallfromPSTNprovider,itissufficienttouseacomputer,softphoneandinternet connectivity,preferablykeptonlinefor24hours,asifweareusingordinaryphone.Obviously,aswe haveexplainedearlier,itispreferabletouseVoIPhardwaresuchasIPPhone.

VoIPCookbook:93

Getting Free Washington State Telephone Number

Figure 4.1: You can get a free phone number from IPKall

AwebsitethatprovidesWashingtonStatetelephonenumberforfreeisIPKallhttp://www.ipkall.com, withthenumberhaving+1prefix,theconventionalcountrycodeforUnitedStatesofAmerica.Itis VoIPCookbook:94

interestingtonotethatthisnumber,althoughavailableasavirtualnumber,canactuallybecalledfrom otherPSTNnumberindifferentcountries,witheachcountry'sinternationalratesappliedtothecall.To beabletoenablethenumber,youneedtohaveaSIPaccountfromaSIPproviderorusetheoneyou havecreatedinVoIPRakyat.

Figure4.2:Youcanlogonusinganexistingaccount,orcreateanewaccountonthespot VoIPCookbook:95

OncewehaveaSIPaccount,thenextstepwehavetodoissignuptowww.ipkall.cominordertoget WashingtonState'stelephonenumber.Inthesignuppane,chooseanyofthefollowingtheareacode: 206,253,360,and425.Whichevernumberyouchoose,enteradditionalinformationontheSIPphone numbergivenbyaSIPProvider(inourcase,it'sthenumbergivenbyVoIPRakyat),SIPProxy (voiprakyat.or.id),ouremailaddressforconfirmingtheaccountwearecreating,andthepasswordfor makingchangesinIPKallaccount.TypeintheCaptchagraphicalwords.Afterallparametersarefilled correctly,clickSubmittoproceed. Normally,wehavetowaitforaboutanhourtoreceivetheconfirmationsentthroughemail.Toactivate yourIPKallaccount,clicktheURLobtainedfromtheemail.Withtheaccountconfirmed,younow havetheStateofWashingtonphonenumberwithwhichyoucanreceivecallsfromotherPSTNacross theworldthroughyourSIPaccount.

VoIPCookbook:96

Free Internet Country: Country Code +882


OneoftheservicesimportanttoVoIPisENUM,whichcarriesoutmappingfromIPaddressto telephonenumberusingDomainNameSystem(DNS).Thephonenumbersystemfortelephoneweare familiarwith,theonewithspecificcountrycode,isknownasE.164format.Themappingprocessis usuallyperformedbyaDNSmachineintheInternet,throughNAPTRspecialentry.Therearetwo(2) mainTopLevelDomainsusedasreferenceinENUMprocess:e164.arpaande164.org.Theformeris thetopleveldomainnormallyusedbyformaltelecommunicationinstitutioncontrolledbythe InternationalTelecommunicationUnion.Inyourcountry,e164.arpaispossiblyunderthecontrolofthe country'sministryoftelecommunication.

Figure 4.3: e164.org main window

VoIPCookbook:97

The latter, e164.org, is the informal level domain provided by communities, the sort that are concerned with how people can minimize telecommunication cost. This is the domain we will use for our VoIP communication. We can register in http://www.e164.org to get an account that can be used to obtain a phone number and register the number.

Figure 4.4: To use e164.org, simply follow the instructions shown in http://www.e164.org/wiki/AsteriskExamples

Forsmoothinterconnectionprocessbetweenasterisksoftswitchande164.org,weneedtoconfigure /etc/asterisk/enum.confsotheAsterisksoftswitchwillbeabletorecognizethenumberslistedin e164.orgdomain,byactivatingthefollowingparameters: search=>enum.voiprakyat.or.id VoIPCookbook:98

search=>e164.org search=>e164.arpa Oncetheseparametersareactivated,thesoftswitchwillautomaticallyseekthePSTNnumbers availableine164.organde164.arpa.SinceweareusingVoIPRakyatasanexampleinthisbook,we willreferyoutoenum.voiprakyat.or.id,anENUMdevelopedinIndonesia.Youmaylaterchangethe parameterstoanyENUMproviderthatissuitabletoyourneedsorevendevelopyourownENUM server,asrunningonerequiresonlyaDNSserver. Entriesthatneedstobeincorporatedinto/etc/asterisk/enum.confare: search=>enum.voiprakyat.or.id

VoIPCookbook:99

Figure 4.5: Before you can be connected to e164.org, you have to sign up first

Throughtheregistrationpageofe164.orghttps://www.e164.org/signup.php,entertherequired informationinordertoobtainatelephonenumberorregisteratelephonenumber.Theinformationyou havetoenterareusername,password,youremailaddress,yourtimezoneandVerifyingcode.Then clickAddmetocompletetheregistration.Iftheregistrationissuccessful,youwillbeabletouse yournewlycreatedaccounttogetatelephonenumberassignedbye164.orgorregisteryours.

Figure 4.6: The web appearance after you are logged in

Toobtainatelephonenumberorregisteryournumber,youneedtologontoe164.org.Onceyou're loggedin,therearesomeoptionsyoucanchoosefrom. VoIPCookbook:100

Figure 4.7: PSTN Phone Numbers can be added via https://www.e164.org/pstnadd.php

Accesstohttps://www.e164.org/freenumadd.phpwillbringyoutoadefaultwindowwherebyyoucan addavirtualphonenumbertoe164.org.Youwillbeassignedaninternettelephonenumberwith countrycode+822frome164.org. Butifyou'reinterestedinaddingarealPSTNnumber,accesstohttps://www.e164.org/pstnadd.phpwill addPSTNnumberinsteadandregisterthenumberyouuseinyourcountry.Whenregistering,youneed tohavethePSTNnumberactivease164willdialthenumbertoauthenticatethatitisreal.Onceyou receivedtheactivationcode,gobacktoe164.orgwebsitetoactivatethenumberyouhavejust VoIPCookbook:101

registered. ToregisteraPSTNnumber,youneedtoenterinformationsuchascountry,areacode,telephone number,andSIPaccountthatwillbecalledwhensomeoneplacesacallthroughVoIPnetworkusing thePSTNnumber.SotheVoIPnetworkwillnotreachyourrealPSTNnumber,butyourSIPaccount usingthisPSTNnumber.YourSIPphonewillring,butnotyourPSTNphone. Onceallinformationareenteredcorrectly,clickAddmetoregisterourPSTNnumbersoitcanbe calledthroughinternettelephonynetwork.

Figure 4.8: You can obtain +822 number assigned by e164.org via https://www.e164.org/freenumadd.php

Thesecondoptionismucheasiertodo:simplyrequestaVoIPnumberwithcountrycode+882via https://www.e164.org/freenumadd.php.ThisnumbercannotbereachedbyPSTNnumbersbutwillbe VoIPCookbook:102

reachedonlythroughVoIPnetwork.Toobtaina+822number,enteryourSIP,IAX2orH.323number intotheblanks.SincetheaccountyoucreatedinVoIPRakyatisofSIP,chooseSIPinthedropdown menu.Onceallinformationareenteredproperly,clickAddnumberinordertoobtainthecountrycode +882.

Figure 4.9: Request a block of number via https://www.e164.org/hostadd.php

Themostinterestingpartofe164.orgisitsabilitytoobtainablockofnumbersvia https://www.e164.org/hostadd.phpwithareacode+82299,insteadofhavingthesenumbersincluded onebyone.Todothis,clickServerAdd.ViaaddaServerEntry,choosethetypeofprotocolusedby theserverandenterthenameoftheserver.TheservershouldhaveaPublicIPaddress,nottheone VoIPCookbook:103

usedinternally.Onceallinformationareenteredproperly,clickAddServer.ThiswillmakeyourSIP serverberecognizedbye164.org,with+882beingthecountrycodeassignedtotheserver.Thisalso impliesthatyouwillhaveabunchofnumbersthatyoucanfurtherallocatetotheuserswhoare registeredwithyourserver.

Introducing your country code to International VoIP network

Figure 4.10: Add a telephone number via https://www.e164.org/pstnadd.php

IfyouwanttointroduceaPSTNorcellularnumberwithaspecificcountrycodetothisVoIPnetwork, youcandosothroughmenuavailableathttp://www.e164.org/pstnadd.php.Whatyouhavetoenteris thecountryofthePSTNorcellularnumber,areacode,localtelephonenumber,andtheSIPaccount VoIPCookbook:104

registeredwithaSIPproviderwherethePSTNnumbersarethoseofSIP. Whenregisteringthephonenumber,youneedtohavethephonereadytoreceivecalls,aswithin15 minutesafteryouregisteredit,e164.orgwilldialyournumbertoprovideyouwithaPersonal IdentificationNumber(PIN)requiredtoactivatetheaccount.Writethemdownsomewheresoyoudon't havetomemorizethem.GobacktotheWebandactivateyouraccountusingthepinthathasjustbeen giventoyou.Oncethisiscompleted,yourPSTN(orcellular)numbercanberecognizedintheVoIP network,withallthenumbersregisteredwiththenetworkcapableofdialingyourSIPaccountusing yourPSTNnumbers.

VoIPCookbook:105

VoIP Rakyat's ENUM


Besidese164.org,thereishttp://enum.voiprakyat.or.id,amappingsystemdevelopedbyVoIPRakyat.

Figure4.11:Indonesia'sEnumdirectorydevelopedbyVoIPRakyat

VoIPCookbook:106

Figure4.12:ThesignuppageofVoIPRakyatENUM ThroughVoIPRakyat(VR)ENUMregistrationpage,youcanregisteryourselfasamember.The informationyouneedtofillinisusername,emailaddress,andpassword.

VoIPCookbook:107

Figure 4.13: ENUM VoIP Rakyat sign-up page

Scrollthepagedown.Fillinalltheinformationrequired:Name,Birthday,Address,City, State/Province,countryandmobilephonenumber.Forsecurityreason,VRwillverifythatyouarea realperson,andnotaspammingmachine.Usetheprovidedsecuritycodetofillintheblanks. Onceallinformationareenteredcorrectly,clickSubmittoproceed.

VoIPCookbook:108

Figure 4.14: The notification informing that your registration is successful

Oncetheregistrationiscompleted,ENUMVoIPRakyatwillsendusanemailcontainingtheusername andpasswordwesetwhenregisteringtoENUMVoIPRakyat.

VoIPCookbook:109

Figure 4.15: In order to access ENUM VoIP Rakyat, you need to enter your username and password

Nowthatyourusernamehasbeenregistered,logonusingitandthepasswordprovided.Clickloginto proceed.

VoIPCookbook:110

Figure 4.16: ENUM VoIP Rakyat main Window after you logged in

InENUMVoIPRakyat,ontheleftofthepage,therearesomeusefuloptionsyoucanchoosefrom: PreferencesandPhoneNumber.First,clickPreferences.

VoIPCookbook:111

Figure 4.17: By clicking on Preferences, you can edit your login and personal information

WiththePreferencesoptionclicked,youcanchecktheinformationyouenteredearlierwhenyoudid theregistration,andmakenecessarychanges.

VoIPCookbook:112

Figure 4.18: By clicking on Phone number, you can add your phone number

ClickPhonenumber.ClickAddphonenumber.

VoIPCookbook:113

Figure 4.19: By clicking on Add Phone number, you will be able to register your phone

Theinformationyouneedtoenteriscountrycode,areacodeandlocalnumber.Oncetheseinformation areincluded,clickAddsothatthenumberwillbeaddedtoVoIPRakyatENUMdomain.

VoIPCookbook:114

Figure 4.20: Before a number is added, ENUM VoIP Rakyat will confirm whether you really want to add the number

Justlikee164.org,ENUMVoIPRakyatisalsodesignedtovalidatethenumberbeingregistered.Itwill callyournumberandtellyouthecoderequiredtoauthenticatethenumber.Forthistohappen,itis importantthatthenumberyouprovidedearlier,whenyoudidyourregistration,isneitherofFax machinenorofPABX.OtherwiseyouwillnotbeableobtainthecodegivenbyVoIPRakyat.

VoIPCookbook:115

Connecting to PSTN and Cellular Using VoIP Discount


Analternativetoregisteringyournumbertoenumservicessuchase164.orgorvoiprakyatistousea servicecalledVoIPDiscount(http://www.voipdiscount.com).

Figure 4.21: With VoIP Discount, you can make free or inexpensive calls over the Internet

Bybuyingacertainamountofcredit,wecanobtainatelephonenumberthatcanbereachedbyPSTN telephoneusingthenumbersofothercountriessuchasCzechRepublic,French,German,Holland, SwissandEngland.Withthiscredit,youwillbeabletomakerelativelyinexpensivecallstoPSTNor cellular.Theratesvary,dependingonwhereyouareandthecountriesfromwhichthenumberyou're attemptingtocalloriginates.Fortherates,gotohttp://www.voipdiscount.com/en/rates.html

VoIPCookbook:116

TouseVoIPDiscount,youneedto:

makesurethatyourcomputermeetstherequirementsforusingthem obtainVoIPDiscountsoftwareinhttp://www.voipdiscount.com/getfrommirror.php? file=voipdiscount&lang=en InstallthesoftwareinyourPC enterusernameandpasswordifyouuseVoIPDiscountforthefirsttime.

Onceallthesestepsarecompleted,youwillbeabletodialanynumberthewayyoudialusingyour PSTNnumber,withcountrycode,areacodeandtelephonenumber. IfyouuseSIPIPPhoneorATA,youneedtodothefollowingconfiguration: SIPport:5060 Registrar:sip.voipdiscount.com Proxyserver:sip.voipdiscount.com Outboundproxyserver:leaveempty Accountname:yourVoipDiscountusername Password:yourVoipDiscountpassword Displayname/number:yourVoipDiscountusernameorvoipnumber Stunserver(option):stun.voipdiscount.com

VoIPCookbook:117

VoIP Cheap
SimilartoVoIPDiscount,VoIPCheap(http://www.voipcheap.com/en/index.html)alsoprovidesfreeor relativelyinexpensivecallsovertheinternet.ThestepstouseitissomewhatsimilartoVoIPDiscount, exceptthatyouneedtodownloadthesoftwarefromhttp://www.voipcheap.com/getfrommirror.php? file=voipcheapCOM&lang=en.ForVoIPCheapcallingrate,goto http://www.voipcheap.com/en/rates.html

Figure 4.22: With VoIP Cheap, you can make free or inexpensive calls over the Internet

IfyouuseSIPIPPhoneorATA,youneedtodothefollowingconfiguration: SIPport:5060 VoIPCookbook:118

Registrar:sip.VoipCheap.com Proxyserver:sip.VoipCheap.com Outboundproxyserver:leaveempty Accountname:yourVoipCheapusername Password:yourVoipCheappassword Displayname/number:yourVoipCheapusernameorvoipnumber Stunserver(option):stun.VoipCheap.com Inadditiontoprovidingfreeorinexpensivecallservice,VoIPCheap,unlikeVoIPDiscount,also providesinexpensiveSMSservice,whichisavailableathttp://www.voipcheap.com/en/sms.html

VoIPCookbook:119

CHAPTER 5: Asterisk Softswitch


OneofthebestIPPBXOpenSourceSIPProxysoftwareavailableintheinternetisAsterisk,whichhas somanyfeaturesthatallowsustoestablishourownVoIPinfrastructure.Someofthesefeaturesare highlyusefulfortelecommunicationoperators,makingAsterisksuitableformanyapplicationsranging fromsmalltomediumscaleIPPBXtoIPPBXhavinghundredsoftelephoneextensions.Howeverwe willnotlistthesefeaturesrightnow,asyouwillfindwhatthesefeaturesareasyoureadalongtherest oftheCHAPTER,inthesyntaxcodeweexplainlater. However,forhighperformancesoftswitch,itseemsOpenSIPSseemstobebetterinhandlinghigh trafficrequest. SuchAsteriskscalabilityispossiblebecauseofAsteriskfunctioncalledTrunking,whichintegrates variousVoIPequipments,protocols,cellular,PSTNandevenSIPprovidertoasamenetwork.The numberoftrunks,theoretically,dependsontheamountofavailablebandwidthandthespeedofthe processingmachinethatrunsAsterisk. SowhatdoweneedsothatwecanuseAsterisk?Theanswertothisquestiondependsonhowmany telephoneextensionsyouwanttohaveinyoursystemand,importantly,howmanyconcurrentcalls Asteriskcanfacilitate.Ideally,theSpecifically,youhavetounderstandthefollowingparameters:

Thenumberofoutboundconnectionsandtheirtype(Analog,ISDM,T1,VoIP). Thenumberofinternalandexternalconcurrentcalls(theratiobetweencalls). Thetypeofphonethatwillbeused(Analog,SIP,H.323,MGCP). Thetypeofcodecthatwillbeused. Whethertranscodingprocesswillbenecessary. Howreliablethesystemis. HowmanyAsteriskmachinethatwillbeplaced. Theconditionofyourcomputernetworkintermsofprocessingspeed,QualityofService (QoS),VLAN,andPoweroverEthernet.

Ingeneral,afasterprocessorandthebiggertheRAM,themoreconcurrentcallstheservercan facilitate.SinceAsteriskseemstotheoreticallyrequirearound30MHzofCPUresourcesforevery activechannel,a266MHzCPU,forexample,shouldideallybeabletofacilitateabout8concurrent calls,withtheassumptionthattheCodecbeingusedisG.711.Ofcourse,inordertobecomean operator,youneedtohaveamuchmoresophisticatedserverwithfasterCPUandhigherRAM.Butin ordertounderstandwhatyoureallyneed,youcanlookintoavarietyofexamplesofhardware VoIPCookbook:120

configurationsandtheirmaximalcapability,whichareavailableathttp://www.voipinfo.org.Through thissite,youwillalsofindthescriptsrequiredtosimulateacallandputsomeloadonthesystem. Basedontheseconsiderations,youwillknowhowmuchmoneyyoureallyneedtospend.Spend sometimebrowsingtheinternettomakesomecomparisononinternettelephonyequipmentsandhow muchtheycost.However,manufacturers,normally,donotshowthepriceoftheitemstheysellintheir site.Thesepricetagsareusuallyshowninsitessellinginternettelephonyequipments,someofthem are: Digiumcardshttp://www.digiumcards.com/ VoIPonsolutionshttp://www.voipon.co.uk/ TheVoIPConnectionhttp://www.thevoipconnection.com/ Thepricesmayvary,rangingfromUS$15toUS$50perFXOorFXS.Meanwhile,IPPhoneeachcost betweenUS$50toUS$150.Youwillofcoursegetforlesswhenyoupurchasetheminlargequantities. ThecheapestyoucangetaretheequipmentsproducedinTaiwanorChina.SomeofthemareLevelOne andNexus.

Minimal Resource for Asterisk


Beforeyoudecidetoinvestinsophisticatedequipments,itisbeneficialtolearnonhowtoinstalland useAsterisk,usingasimplePCwithLinuxoperatingsystemasaserverwithInternetandLAN connection.ThissectionwillfocusonminimalinstallationofAsterisk.Onceinstalled,Asteriskwill turnyourPCintoasimplesoftswitch. ThistypeofinstallationallowsyoutorunAsteriskassimpleaspossible,attheexpenseofyoubeing ableonlytorunthefollowingfunctions: Userauthenticationwithaphonenumberandpassword. Dialplantomanagewhatneedstobedoneforacalldialedtoaspecificnumber ENUM,soAsteriskwillrecognizenumberswithspecificcountrycode.Forexample,in Indonesia,thecountrycodeinexamplewouldbe+62XXXintheAsteriskconfiguration.

Asterisk Installation
Assuming,theUbunturepositoryat/etc/apt/sources.listhasbeencorrectlyset.Onecaneasilyinstall Asteriskusingcommand #aptgetinstallasterisk

VoIPCookbook:121

Foramorecompletecommand,youmayusethefollowingcommand. #aptgetinstallasteriskasteriskdevasteriskconfigasterisksoundsmain\ asterisksoundsextradahdigastmanasteriskmysqldahdifirmwarenonfree\ asteriskmp3 Ubuntuwillstartdownloadandinstallasteriskassoonasthecommandinvoked.

Compile Asterisk
Forthosewhowishtocompileasterisksoftswitchfromsourcecode,wecandoitthroughthe followings, Preparethefollowingapplications #aptgetinstallkernelpackagelibncurses5devfakerootwget\ bzip2g++libssldevlibxml2devdoxygen WecandownloadmostofthesourcecodefromAsterisksite,suchas,

http://www.asterisk.org

http://downloads.asterisk.org/pub/telephony/dahdilinuxcomplete/releases/dahdilinuxcomplete2.4.0+2.4.0.tar.gz

http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri1.4.11.4.tar.gz http://downloads.asterisk.org/pub/telephony/libss7/releases/libss71.0.2.tar.gz http://downloads.digium.com/pub/asterisk/releases/

Whilempg123applicationcanbedownloadedfrom

http://www.mpg123.de/download.shtml http://sourceforge.net/project/showfiles.php?group_id=135704 http://sourceforge.net/projects/mpg123/files/

Copyalllastestsourcecodeto/usr/local/src/ cpasterisk1.8.0.tar.gz/usr/local/src/ cplibpri1.4.11.4.tar.gz/usr/local/src cpdahdilinuxcomplete2.4.0+2.4.0.tar.gz/usr/local/src/ cplibss71.0.2.tar.gz/usr/local/src/ VoIPCookbook:122

cpmpg1231.12.5.tar.bz2/usr/local/src/ Openthesourcecode cd/usr/local/src tarzxvfasterisk1.8.0.tar.gz tarzxvflibpri1.4.11.4.tar.gz tarzxvfasterisksounds1.2.1.tar.gz tarjxvfmpg1231.12.5.tar.bz2 tarzxvfdahdilinuxcomplete2.4.0+2.4.0.tar.gz tarzxvflibss71.0.2.tar.gz CompileMPG123 cd/usr/local/src/mpg1231.12.5/ ./configure make makeinstall CompileLibpri cd/usr/local/src/libpri1.4.11.4/ makeall makeinstall CompileDAHDI.MakesurewehaveanInternetconnectionasweneedtodownloadthefirmware duringdahdiinstallationprocess. cd/usr/local/src/dahdilinuxcomplete2.4.0+2.4.0/ make makeinstall makeconfig CompileLibSS7.Dothisafterdahdi;beforecompilingasterisk. cd/usr/local/src/libss71.0.2/ make makeinstall

VoIPCookbook:123

Compileasterisk.MakesurewehaveInternetconnectionasweneedtodownloadtheoperationvoice duringasteriskinstallationprocess. cd/usr/local/src/asterisk1.8.0 ./configure makemenuselect makeall make makeinstall makesamples Pleasenotethatmakemenuselectisoptional,wecandothecompalitionprocesswithoutmake menuselect.Ifyouliketoinstallthedocumentation,pleasedo aptgetinstalldoxygen makeprogdocs

Configuring Asterisk
AstheAsteriskinstalled,weneedtoconfigureitsoAsteriskfunctionsthewayyouwantittobe.All filesthatyouneedtoconfigurearestoredinthefolder: /etc/asterisk Theminimalconfigurationfilesneedtoeditedare: sip.confforuserauthenticationwithaphonenumberandpassword. extensions.conftosetthedialplan. enum.confforENUM,forexample,forcountrycode+62. Asidefromthesefiles,therearemoreconfigurationfilesforthosewhoareseriouslyinterestedtostudy theasterisk.Fornow,itissufficientforyoutolearnconfiguringthosethreefiles.

ENUM.CONF Configuration
ThereisnotmuchtobechangedinENUM.CONF.However,youneedtomakesurethattherearethe followingentries: VoIPCookbook:124

search=>e164.arpa search=>e164.org search=>e164.id search=>enum.voiprakyat.or.id Thisway,wecanensurethattheinformationcontainedinENUMe164.arpa,e164.organde164.idwill berecognizedbyAsterisk.

SIP.CONF Configuration
Theuserdatabaseisstoredin/etc/asterisk/sip.conf.Anexampleforanaccountwithphonenumber 2099,password123456,dynamicIPaddressusingDHCPisasfollows: [2099] context=default type=friend username=2099 secret=123456 host=dynamic dtmfmode=rfc2833 mailbox=2099@default ToensurethatthedialtoneishandledproperlyinAsterisk1.6,wemayaddthefollowingentry: rfc2833compensate=yes Entertheaboveentryforeachuser.Atthispoint,eachusermayregisterhisorherselftotheAsterisk. TheregisteredusersmaycalleachotheronthesameAsteriskserver. ToconnectourAsteriskservertoVoIPRakyatoranyotherSIPproxyavailableintheinternet,weneed toregisterourAsterisktotheSIPproxyserver.Thecommandsusedis: register=>2345:password@sip_proxy/1234 whichmeansuser1234inourasteriskserverthatweoperateistheuser2345insip_proxyloggedinto theserverusingthepasswordpassword.Forexample,user2000hasanaccount20345in voiprakyat.or.idserverwithpasswordsecret,thentheformatusedis: VoIPCookbook:125

register=>20345:secret@voiprakyat.or,id/2000 Thisway,callsmadetoVoIPRakyat,specificallytoaccount20345,willbeforwardedtonumber2000 inourSIPserver.

EXTENSIONS.CONF Configuration
Thedialplanorroutingtableofasoftswitchisnormallystoredin/etc/asterisk/extensions.conf.In extensions.confwecanconfigurewhatAsteriskneedstodoasitreceivesacallonacertainextension. Thesimplestexampleofdialplanis: exten=>_20XX,1,Dial(SIP/${EXTEN},20,rt) exten=>_20XX,2,HangUp whichmeansthatifthereissomeonewhocallsextension20XX,thenthefirststepcarriedoutbythe syntaxistohaveDIALoftheextensionuseSIPtechnology,waitfor20secondsandifthereisno response,carryouttimeout(rt).Thesecondstepistohangup.Ofcourseyouneedtodoasmall configurationofthecommandsoitwillfityourcircumstanceinhowyouuseyourSIPserver. Somecommandsconsidereddangerousbutoftensoughtbyuser/adminareasfollows: exten=>_0711.,1,Dial(SIP/${EXTEN:4}@2031,20.rt) whichmeansthatthereissomeonewhocalls0711.Thedot.impliesthatanynumberafter0711is ignored.DIALusesSIPtechnologytoconnectto2031.Alsonotecarefullythecode{EXTEN:4}hasto bereadomitthefirst4digitsofthedialednumber.Forexample:07115551234becomes5551234. IfweusePABXbetweenATAandPSTN,thecommandusedisasthefollowing: exten=>_021X.,1,Dial(SIP/9${EXTEN:3}@2031,20.rt) Thesyntaxaboveimpliesthatthereissomeonewhocalls021X.Noticethatthedot.placedafterX impliesthatanynumberplacedafterXisignored.DIALusesSIPtechnologytoconnectto2031.Also notecarefullythecode9{EXTEN:3}hastobereadomitthefirst3digitsofthedialednumberand addtheprefix9infrontofthenumber.Forexample:0215551234becomes95551234 Thismeansthatifthenumber2031originatesfromanAnalogTelephoneAdapter(ATA)suchasthe SPA3000locatedintheJakartaandisconnectedtoaPABXinJakarta,anyoneinsuchaVoIPnetwork VoIPCookbook:126

willbeabletocallJakartawithouthavingtopaylongdistanceorinternationalcall.Whattheyneedto payisjustthelocalrateforcallingtheintendednumberinJakartacity. ThesamewaycanbedevelopedforcallingmobilephoneinIndonesiabyconnectingtheATAweuse toPSTNoranyFixedWirelessTerminal(FWT)device.Thecommandusedisasfollows exten=>_08X.,1,Dial(SIP/${EXTEN}@2031,20.rt) Ofcourse,anofficethatisconnectedtoapublicVoIPnetworkwillnotopenitsaccesssothatonly certainuserscancallanymobilenumberorTelkom,andthusweusuallydonotuse021X.code,nor 08X.ButwewillentereachofthenumbersallowedtobecalledthroughVoIP.Forexample: exten=>_0811567854,1,Dial(SIP/${EXTEN}@2031,20.rt) exten=>_0216575675,1,Dial(SIP/${EXTEN}@2031,20.rt) exten=>_0216755675,1,Dial(SIP/${EXTEN}@2031,20.rt) Thismeansthatonlynumber0811567854,0216575675and0216755675canbecontactedviaVoIP numbers.Otherthanthesenumberscannotbecontacted. ToadoptthephonenumberformatsimilartoTelco,e.g.,+62XXXorothernumberswemayinclude ENUMLOOKUPcommand,forexample, exten=>_00.,1,Set(enumresult=${ENUMLOOKUP(+${EXTEN:2},,,,e164.id)}) exten=>_00.,n,Dial(SIP/${enumresult}) exten=>_+.,1,Set(enumresult=${ENUMLOOKUP(${EXTEN},,,,e164.id)}) exten=>_+.,n,Dial(SIP/${enumresult}) Inanenvironmentwheretherearemanyasterisk/SIPservers,sometimesweneedtocreateanarea codetobeabletocalltoeachotheramongtheseservers.Forexamples, AreaCode SIPServerIPAddress 021 203.159.31.99 022 203.159.31.123 023 203.159.31.48

Thedialplanwouldbe VoIPCookbook:127

exten=>_021.,1,Dial(SIP/${EXTEN:3}@203.159.31.99,30,rt) exten=>_022.,1,Dial(SIP/${EXTEN:3}@203.159.31.123,30,rt) exten=>_023.,1,Dial(SIP/${EXTEN:3}@203.159.31.48,30,rt) Notice${EXTEN:3}thatwillremovethethree(3)digitsAreaCodeaswepasstheextensions numbertothedestinationSIPServer.

VoIPCookbook:128

CHAPTER 6: Asterisk for Incoming and Outgoing calls


Defining SIP Channel in sip.conf
EverySIPclientandserverisidentifiedwithatextblocksuchasthefollowing: [xxx] type=yyy parameter1=value parameter2=value WherexxxisthenameassociatedwiththeSIPclient,oranyarbitrarynameusedbyother configurationfiletorefertoaSIPdevice.Typically,aSIPphonewithextensionnumber123willhave anentrythatbeginswith[123].Pleasenotethatyoustillhavetoactivateextension123in extensions.conffilesothatpeoplecancalltoextension123.TheparameterTypemustcontain"user", "peer"or"friend". Asteriskwillmatchtheincomingcallwiththenameofthedeviceandtype=useroftheSIPprotocol conversationincolumnFrom:username(withoutacknowledgingtheSIPdomain).Anotherwayalso usedistomatchtheSIPrequestand[xxx]insip.conffile,throughboththeIPaddressoftherequester andthepeerinformationofpartof[xxx]insip.conffile.Ifhost=dynamic,it'snotpossibletoperform matchinguntiltheSIPclientisregistered.

Asterisk as SIP Client


AsteriskcanregisteritselftoanotherSIPserverandbecomesaclient.Forthis,thecommandusedin sip.confunder[general]forregistrationtotheSIPserveris: register=>user[:secret[:authuser]]@host[:port][/extension] Ifyouhaveproblemswithyourcomputernetwork,suchasanunstableconnectivity,frequent connectivitybreakdowns,andlosingestablishedregistrationtoyourSIPserver,youcanaddparameter registerattemptsandregistertimeoutbeforethegenericdefinitionofregister.Setting registerattempts=0willforceAsterisktokeepregisteringuntilsuccessful(defaultvalueis10attempts). Thevalueofregistertimeoutdeterminesthelengthoftimeinsecondsbetweenattemptsforregistering (thedefaultvalueis20seconds). VoIPCookbook:129

Example: register=>2345:password@mysipprovider.com/1234 Theabovecommandwillregister2345tomysipprovider.comandwillbeidentifiedasextension1234 inAsteriskwhichweoperate.Intheexampleabovetheparametersusedare: usertheuseridfortheSIPserver(example:2345) authuseruserauthorization(optional)totheSIPserver secrettheuserpassword hostservername(example:mysipprovider.com) porttheSIPportinServer.Thedefaultis5060. extensionthelocalextensionnumberinAsterisk(example:1234). TheextensionnumberisusedtocontactlocalextensionoftheAsteriskSIPserverwhichwesignedup. Ifthereisnoextension,Asteriskwillautomaticallyenterextension"s". ToseeifAsteriskhassuccessfullyregistereditselfwiththeSIPServer,wecanuseAsteriskInterface CommandLine,whichcanbeaccessedthroughtheasteriskcommandrintheshell. #asteriskr Registrationstatuscanbeviewedthroughthecommand: sipshowregistry ItseemsthatthiscommandwillbeomittedinAsteriskversion1.4,andwillbechangedinto sipregistrylist Toseethephone/extensionlistedinAsteriskwhichweoperate,wecanusethefollowingcommand sipshowpeers InAsterisk1.6,thecommandseemstobereplacedby sippeerslist

VoIPCookbook:130

TomakeacalltoaSIPserveroutsideofAsterisk,weneedtodefinesip.conflikethefollowing example: [mysipproviderout] type=peer secret=password username=2345 host=sipserver.mysipprovider.com fromuser=2345 fromdomain=fwd.pulver.com nat=yes context=frommysipprovider ;isfurtherdefinedinextensions.conf Inextensions.conf,weneedtoaddacommandlike: exten=>_9.,1,Dial(SIP/${EXTEN:1}@mysipproviderout,30,r) Pleasenotethatthevariable${EXTEN:1}herewilltakeallthecharacters/lettersfromtheincoming extensionexceptforthefirstcharacter,whichinthiscase,isthenumber9. Meanwhile,SIPextensionconfigurationextensions.confforreceivingcallscomingfromtheSIP servercanalsobedevelopedusingthefollowingcommand: [frommysipprovider] exten=>1234.1,Answer ;1234istheextensioncontact.Thedefaultextensioncontactis"s" exten=>1234.2,Dial(SIP/111,25,Ttr) ;IncomingcallsareredirectedtoaSIPtelephonenumber111 exten=>1234.3,Hangup

Generic SIP configuration


In[general]sectioninsip.conf,therearesomevariablesthatwecansetup,someofwhichare allow=<codec> ;aCodecthatisallowedbasedonpreferences.Priortousingthis,usedisallow=all.

VoIPCookbook:131

disallow=all ;disallowallcodecstobeused. allowexternalinvites=yes|no ;EnableorDisableINVITE&REFERtononlocaldomain.Thedefaultisyes. allowguest=yes|no ;Allowsorrejectscallsfromguest(thedefaultisyes). allguest=yes|no ;Allowsordeniesthecallfromguests.Thedefaultisyes. Autocreatepeer=yes|no ;Ifitissettoyes,everyonecaneasilyloginasapeerwithoutapassword, itisusuallybeneficialfor operatingwithSER.Thedefaultisno. autodomain=yes|no ;Enable/disabletheabilityofAsterisktoaddlocalhostnamesand localIPaddresstodomainlist.The defaultisno. bindaddr=IP_Address ;IPAddressboundasaplaceforlisteningtoconnection.Thedefaultis0.0.0.0(anyinterface). bindport=Number ;TheUDPportinbindforlisteningtoincomingconnections.Thedefaultis5060. callerid=<string> ;CallerIDinformationthatwillbeusedifthereisnootherinformation.Thedefaultisasterisk. canreinvite=update|yes|no ;Thedefaultisyes. checkmwi=Number ;Theintervalinsecondstocheckthemailbox.Thedefaultis10seconds. compactheaders=yes|no ;whetherAsteriskwillsendaSIPheaderincompactorcompleteform.Thedefaultisno. context=<contextname> VoIPCookbook:132

;Thisisthedefaultcontextthatwillbeusedfortelephonesthatdonothavecontext. Thecontentofthecontextcanbesetinextensions.conf. defaultexpirey=Number ;Thedefaultlengthoftime(inseconds)ofanincomingoroutgoingregistration. Thedefault120seconds. dtmfmode=inband|info|rfc2833(globalsetting) ;Thedefaultisrfc2833. domain=domains ;listofdomainsseparatedbycomma,alistforwhichAsteriskisresponsible. dumphistory=yes|no ;EnablessupportfordumpingSIPtransactionsinLOG_DEBUG.Thedefaultisno. externip=IP_Addressorhostnames ;TheaddresswewillplaceintheSIPmessagesifwearebehindNAT. Ifthehostnameisused,thentheIPaddressassociatedwiththehostnamewillbereadonce atthetimeofreadingsip.conf.IfwewanttousethehostnameofthedynamicIP, useexternhostparameters. externhost=hostname.tld externrefresh=Number ;determineshowoften(inseconds)DNScheckingiscarriedoutfor'externhost'. Thedefaultis10seconds. ignoreregexpire=yes|no ;setswhetherContactinformationfromapeerisstillusedeventheinformationhasexpired. Thedefaultisno. language=<string> ;ThedefaultlanguageusedbyPlayback()/Background(). localnet=NetAddress/Netmask ;Localnetworkandmask. fromdomain=<domain> VoIPCookbook:133

;SetdefaultFrom:domaininSIPmessageatthetimeitoperatesasaSIPua(client) insecure=very|yes|no|invite|port ;Sethowtohandleconnectionswithpeers.Thedefaultisno(authenticateallconnections). maxexpirey=Number :Lengthoftime(inseconds)ofincomingregistration.Thedefaultis3600seconds. musicclass=oneofclassesthatisusedinmusiconhold.conf musdiconhold=similartomusicclass nat=yes|no|never|route ;Thedefaultisno,whichmeansthatrfc3581techniqueisused. notifymimetype=mediatype/subtype ;AllowstooverridemimetypeinMWINOTIFYusedinvoicemailonlinemessage. Thedafaultis application/simplemessagesummary. notifyringing=yes|no ;Callnotificationisincludedinringingstage.Thedefaultisyes. outboundproxy=IP_address/DNSSRVname(excluding_sip._udpprefix) ;SRVname,hostname,orIPaddressoftheoutboundSIPProxy. outboundproxyport=Number ;UDPportnumberforOutboundSIPProxy. pedantic=yes|no ;enableaslowprocesstocheckCallID,SIPheaderwithmanylines, andtheURIencodedheaders.The defaultisno. port=<portno> ;ThedefaultportforSIPpeer.ThisportisnottheportofAsteriskforlisteningto incomingcalls(seebindport). progressinband=never|no|yes ;whetherweshouldgenerateinbandringing.Thedefaultisnever.

VoIPCookbook:134

promiscredir=yes|no ;Allowssupportfor302Redirects;(Note:itwillredirectalltolocalextensionavailable incontact,nottoextensiononthefinaldestination). Thedefaultisno. qualify=yes|no|milliseconds ;Checkwhethertheclientcanbecontacted.Ifsettoyes,thenthecheckingwillbecarried outevery2000milliseconds(2seconds). Thedefaultisno. realm=myrealm ;Changeauthenticationrealmfortheasterisk(default)towhatwewant. recordhistory=yes|no. ;EnableloggingofSIPtransactions. Thedefaultisno. regcontext=context ;DefaultcontextusedtorespondtotheSIPREGISTERofSIPRegistrar. register=><username>:<password>:[authid]@<sipclient/peeridinsip.conf>/<contact> ;RegistertoSIPprovider registerattempts=Number ;thenumberofSIPREGISTERmessagesenttotheSIPRegistrarbeforegivingup. Thedefaultis0(nolimit). registertimeout=Number ;ThenumberofsecondsallocatedtowaitforrespondsfromtheSIPRegistrarbeforetheSIP REGISTER'stimeisup. Thedefaultis20seconds. relaxdtmf=yes|no ;Thedefaultisno. rtautoclear=yes|no|number ;AutoExpirefriendsmadewhileoperating.Ifitissettoyes, autoexpirewilltakeplacein120seconds. Thedefaultisyes. VoIPCookbook:135

rtcachefriends=yes|no ;Cacherealtimefriendsbyaddingthemtotheinternallistlikefriends. Thisisaddedtotheconfigfile. Defaultisno. rtpholdtimeout=Number ;Lengthoftimeinsecondsduringwhichthereisnoactivitybeforedisconnecting acallonhold. Default is0(nolimit). rtpkeepalive=Number ;NumberofsecondsoftheintervalforRTPkeepalivepacketifthereisnopassingtraffic. Defaultis0 (noRTPkeepalive). rtptimeout=Number ;NumberofsecondsforwaitingforRTPtrafficbeforewehungup. Defaultis0(noRTPtimeout). rtupdate=yes|no ;SendregistryupdatestothedatabasewhenusingRealtimesupport.Thedefaultisyes. sendrpid=yes|no ;whethertheSIPheaderRemotePartyIDSIPshouldbesent. Thedefaultisno. sipdebug=yes|no. ThedefaultsettingthatdetermineswhethertheSIPdebugisenabledwhenloadingsip.conf. Thedefault isno. srvlookup=yes|no ;EnableDNSSRVcheckswhencalledupon.Thedefaultisno. tos=<value> ;SetQoSofIPparametersforoutgoingmediastreams (numericvaluesareacceptable,suchastos= 184) trustrpid=yes|no ;whethertheSIPheaderRemotePartyIDSIPcanbetrusted.Thedefaultisno. VoIPCookbook:136

useclientcode=yes|no: usereqphone=yes|no ;Indicateswhetherweneedtoadd";user=phone"toURI.Thedefaultisno. useragent=<string> ;ChangestheSIPheader"UserAgent".Thedefaultisasterisk. videosupport=yes|no ;EnablessupportforSIPvideo.Thedefaultisno. vmexten=<string> ;Dialplanextensiontocallmailbox.Thedefaultisasterisk.ConfiguringSIPpeerandclient Thefollowingvariablescanbeusedineverypeerdefinition accountcode=<string> ;theuserswhocanbeassociatedtoaccountcode.Itisrecommended thatyoureadtheconceptonAsteriskbilling. allow=<codec> ;theCODECwhichisallowedbasedonorderpreferences. Usefirstdisallow=ALLbeforeallowing CODEC. disallow=all ;DisallowalltheCODECstoagivenpeeroruserdefinition. allowguest=yes|no ;Alloworrejectcallsfromunknownperson. Thedefaultisyes.OSPcanalsobesetifAsteriskiscompiledtosupportOSP. auth=<authname> ;ThecontentoftheDigestusername=onaSIPheader. callerid=<string> ;ThecallerIDinuseifnoinformationisavailable.Thedefaultisasterisk. calllimit=number VoIPCookbook:137

;Thenumberofsimultaneoustelephoneconnectionsthatcanbemadetoaspecificuse/peer. callgroup=num1,num2num3 ;Definesacallgroupthatcancallthistool. callingpres=number|descriptive_text ;SetappearanceofCallerIDofaconnection/call. Descriptivetextvaluesthatcanbefilledinareallowed_not_screened, allowed_passed_screen,allowed_failed_screen,allowed,prohib_not_screened, prohib_passed_screen,prohib_failed_screen,prohib,andunavailable. ThedefaultisAllowed_not_screened. canreinvite=update|yes|no ;whethertheclientisabletosupportSIPreinvites.Thedefaultisyes. context=<context_name> ;Iftype=user,contextisforthecallgoingtotheSIPuserdefinition. Iftype=peer,contextinthe dialplanisforoutboundcallofaSIPpeerdefinition. Iftype=friend,contextisusedforallinboundandoutboundconnectionsto theSIPentitydefinition. defaultip=ip.add.res.s ;ThedefaultIPaddressfortheclienthost=ifnotspecifiedasDYNAMIC. Thisisusediftheclienthad neverbeenregisteredtousedifferentIPaddress. Onlyvalidifthetype=peer. dtmfmode=inband|info|rfc2833 ;HowtheclienthandlesDTMFsignal.Defaultisrfc2833. fromuser=<from_ID> ;Determinestheusertobeputin"from"otherthanthecallerid(overridecallerid) whenconductingcalls_to_peer(toanotherSIPproxy).Validonlyfortype=peer. fromdomain=<domain> ;SetdefaultFrom:domaininSIPmessagewhenconductingcalls_to_peer. Validonlyinthe[general] ortype=peersection. fullcontact=<sip:uri_contact> ;SIPURIcontactforrealtimepeer.Validonlyforrealtimepeers. VoIPCookbook:138

host=dynamic|hostname|IPAddr ;ClientIPaddressorhostname.Ifyouwantthephonetoregisteritself, usedynamickeywordsinstead ofhostIP. incominglimitandoutgoinglimit=Number ;Limitationofthenumberofsimultaneousactivecallsthatcanbeperformedby aSIPclient.Validonly fortype=peer. insecure=very|yes|no|invite|port ;Determineshowtodealwithpeerconnection. Thedefaultisno(authenticationforallconnections). ipaddr=ip.addr.from.peer ;Validonlyforrealtimepeer. language=languagecodeasdefinedinindications.conf ;Definingalanguageforgreetings mailbox=mailbox ;ExtensionforVoicemail.Validonlyfortype=peer. md5secret=MD5Hashof"<user>:asterisk:<secret>" ;Canbeusedasasubstitutetosecret. Musicclass=determinesoneofclasseswritteninmusiconhold.conf name=<name> ;Thenameoftherealtimepeer.Validonlyforrealtimepeeronly. nat=yes|no ;ThisvariabledeterminestheactionpatternofAsteriskforclientsbehindtheNAT. Butitstilldoesnot solvetheproblemifAsteriskisbehindNAT. Thedefaultisno,whichmeansusingtheRFC3581 technique. outboundproxy=IP_addressorDNSSRVname ;SRVname,hostname,orIPaddressoftheoutboundSIPProxy. Validonlyinthe[general]andtype= peersection.

VoIPCookbook:139

progressinband=never|no|yes ;Dowegenerateringininband.Thedefaultisnever. promiscredir=yes|no ;Allowssupportfor302Redirects.Thedefaultisno. qualify=yes|no|milliseconds ;Checkwhethertheclientcanbereached. Ifyes,acheckwillbedoneevery2000milliseconds(2 Validonlyinthe[general]andtype=peersection.

seconds).

regseconds=seconds ;TimeinsecondsbetweenSIPREGISTERS.Validonlyforrealtimepeeronly. rtpkeepalive=seconds ;Thetime,inseconds,ofsendingRTPkeepalivepacketifthereis noRTPtrafficontheconnection. Default0(noRTPkeepalive). Validonlyforthe[general]andtype=peersection. rtptimeout=seconds ;DisconnectaconnectionifwithinxsecondsthereisnoRTPactivityand wearenotinonholdposition. Validonlyinthe[general]andtype=peersection. rtpholdtimeout=seconds ;DisconnectaconnectionifwithinxsecondsthereisnoRTPactivityand weareinonholdposition. Validonlyforthesection[general]andtype=peer. secret=password ;IfAsteriskfunctionsasaSIPServer,thenSIPclientmustloginusing"password". IfAsteriskfunctionsasaSIPclienttoaremoteSIPserver, itrequiresSIPINVITEauthentication,thenthecontentsofsecret isused forSIPINVITEauthenticationthatissentbyAsterisktotheremoteserver. sendrpid=yes|no ;whetherRemotePartyIDSIPheadershouldbesent.Defaultisno. setvar=variable=value VoIPCookbook:140

;Variablechannelwhichshouldbesetforallconnectionstothispeer/user. subscribecontext=<context_name> ;SetaspecificcontextforSIPSUBSCRIBErequests trustrpid=yes|no ;whetherRemotePartyIDSIPheadercanbetrusted.Thedefaultisno. type=user|peer|friend ;connectiontotheclient,outboundproviderorafullclient? usereqphone=yes|no ;Showingwhethertoadd";user=phone"totheURI.Defaultno. Validonlyforthe[general]and type=peersection. username=<username[@realm]> ;IffunctioningasaSIPclienttoaremoteSIPserverthatrequires SIPINVITEauthentication,thenthisparameterisusedforSIPINVITEauthentication, whichissentbyAsterisktoaremoteSIPserver;forpeerswhowillregistertoAsterisk, theusernameisusedinINVITEuntiltheyareregistered. vmexten=<string> ;Dialplanextensiontoreachmailbox.Defaultasterisk. Onlyvalidinthe[general]ortype=peersection.

DAHDI Usage For VoIP Cards


InNewerAsterisksoftware,DAHDIshortfor"DigiumAsteriskHardwareDeviceInterface"isusedto dealwithVoIPhardwares.DAHDIisthenewnamefor'Zaptel'asofMay19th2008.Thepostat http://blogs.digium.com/2008/05/19/zaptelprojectbeingrenamedtodahdi/detailsthereasonforthe change.Asterisk1.4releaseslaterthan1.4.21,andallreleasesofAsterisk1.6,willautomaticallyuse DAHDIinpreferencetoZaptel,evenifZaptelisstillinstalledonthesystem.Morereferenceonthis canbefoundathttp://www.voipinfo.org/wiki/view/DAHDI Digiumresourcesregardingzapteltodahdimigrationcanbefoundat http://www.asterisk.org/node/48481.Basically/etc/zaptel.confBecomes/etc/dahdi/system.confand /etc/asterisk/zapata.confBecomes/etc/asterisk/chan_dahdi.conf. VoIPCookbook:141

Therearethree(3)mainconfigurationfiles,namely, /etc/dahdi/system.conf /etc/asterisk/chan_dahdi.conf /etc/asterisk/dahdichannels.conf In/etc/dahdi/system.conf,unlikezaptel.conf,youhavetoexplicitlysettheechocancellerforeach channel. Thereareanumberofotherconfigurationfilesunder/etc/dahdi /etc/dahdi/init.conf Replaces/etc/default/zaptel(onDebians)and/etc/sysconfig/zaptel(onmostothersystems) thisisashellscriptsnippetthatissourcedbythedahdiinit.dscript.Allvaluesthereare optional(noneedtoexplicitlydefineTELEPHONY=no).ThevariableMODULES,however,is nolongerreadfromit.ITisreadfrom: /etc/dahdi/modules Alistofmodulestoload.ReplacesthevariableMODULESfromtheaboveconfigurationfile. /etc/dahdi/genconf_parameters Finetuningparametersfordahdi_genconf(replaceszapconfandalsodeprecates genzaptelconf).

DAHDIArchitecture
Thepackageiscomposedoftwosubpackages: Kernel Includekernelmodulesandminilahelperfiles(firmwares) Tools TheuserspacetoolstocontrolDAHDIspans/channels: dahdi_cfg TheDAHDIConfigurator,whichparsessystem.conf dahdi_genconf VoIPCookbook:142

Generates/etc/dahdi/system.conf,soit'sbetterthatyoudon'thandeditsystem.conf.Uses /etc/dahdi/genconf_parameterstodefineit'sactions. dahdi_hardware DisplayslistingofDAHDIhardwaredetected dahdi_monitor Monitorssignallevelonanalogchannelallowsyoutorecordaudiofromit Usage:dahdi_monitor<channelnum>vmopllimitfFILEsFILErFILE1tFILE2F FILESFILERFILE1TFILE2 example:dahdi_monitor1vv note:extremlyusefull,butotherwisenotmentioned,thattherawformatoutputis8Khz16bit signed.Usesoxtoconverttoawav.soxr8000swrx.rawrx.wav dahdi_scan GeneratesalistofthingsDAHDIchannels,withsomedetails dahdi_test MeasuresaccuracyoftheFXO/FXSboardsoftwaredigitalsignalprocessing dahdi_tool Anicetooltoseewhatyourboardsaredoing.

DAHDISampleinstallation
Aftercompilingandinstallingofdahdiandasterisk,youhavetoperformsomefurtherstepstouseyour hardware.ThisexamplewillshowyouafewstepshowtogetasteriskandtwoDigiumcardsenabled:

Detectyourhardware.Thiswillgenerate/etc/dahdi/system.confand/etc/asterisk/dahdi channels.conf. #lspcin YoushouldseesomethinglikethisforTDM410 00:09.00200:d161:8005(rev11)

VoIPCookbook:143

Edit/etc/dahdi/system.confandmakesurethereis loadzone=us defaultzone=us

Checkthechanneltype /etc/init.d/dahdirestart dahdi_scan Wewillseesomethinglike active=yes alarms=OK description=WildcardTDM410PBoard1 name=WCTDM/0 manufacturer=Digium devicetype=WildcardTDM410P location=PCIBus03Slot03 basechan=1 totchans=4 irq=23 type=analog port=1,FXO port=2,FXO port=3,FXS port=4,FXS

Edit/etc/dahdi/system.conftoreflectthefindingsfromdahdi_scan fxoks=3,4 fxsks=1,2 echocanceller=mg2,14

Runmodprobeasrootanddodahdi_cfg #modprobewctdm24xxp #dahdi_cfgvv

VoIPCookbook:144

Checkifitiscorrectlyloaded #dmesg wewillseesomethinglike


[961.484269]wctdm24xxp0000:00:09.0:PCIINTA>GSI17(level,low)>IRQ17 [961.940405]Port1:InstalledAUTOFXO(FCCmode) [962.576453]Port2:InstalledAUTOFXO(FCCmode) [964.209579]Port3:InstalledAUTOFXS/DPO [965.838703]Port4:InstalledAUTOFXS/DPO [965.842700]VPM100:NotPresent [965.846981]FoundaWildcardTDM:WildcardTDM410P(4modules)

Thisisnotnecessary,butifyoulikeyoucandogenerateetc/dahdi/system.confand /etc/asterisk/dahdichannels.conf. #dahdi_genconf

Restartdahditounloadandreloadallmodulesanddrivers #/etc/init.d/dahdirestart

Pointfile/etc/asterisk/chan_dahdi.confto/etc/asterisk/dahdichannels.conf #openchan_dahdi.confandincludeitunderthesection[channels] # #NOTE:Youcaneditandconfigure/etc/asterisk/dahdichannels.confatanytime #tosetupyourspecificoptionsthere. ... [channels] #include/etc/asterisk/dahdichannels.conf ... In/etc/asterisk/dahdichannels.confwewillseesomethinglike signalling=fxs_ks callerid=asreceived group=0 context=frompstn VoIPCookbook:145

channel=>1 callerid= group= context=default signalling=fxo_ks callerid="Channel3"<4003> mailbox=4003 group=5 context=frominternal channel=>3 callerid= mailbox= group= context=default

Restartasterisk #/etc/init.d/asteriskrestart

Verifyyourcurrentsystemstatus.Youshouldgetsomeoutputlikethis:
asteriskr asterisk*CLI>dahdishowstatus DescriptionAlarmsIRQbpviolCRC4FraCodiOptionsLBO DAHDI_DUMMY/1(source:HRtimer)1UNCONFI000CASUnkYEL0db(CSU)/0133feet(DSX1) WildcardTDM410PBoard1OK800CASUnkYEL0db(CSU)/0133feet(DSX1)

Verifyyourconfiguredchannels
asterisk*CLI>dahdishowchannels ChanExtensionContextLanguageMOHInterpretBlockedState pseudodefaultdefaultInService 1frompstndefaultInService 2frompstndefaultInService 3frominternaldefaultInService 4frominternaldefaultInService

DAHDI extensions.conf
AnexampleofDAHDIdialplanisasfollows. [frominternal] VoIPCookbook:146

exten=>1000,1,Dial(DAHDI/1,20,rt) exten=>1000,2,Voicemail(1000,u) exten=>1000,102,Voicemail(1000,b) exten=>2000,1,Dial(DAHDI/2,20,rt) exten=>2000,2,Voicemail(2000,u) exten=>2000,102,Voicemail(2000,b) exten=>8500,1,VoiceMailMain exten=>8501,1,MusicOnHold exten=>1001,1,Dial(DAHDI/3,20,rt) exten=>1001,2,Voicemail(1000,u) exten=>1001,102,Voicemail(1000,b) exten=>1002,1,Dial(DAHDI/4,20,rt) exten=>1002,2,Voicemail(2000,u) exten=>1002,102,Voicemail(2000,b) exten=>_9.,1,Dial(DAHDI/g0/www${EXTEN:1}) exten=>_9.,2,Congestion exten=>_91.,1,Dial(DAHDI/1/www${EXTEN:2}) exten=>_91.,2,Congestion exten=>_92.,1,Dial(DAHDI/2/www${EXTEN:2}) exten=>_92.,2,Congestion [frompstn] exten=>s,1,Answer exten=>s,2,Dial(DAHDI/g1,20,rt) exten=>s,3,Voicemail(1000,u) exten=>s,103,Voicemail(1000,b) Wehavetomakesureacoupleofthings: [frominternal]and[frompstn]shouldbereflectedin/etc/asterisk/dahdichannels.conf [frominternal]and[frompstn]mustexistsin/etc/asterisk/extensions.conf. Ifunsure,replace[frominternal]and[frompstn]withdefault. MakesureDAHDI/1,DAHDI/2,DAHDI/3,DAHDI/4,DAHDI/g1etcarecorrectasreflectedin /etc/asterisk/dahdichannes.conf

VoIPCookbook:147

CHAPTER 7: Briker Softswitch


Brikerisasoftswitchbuiltonanumberofsoftware,includingFreePBX2.4,Asterisk1.4, Asterisk2Billing1.3andWebmin,allofwhichbundledintoalinuxsoftwarethatrunsonUbuntu Platform.Brikermaybefreelydownloadedfromhttp://www.briker.org. ThefirstthingyouneedtodobeforeinstallingtheBrikeristosetyourBIOSconfigurationsoyouwill bootyourcomputerusingtheCDROM.TheninserttheBrikerIPPBXCDintotheCDROM.Begin installationbytypinginstallandpressenter.Thenthebrikerautomaticallyerasesthecontentofthe hardiskandusesallthespacesavailableinthehardisk.

Briker's Installation Process

Figure7.1:Intheinstallermenu,therearemanyoptions:install, check,rescue,memtest,andhd Oncetheinstallationprocessiscompleted,thesystemwillcreateadefaultpasswordforconsolelogin andweblogin,aswellasconfigurethedefaultIPaddress.

VoIPCookbook:148

Defaultconsolelogin(SSHport22): Username :support Password :Briker Defaultweblogin(HTTPport80): Username :administrator Password :Briker defaultIPaddress: IPaddress :192.168.2.2 Subnetmask :255.255.255.0

Figure 7.2: Briker checks whether there's a CD-ROM Briker automatically checks the hardware components installed and finding the installer CD-ROM.

VoIPCookbook:149

Figure7.3:Brikeralsocheckswhetherallthehardware requiredfornetworkingareinplace Thenthebrikerautomaticallychecksthenetworkhardware,andautomaticallyconfiguretheIPaddress.

VoIPCookbook:150

Figure7.4:Formattingpartitions ThentheBrikerautomaticallyerasesthecontentofthehardiskandusesallthespacesavailableinthe hardiskforit.

VoIPCookbook:151

Figure7.5:Installingrequiredsoftware TheBrikerautomaticallyinstallsthebasesystemandothersoftwarerequired.

VoIPCookbook:152

Figure7.6:InstallingGRUBbootloader Finally,thebrikerwillinstallGRUBbootloader.Andoncethewholeinstallationprocessiscompleted, theCDROMwillautomaticallyejectthebrikerCDandthecomputerwillrestart.

VoIPCookbook:153

Briker's Console

Figure 7.7: With the installation completed, you will be able to begin the configuration process

Afterinstallingthesoftware,wecanbeginconfiguringthroughtheconsole,bychangingtheIP address,dateetc.Allcommandsfortheloginconsolecanbecarriedoutonlyafteryouauthenticate yourselfasarootuser.Thecommandsforconfigurationthroughtheconsolewillnotworkunlessyou enterthefollowingentries: $sudosu Thepasswordyouhavetoenteristheonesimilartothatofusersupport(defaultpassword).For securityreason,youshouldchangethedefaultpasswordbydoingthefollowing: #passwd ThedefaultIPaddressoftheBrikeris192.168.2.2.ChangethisaddresssothatBrikerwillbeableto adjustanynetworktopologyandobtainIPaddressallocation,byfirstofalleditingfile /etc/network/interfaces: #vi/etc/network/interfaces

VoIPCookbook:154

Figure 7.8: The default IP address of Briker The above figure shows that the IP address is 192.168.2.2. Make necessary changes and save the configuration by pressing F2 and exit the editing platform by pressing F10. Then restart the networking services to activate the configuration, by executing the following syntax: # /etc/init.d/networking restart

Next we have to make sure that the date and time of the Briker are set properly.Check them by typing the
following syntax: # date If they are not set properly, then adjust them. For example, if we want to set the time to 08.00 and date to July 1, 2008, then the syntax would be: # date -s "2008-07-01 08:00:00" Setting the date and time properly is particularly important if you are using Briker for commercial use.

VoIPCookbook:155

Briker's Web Configuration

Figure7.9:InordertoconfigureBriker,youneedtologon Withtheconsoleproperlyconfigured,youcannowconfigureBrikeradministration.BrowsetoBriker's IPaddressthroughthewebbrowser,aloginwindowwillappearasshowninFigure5.9.Usethedefault username,administratoranddefaultpasswordBriker,thenclickonLogin.

Figure7.10:Preferencessettings

VoIPCookbook:156

Tochangetheadministratorpassword,clickonMyAccountandchoosePreferences.Amenuasshown inFigure5.10willappear.Enterthenewpasswordinthepasswordboxandenterthesamepasswordin theRetypePasswordbox,thenclickonSavetoactivatetheconfiguration.

Figure7.11:Addinguser InBriker,wecanhavemorethanoneadministrator.ChooseAdministrationandthenManageUser. ThenfillinUsername,Email,FullName,PasswordandUserLevel,andclickAdd. TodoIPPBXconfiguration,chooseIPPBXAdministrationfromthemainmenu,asshowninFigure 7.9.

VoIPCookbook:157

Figure7.12:menutoconfigureIPPBXfeaturesisavailableinBriker,someofwhichare extensions,trunksandroutesconfiguration. IPPBXstatusindicatesSystemStatisticsshowingthepercentageofLoadAverage,CPU,Memoryand Swapbeingused,theusageofharddiskspaceandthespeedofReceiveandTransmitEthernet.Also availabeinthisdisplayisIPPBXStatisticsshowingTotalActiveCalls,InternalCalls,ExternalCalls, TotalActiveChannels,andUptimeBriker.Thesedataarerealtime,updatedperiodicallyand automatically,aprocessthatconsumesaconsiderableamountofCPUresources.Soitisrecommended thatyoudonotkeepaccessingthismainpage. Whenyouarefamiliarwiththemaindisplay,itistimeforyoutoaddExtension,userwhowilluse Brikerservices.ClickExtensiononIPPBXAdministrationmenu.Throughthisoption,youwillbe abletoaddnewaccount,omitorreplaceanyexistingone. ClickAddExtensions.Thenchoosethesortofprotocolsusedbytheaccount:SIP,IAX2,ZAP,or Custom(protocolotherthanthefirstthree).Withanyoftheseprotocolselected,clicksubmit(shownin Figure7.13).

Figure7.13:Extensiondiffersbythetypeofdeviceusedbyanaccount ThenDialogpropertiesasshowninFigure7.14willappear, promptingyoutoenteralltheinformationrequiredfor addingextension. Figure7.14:DialogPropertiesof AddingSIPExtension

VoIPCookbook:158

Fillinuserextensionwithextensionnumber,e.g.1001.Thisisusuallyjustnumeric.Thenfillinthe displayname,thenamethatwillbeusedasCallerIDwhendialing.Fillinsecretwiththepassword usedbyuserforauthenticationprocessinregistrationextensionatUserAgentlayer.ClickSubmit.

Zaptel Configuration
Zaptelisacollectionoftoolsanddriversdetectinghardwareintheformofanaloganddigitaltelephony cardinstalledonPCIorminiPCIslot.ThetelephonycardisusedtoconnectthebrikertoPlainOld TelephonySystem(POTS)networkortoanalogtelephone. Forexample,connectingthebrikertoanalogPBXrequiresanalogtelephonycard.Sodoesthebriker whenitisconnectedtoPublicSwitchTelephoneNetwork(PSTN),connectedthroughatelephonecable providedbytelecommunicationoperator.Theanalogordigitalcardtobeused,however,dependson thetypeoftechnologybeingusedbytheoperator.

VoIPCookbook:159

ToconfigureZaptel,firstofall,loginthroughtheconsole.Asthisinstallationrequiresrootprivileges, loginasarootbyexecutingthefollowingcommands: $sudosu Thenrungenzaptelconfcommand #genzaptelconf Tocheckwhetherzaptelhassuccessfullydetectedwhatitislookingfor,docheckingbyexecutingthe followingcommand: #ztcfgvvv Thenrestartzaptel,byexecutingthefollowingcommand: #/etc/init.d/zaptelrestart

SIP Trunk

VoIPCookbook:160

Figure7.15:AddingaTrunk InIPPBXAdministrationmenu,chooseTrunksmenu,chooseAddSIPTrunk.

Figure7.16:ThegeneralsettingsofAddSIPTrunk

Figure7.17:ThegeneralsettingsofAddSIPTrunk FillintheOutgoingSettings,asshowninFigure7.17,byusingdataaccountfromdifferentserver.Add particularoptionswhenevernecessary,suchasfailtoconnectorunabletoreceiveandmakeacall throughtrunk.Otherparticularoptionsare: context=fromtrunk qualify=yes VoIPCookbook:161

insecure=port,invite authuser=<similartousercontactormeetingitstrunkneeds> fromuser=<similartousercontactormeetingitstrunkneeds> fromdomain=<similartohostormeetingitstrunkneeds>

Figure5.18:ThegeneralsettingsofAddSIPTrunk ForRegisterString,obtainthedatafromOutgoingSettings,withtheformatusername:secret@<Trunk Name>.SavetheconfigurationbyclickingSubmitChanges.

VoIPCookbook:162

IAX2 Trunk
GotoTrunkmenu,asifyouliketoconfiguretheAIX2Trunk.ChooseAddIAX2.

Figure7.19:ThegeneralsettingsofAddIAX2Trunk

Figure7.20:ThegeneralsettingsofAddIAX2Trunk

VoIPCookbook:163

Figure7.21:ThegeneralsettingsofAddIAX2Trunk ForIAX2Trunk,makethesameconfigurationasshowninFigure7.19,7.20,and7.21.

VoIPCookbook:164

H323 Trunk
GototheTrunksmenuinIPPBXAdministrationmenu.

Figure7.22:Thereisnooption specificallyforH.323.Soyou havetochooseCustomTrunk

VoIPCookbook:165

ThenchooseAddCustomTrunk.

Figure7.23:Thegeneralsettings ofAddCustomTrunk

ForcustomizedTrunk,fillintheCustomDialStringbyusingtheformatH323/<h323gateway address>/$OUTNUM$.AsshowninFigure5.23,thegatewayaddressofH323is119.18.159.20.Then clickSubmitChanges. Openaterminalconsole,theneditthe/etc/asterisk/h323.conffile: #mcedit/etc/asterisk/h323.conf Editthefollowingoptionsavailableinthe/etc/asterisk/h323.conffile: Port=1720 bindaddr=<IPBrikeraddress> Thenrestartasterisk,byexecutingthefollowingcommand: #/etc/init.d/amportalrestart

VoIPCookbook:166

ZAP Trunk
ThistypeofTrunkisconnectedtoPSTNline,throughanalogcard(TDMxxx)ordigitalcard(TExxx). Afterdoingthezaptelconfiguration,dotheconfigurationinIPPBX,byfirstofallloggingintoIPPBX Administration.

Figure7.24: AddingZAP Trunk

ChooseTrunksmenuandchooseAddZapTrunk.Amenufortrunkconfigurationshouldappearas showninFigure7.25.

Figure7.25:GeneralsettingsofAdd ZapTrunk

FillZapIdentifier(trunkname)with g0,whichmeansgroup0.The descriptionofthegroup'sname(for example,group0)canbefoundat /etc/asterisk/zapatachannels.conffile.

VoIPCookbook:167

Outbound Routes
Outboundroutesareusedtomanagewherethecallshouldgoto,theonegoingoutthroughthetrunk.It istheseOutboundroutesthatdefinealltheoutgoingcalls.Forexample,forconnectingtoPSTN,Briker usesprefix9,whichisfollowedbythedestinationnumber.Thefollowingisanexampleofits configuration.

Figure7.26: Setting Outbound Routes

VoIPCookbook:168

InIPPBXAdministration,chooseOutboundRoutes.ChooseAddRoute. Figure7.27: SettingOutboundRoutes

FillintheconfigurationusingthesettingsshowninFigure7.27.Oftheparametersinthesettings,route name,dialpattern(theinitialcodetoconnecttootherserver),andTrunkSequence(Trunkbeingused. LookatTrunkssection)aremostimportant.Onceyouhavecompletedthesettings,clickSubmit Changes.

VoIPCookbook:169

Inbound Routes
InboundRoutesfunctionstomanagethedestinationofthecallcomingfromthetrunk.Whenacall comesfromthetrunk,thesystemwillcheckwhetherthecallisincompliantwiththeInboundRoutes configuration.Ifitis,thenthecallwillbeforwardedtoitsdestinationaccordingtotheconfiguration. InIPPBXAdministrationmenu,chooseInboundRoutes.ThenchooseAddIncomingRoute.

Figure7.28:SettingInboundRoutes Fordefaultconfiguration,youcanleaveAddIncomingRouteblank.InSetDestination,youcandirect anyincomingcallstoacertaindestination.IntheexampleshowninFigure7.29,allincomingcallsare directedtotheIVR.


Figure7.29: Inthisexample,allcallsare directedtoIVR

ThenclickSubmit

VoIPCookbook:170

Interactive Voice Response


InteractiveVoiceResponse,commonlyabbreviatedasIVR,isafeatureformanagingautomatic responsewheneverthereisacallcomingin.ThefollowingarethestepsnecessarytodoIVT configurationinthebriker.

Setup Recordings
MakearecordforIVRthatyouwilluse(youcanusetheMS.Recorderapplication).Forexample,you canrecordWelcometoPTJelajahMediaInformation,press1foroperator,andsettheencodeto16 bit,8,000Hz,andsaveitusingthe.wavextension(i.e.Welcomejmi.wav).Uploadthe.wavfileyou havejustcreatedtothemenu:IPPBXAdministration>SystemRecordings,uploadandnamethefile, forexample,welcomejmi,andsaveit. IVRSetup InIPPBXAdministrationmenu,chooseIVR.ThenchooseAddIVR.

Figure7.30:IVRSettings VoIPCookbook:171

Filltheparameterswiththefollowingdata: ChangeName:WelcomeJMI Timeout:10 EnableDirectory:no/unchecked DirectoryContext:default/empty EnableDirectDial:yes/check Announcement:WelcomeJMI(recording) OptionsavailableintheFigure7.30implythatauserwhocalltheIVRcouldpress1andbeforwarded toOptionJMIEnglish,providedthattheIVROptionJMIEnglishisactivated.Oncethedataand optionsareconfigured,clickSaveandchooseApplyconfigurationchanges.

Ring Groups
RingGroupisoneofmanyfeaturesusedtomanagegroupcall.Forexample,inacompanywith5 telephoneoperators/agents,thefiveoperatorscanbeincludedasagroup,whichisnamed,forexample, 'operatorhelp.'Wheneverthereisanincomingcall,thecallwillbedirectedtotheRingGroup'operator help.'Whenthefirstoperatorisbusy,thecallwillbeforwardedtothesecondoperatorandsoon.The followingistheRingGroupconfigurationinthebriker. ChooseRingGroupsinIPPBXAdministrationmenu.ThenchooseAddRingGroups

VoIPCookbook:172

Figure7.31:RingGroupssettings Usethefollowingconfiguration

Figure7.32:Inthisexample,thecallerwillbe directedtoIVRWelcomeJMIiftheagroup operatordoesnotrespond VoIPCookbook:173

UsethesettingsshowninFigure7.31.Thesettingsimpliesthatifagroupoperatordoesnotrespond, thenthecallerwillbedirectedtoIVR'WelcomeJMI.'

Pin Sets
PinSetsfunctionsassystemauthentication,afeatureactivatedwhenauserdoeshisorhercallthrough thetrunkandenteredthepasswordrequired. ChoosePinSetsinIPPBXAdministrationmenu,thenchooseAddPasswordSet.

Figure7.33:SettingAddPINSet ThefollowingmenuareconfigurationmenuforPINSets. PINSetDescription:descriptionofthenameofPIN RecordInCDR:choosethisifyouwanttohavethePINenteredinto CallDetailRecordwheneverthePINisused PINList:passwordtobeused

VoIPCookbook:174

CHAPTER 8: OpenSIPS High Performance Softswitch


Inthischapter,wewilldiscussonOpenSIPS.OpenSIPS(OpenSIPServer)isamatureOpenSource implementationofaSIPserver.OpenSIPSismorethanaSIPproxy/routerasitincludesapplication levelfunctionalities.OpenSIPS,asaSIPserver,isthecorecomponentofanySIPbasedVoIPsolution. Withaveryflexibleandcustomizableroutingengine,OpenSIPS'unifiesvoice,video,IMandpresence servicesinahighlyefficientway,thankstoitsscalable(modular)design. WhatOpenSIPShastooffer,comesinareliableandhighperformanceflavourOpenSIPSisoneof thefastestSIPservers,withathroughputthatconfirmsitasasolutionuptoenterpriseorcarriergrade class.ItperformsmuchbetterthanthatofAsterisk.However,itlacksoffeaturethatrichinAsterisk. Thus,inreality,itwouldbebeneficialtousebothAsteriskandOpenSIPS.

Compile OpenSIPS
Preparethesupportingsoftware.InUbuntu9.10andUbuntu10.04,itcanbepreparedbyusingthe followingcommand. #aptgetinstallflexbisongccmakelibperl5.10libperldevlibxmlrpcc3libxmlrpcc3dev\ unixodbcunixodbcdevlibradiusclientng2libradiusclientngdevlibxml2openssllibsctp1\ libsctpdevlibexpat1libexpat1devlibldap2.42libldap2devlibsnmp15libsnmpdev\ libconfuse0libconfusedevlibmysqlclient16libmysqlclientdevmysqlclient5.1mysqlserver\ zlib1gzlib1gdevlibmysql++3libmysql++devlibpcre3libpcre3dbglibpcre3dev InUbuntu10.10,itcanbedoneasfollows #aptgetinstallflexbisongccmakelibperl5.10libperldevlibxmlrpcc3libxmlrpcc3dev\ unixodbcunixodbcdevlibradiusclientng2libradiusclientngdevlibxml2openssllibsctp1\ libsctpdevlibexpat1libexpat1devlibldap2.42libldap2devlibsnmp15libsnmpdev\ libconfuse0libconfusedevlibmysqlclientdevmysqlclient5.1mysqlserverzlib1gzlib1gdev\ libmysql++3libmysql++devlibpcre3libpcre3dbglibpcre3dev GetsourcecodeofOpenSIPS,suchas,opensipsXXXtls_src.tar.gz,from http://opensips.org/pub/opensips/ http://www.opensips.org/index.php?n=Resources.Downloads#osippub http://www.opensips.org/index.php?n=Resources.Downloads#osipsf VoIPCookbook:175

IfwewouldliketouseopensipswithTLS,weneedtodothefollowings. $sudosu #cpopensips1.6.42tls_src.tar.gz/usr/local/src/ #cd/usr/local/src/ #tarzxvfopensips1.6.42tls_src.tar.gz #cdopensips1.6.42tls Compileandinstallthefollowingmodules,i.e.,"acc","mysql","textops","sl","db_mysql"and"enum" usingthefollowingcommand, #cdopensips1.6.42tls #makeall&&makeinclude_modules="accmysqltextopsslenumdb_mysql"modules #makeinstall Itseems,weneedtocopysomescriptsto/usr/local/src/opensips/opensipsctl #cpRf/usr/local/src/opensips1.6.42tls/scripts/*/usr/local/lib/opensips/opensipsctl That'sit.OpenSIPSiscompiledandinstallandreadytouse.OpenSIPSconfigurationfileislocatedat /usr/local/etc/opensips Checkforanyproblemintheconfigurationfilecanbedoneusingthefollowingcommand, #opensipscf/usr/local/etc/opensips/opensips.cfg ToRunopensips,putin/etc/rc.local opensipsf/usr/local/etc/opensips/opensips.cfg Pleasenoteweremovecswitch

Prepare User Database Server


OpenSIPSusesdatabaseserver,suchas,MySQLforhandlinguserregistration.InstallMySQLServer VoIPCookbook:176

andmakesureitworksusingthefollowingcommand, #aptgetinstallmysqlserverlibmysqlclientdevmysqlclient5.0 #/etc/init.d/mysqlrestart Tosetupthedatabaseserver,weneedtoedit/usr/local/etc/opensips/opensipsctlrcor /etc/opensips/opensipsctlrc,suchas, or #vi/usr/local/etc/opensips/opensipsctlrc vi/etc/opensips/opensipsctlrc Makesure, DBENGINE=MYSQL DBHOST=localhost DBNAME=opensips DBRWUSER=opensips DBRWPW="opensipsrw" DBROUSER=opensipsro DBROPW=opensipsro DBROOTUSER="root" Copyscriptsto/usr/local/lib/opensips/opensipsctl #cpRf/usr/local/src/opensips1.6.42tls/scripts/*/usr/local/lib/opensips/opensipsctl/ Initializedtheuserdatabaseusingopensipsdbctlcommandasfollow, #cd/usr/local/lib/opensips/opensipsctl #opensipsdbctlcreate Followthefollowingcommad MySQLpasswordforroot:<enterMySQLrootpassword> INFO:testservercharset INFO:creatingdatabaseopensips... INFO:CoreOpenSIPStablessuccesfullycreated.

VoIPCookbook:177

Installpresencerelatedtables?(y/n):<y> INFO:creatingpresencetablesintoopensips... INFO:Presencetablessuccesfullycreated. Installtablesforimccplsiptracedomainpolicycarrierrouteuserblacklist?(y/n):<y> INFO:creatingextratablesintoopensips... INFO:Extratablessuccesfullycreated.

Use opensipsctl
OpensipsctlisausefulltoolprovidedbyOpenSIPS,thatcanbeusedfor,

Addingusers. Checkwho'sonline. Monitoringopensipsactivities.

Toadduser,forexample,wecanuse #opensipsctladdnumber@hostpassword #opensipsctladd2000@192.168.0.3123456 Toseewho'sonline,forexample, #opensipsctlulshownumber@host #opensipsctlulshow2000@192.168.0.3 Afteropensipsisrunning,tomonitorOpenSIPSSoftswitchactivities #opensipsctlmonitor

Some Routing Technique in OpenSIPS


Inthefollowingsections,wewilldiscusshowtoroutetrafficto

VoIPCookbook:178

PSTNandCellullarnetwork AreaCodeforseveralinterconnectedSIPServers ENUMnetwork

HowtoroutetoPSTNandCellular
Basically,weneedanAnalogTelephoneAdapter(ATA)tointerconnectaVoIPnetworktoPSTNor Cellularnetwork.Inthisexample,weassume

ATAislocatedatIPaddress192.168.0.200 ATAisusingport5061 AreacodeforPSTNis021 AreacodeforCellullaris08

Weneedtoaddtotheopensipsconfigurationfile /usr/local/etc/opensips/opensips.cfg Forexample,tobeabletousetheATA(at192.168.0.200:5061)tocallPSTNfromallhost/domain #attempthandofftoPSTN if(uri=~"^sip:021[09]*@*"){ rewritehostport("192.168.0.200:5061");##192.168.0.200:5061istheATA route(1); };

TorestrictthecalltoPSTNonlyfrommydomain.com #attempthandofftoPSTN if(uri=~"^sip:021[09]*@mydomain.com"){##callerregisteredtomydomain.com rewritehostport("192.168.0.200:5061");##192.168.0.200:5061isATA route(1); };

TobeabletousetheATAtocallCellullarfromallhost/domain #attempthandofftocellullar if(uri=~"^sip:08[09]*@*"){ VoIPCookbook:179

rewritehostport("192.168.0.200:5061");##192.168.0.200:5061isATA route(1); }; TorestrictthecalltoCellularonlyfrommydomain.com #attempthandofftocellullar if(uri=~"^sip:08[09]*@mydomain.com"){##callerregisteredtomydomain.com rewritehostport("192.168.0.200:5061");##192.168.0.200:5061isATA route(1); };

HowtorouteusingAreaCodeforinterconnectedSIPServers
ForexamplewehaveseveralSIPServersinournetwork,suchas, AreaCode SIPServerIPAddress

021 203.159.31.99 022 203.159.31.123 023 203.159.31.48 ThedialplanforOpenSIPSwouldbesomethinglike, if(uri=~"^sip:021[09]*@*"){ strip(3); rewritehostport("203.159.31.99:5060"); route(1); }; if(uri=~"^sip:022[09]*@*"){ strip(3); rewritehostport("203.159.31.123:5060"); route(1); }; if(uri=~"^sip:023[09]*@*"){ strip(3); VoIPCookbook:180

rewritehostport("203.159.31.48:5060"); route(1); };

HowtorouteENUMQueryinOpenSIPS
StepstorouteENUMqueryinOpenSIPSisasfollows,

PrepareENUMmodulinOpenSIPSconfiguration CreateroutingtableforENUM

ENUMqueryinOpenSIPSisbasicallytransformtheURIaddressfromENUMtoURISIP.Call processisnormallydoneusingtheURISIP. TopreparetheENUMmoduleinOpenSIPSconfiguration,weneedtoedit /usr/local/etc/opensips/opensips.cfgor/etc/opensips/opensips.cfg #vi/usr/local/etc/opensips/opensips.cfg Enterthefollowingcommand loadmodule"enum.so" modparam("enum","domain_suffix","e164.arpa.") modparam("enum","i_enum_suffix","e164.arpa.") Wecanchangee164.arpatootherENUMtopleveldomain,suchas,e164.idore164.th.

TestENUMQueryinOpenSIP
Assuming:

AnAsteriskServerRunningat192.168.0.2 Echotestreadyatnumber600 ENUMServerisreadytoresolveENUMQueryfore164.id. DatainENUMServerreadytomap+62555666666600to600@192.168.0.2

VoIPCookbook:181

Testtestroutingtablewouldbe rewriteuri("sip:62555666666600@192.168.0.2"); prefix("+"); enum_query("e164.id."); route(1); route[1]{ #senditoutnow;usestatefulforwardingasitworksreliably #evenforUDP2TCP if(!t_relay()){ sl_reply_error(); }; exit; }

ENUMRoutingTableinOpenSIPSconfiguration
Theshortversion if(uri=~"^sip:00[19][09]*@*"){ strip(2); prefix("+"); }; if(uri=~"sip:\+[09]+@*") enum_query("e164.id."); TheaboveexamplewillallowallclientfromallservertoaccessourENUMqueryrouting.Amore completeversionofENUMquerymaybeasfollows, #Somewhereintheroute[x]section: #ifyouwanttomakeENUMworkwithnumbersstartingwith"00", #usethefollowingtoconvert"00"itintoa"+" if(uri=~"^sip:00[19][09]*@example\.net"){ VoIPCookbook:182

#stripleading"00" #(changeexample.nettoyourdomainnameorskipthestuffafterthe"@") strip(2); #(adjust,ifyourinternationalprefixissomethingelsethan"00") prefix("+"); }; #checkifrequesturistartswithaninternationalphone #number(+X.),ifyes,trytoENUMresolveine164.arpa. #ifnoresult,tryinnrenum.net if(uri=~"sip:\+[09]+@example\.net"){ #(changeexample.nettoyourdomainnameorskipthestuffafterthe"@") if(!enum_query("e164.arpa.")){ enum_query("nrenum.net."); }; }; Anotheralternativethatmaybeextendedisasfollows, #isthisanENUMdestination(leading+?) if(method=="INVITE"&&uri=~"sip:\+[09]+atiptel\.org"){ if(!enum_query("voice"))#ifparameterempty,itdefaultsto"e2u+sip" enum_query("");#E2U+sip } Yetanotheralternativethatcanbetried/expandedisasfollows, if(is_from_user_enum()){ enum_query(""); }

VoIPCookbook:183

CHAPTER 9: ENUM
ENUMisbasicallyamappingmechanismtomapTelconumber,suchas,+628113334567or +62555334567,toanumberrecognizeinVoIPnetworksuchas,20333@voiprakyat.or.idor 5007987@fwd.pulver.com.Thus,inprinciple,ENUMismerelyatable. ENUMisnotlimitedtomappingonly.ENUMrecognizeprioritizing.Forexample,aphonenumber +6255534567mayhaveseveralclientwithpriority,suchas, +6255534567 +6255534567 +6255534567 +6255534567 +6255534567 priority1 priority2 priority3 priority4 priority5 245678@voiprakyat.or.id 6543686@fwd.pulver.com +62215678976(nomorkantor) +62856789654(nomorhandphone) mail:oknum@salemba.co.id

TheactualwritingofENUMontheInternet,forexampleusingthetopleveldomaine164.id,isas follows, +6255512345678 +6281812345678 8.7.6.5.4.3.2.1.5.5.5.2.6.e164.id 8.7.6.5.4.3.2.1.8.1.8.2.6.e164.id

PleasenotethattheENUMnumberisreversedasopposetotheknownnormalphonenumber.

Example of ENUM Service


OneofthebestexampleofENUMServiceisthee164.org,wecanregisterandhasagood authenticationmechanismbycallingourphonenumberbeforeitmapstotheirdatabase. e164.orgnottheonlyENUMServer.FriendsatVoIPRakyatinIndonesiacreatestheirownENUM serverlocatedathttp://www.enum.voiprakyat.or.id.

Delegation Concept in ENUM


WehopeaswearereadyeachcountrywillhavetheirveryownENUMServerandreceiveadelegation frome164.arpa.ForIndonesia,itwouldbe2.6.e164.arpaforhandlingcountrycode(+62).

VoIPCookbook:184

TounderstandhowENUMworks,oneneedstounderstandhowaDomainNameSystem(DNS)works asENUMusesDNSServer.Thus,ENUMworksfairlysimilartoDNSbuttomapandtodelegatea phonenumber.PleasenotethatENUMisdifferentfromaSIPServer. ImagineatnationallevelthereisanallocationofareacodeforSIPnetworkon+62555.Itcanbe mappedtoENUMunderthedomain,forexample,5.5.5.2.6.e164.id.ItmayhaveseveralENUMName Server(NS)suchas, ENUMServerDomain5.5.5.2.6.e164.id +62555 ENUMNS 202.123.123.124 +62555 ENUMNS 235.123.123.234 Pleasenotethatatnationallevel,theENUMServermaynothaveacompleteinformationonthe subscribers. Forexample,acommunityoracorporateoratelecomunicationoperator,assigned4444areacodefor itsnetwork,suchthat,itmayuse +6255544440000+6255544449999 basically,itmayallocatephonenumberfor10.000subscribers.Thus,thecommunitymayruntheir ownENUMserverunderthesubdomain4.4.4.4.5.5.5.2.6.e164.id,forexample ENUMServerDomain4.4.4.4.5.5.5.2.6.e164.id +62555444 ENUMNS 212.234.234.234 +62555444 ENUMNS 212.234.234.235 Inthedelegationprocess,theNSinformationofENUM4.4.4.4.5.5.5.2.6.e164.idmustbewrittenin ENUM5.5.5.2.6.e164.idthattells 4.4.4.4.5.5.5.2.6.e164.id 4.4.4.4.5.5.5.2.6.e164.id INNS 212.234.234.234 INNS 212.234.234.235

ENUMconceptisnotconfinedtooperator,anycorporateorcommunitywithsmallernumberof extensions,e.g.,100extentionsmayuse,forexample,ENUMallocationfor, +6255566666600+6255566666699 Thus,thisparticularcorporatemusthasitsownENUMserverorcollocatetootherENUMserverto VoIPCookbook:185

handle6.6.6.6.6.6.5.5.5.2.6.e164.id,suchas NUMServerDomain6.6.6.6.6.6.5.5.5.2.6.e164.id 62555666666 ENUMNS 212.234.234.4 62555666666 ENUMNS 212.234.234.5 DelegationprocessforNSof6.6.6.6.6.6.5.5.5.2.6.e164.idmustbeenteredintothemainENUMServer for5.5.5.2.6.e164.idttotell 6.6.6.6.6.6.5.5.5.2.6.e164.id INNS 212.234.234.4 6.6.6.6.6.6.5.5.5.2.6.e164.id INNS 212.234.234.5 TheENUMdelegationconceptisclearlyshownthatisnotlimitedtooperator.Anyentitiesmayhave theirveryownphonenumber.Thus,amorecomprehensiveauthenticationprocessmaybeneededto makesurethephonenumberisproperlydelegated.

ENUM Implementation
ENUMServerisprincipallyaDNSServer.Thus,ifonehasaDNSServer,onemayreadilyrunan ENUMServer.ToInstallanENUMSever,oneneedto,

InstallaDNSServer.InLinux,wenormallyuseBINDforDNSserver. AddourENUMallocationin/etc/named.conf.local. IncludeourENUMdataintothedatabasefilementionedin/etc/named.conf.local.

BINDInstallation
InstallBINDasfollows, aptgetinstalldnsutilsbind9

SetupBINDforENUMServer
Forexample,weareassignedfor+625XXXX.Weneedtoedit,

VoIPCookbook:186

/etc/bind/named.conf.local Entryfordomain5.2.6.e164.id zone"5.2.6.e164.id"IN{ typemaster; file"/etc/bind/5.2.6.e164.id.db"; }; Allsubscribernumbersmustbelistedin/etc/bind/5.2.6.e164.id.db.AnexampleoftheDNSfileof /etc/bind/5.2.6.e164.id.dbisasfollows, $TTL86400 @ INSOAns.warnet.co.idadmin.warnet.co.id.( 42;serial(d.adams) 3H;refresh 15M;retry 1W;expiry 1D);minimum INNS ns.warnet.co.id. 0.0.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2000@192.168.0.3!". 1.0.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2001@192.168.0.3!". 2.0.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2002@192.168.0.3!". 3.0.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2003@192.168.0.3!". 4.0.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2004@192.168.0.3!". 5.0.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2005@192.168.0.3!". 0.2.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2020@192.168.0.3!". 1.2.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2021@192.168.0.3!". 2.2.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2022@192.168.0.3!". 0.3.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2030@192.168.0.3!". 1.3.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2031@192.168.0.3!". 2.3.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2032@192.168.0.3!". 3.3.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2033@192.168.0.3!". 0.5.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2050@192.168.0.3!". 1.5.0.2 NAPTR10100"u""E2U+sip""!^.*$!sip:2051@192.168.0.3!". Forexample,itmeansthemappingnumbersisasfollows, VoIPCookbook:187

+6252000 +6252001 +6252002

0.0.0.2.5.2.6.e164.id 2000@192.168.0.3 1.0.0.2.5.2.6.e164.id 2001@192.168.0.3 2.0.0.2.5.2.6.e164.id 2002@192.168.0.3

Aftertheeditingprocess,pleaserestartheDNSServerusingthecommand #/etc/init.d/bind9restart

TestDNSforENUMQuery
WecanusethedigcommandonthelocalhostoftheDNSservertoquerytheENUMentries,for example, $digNAPTR0.0.0.2.5.2.6.e164.id@127.0.0.1 Theoutputwouldbeapproximately ;<<>>DiG9.6.1P1<<>>NAPTR0.0.0.2.5.2.6.e164.id@127.0.0.1 ;;globaloptions:+cmd ;;Gotanswer: ;;>>HEADER<<opcode:QUERY,status:NOERROR,id:10744 ;;flags:qraardra;QUERY:1,ANSWER:1,AUTHORITY:1,ADDITIONAL:1 ;;QUESTIONSECTION: ;0.0.0.2.5.2.6.e164.id. IN NAPTR NAPTR 10100"u""E2U+sip""!^.*$!

;;ANSWERSECTION: 0.0.0.2.5.2.6.e164.id. 86400 IN sip:2000@192.168.0.3!". ;;AUTHORITYSECTION: 5.2.6.e164.id. 86400 IN ;;ADDITIONALSECTION: ns.warnet.co.id. 86335 IN ;;Querytime:0msec

NS A

ns.warnet.co.id. 76.163.126.2

VoIPCookbook:188

;;SERVER:127.0.0.1#53(127.0.0.1) ;;WHEN:TueNov2408:12:112009 ;;MSGSIZErcvd:137

ENUM Delegation in BIND


Inacountry,forexample,Bhutan(+975)mayhaveENUMtopleveldomain 2.5.7.9.e164.bt forexample,runningatamachine203.159.31.41. Forexample,wewanttoallocatephonenumbersdifferentorganization,suchas, Organization MinistryofEduction UniversityA HighSchoolB VillageC DzongD Number +9752123XXX +9753544XXX +9753342XXX +9755768XXX +9757243XXX ENUM ServerIP 3.2.1.2.5.7.9.e164.bt 203.159.31.100 4.4.5.3.5.7.9.e164.bt 202.154.1.10 2.4.3.3.5.7.9.e164.bt 222.119.6.45 8.6.7.5.5.7.9.e164.bt 231.167.31.20 3.4.2.7.5.7.9.e164.bt 204.19.1.5

AttheENUMCountryLevelDNS,inthisexample203.159.31.41,thedelegationprocessisdoneby configuringfile/etc/bind/named.conf.localsuchthat zone"3.2.1.2.5.7.9.e164.bt"{ typeslave; masters{ 203.159.31.100; }; file"/var/lib/bind/3.2.1.2.5.7.9.e164.bt.hosts"; };

VoIPCookbook:189

zone"4.4.5.3.5.7.9.e164.bt"{ typeslave; masters{ 202.154.1.10; }; file"/var/lib/bind/4.4.5.3.5.7.9.e164.bt.hosts"; }; zone"2.4.3.3.5.7.9.e164.bt"{ typeslave; masters{ 222.119.6.45; }; file"/var/lib/bind/2.4.3.3.5.7.9.e164.bt.hosts"; }; zone"8.6.7.5.5.7.9.e164.bt"{ typeslave; masters{ 231.167.31.20; }; file"/var/lib/bind/8.6.7.5.5.7.9.e164.bt.hosts"; }; zone"3.4.2.7.5.7.9.e164.bt"{ typeslave; masters{ 204.19.1.5; }; file"/var/lib/bind/3.4.2.7.5.7.9.e164.bt.hosts"; }; Whereon203.159.31.100,202.154.1.10,222.119.6.45,231.167.31.20and204.19.1.5,wemustrunmaster DNSserverforeachrespectiveENUM.

VoIPCookbook:190

CHAPTER 10: Conference Server on Asterisk


EstablishingconferencecallsinPABXiscomplicated,aswehavetoconfigurethemproperly.Unlike AsteriskConferencefeature,commercialconferencingfacilitiesareeasytousebuttheycanbe exorbitant.SoitisfortunateforustohaveAsteriskassomethingtohelpusestablishnotonly inexpensivewaystoconferencingbutalsoeasier.Basically,therearetwostepsnecessaryfor configuringconferencinginAsterisk: Makeconference"room" Add"room"todialplan.

Configuring Conference Room MeetMe


Asterisk'sconferenceroomissetupin/etc/asterisk/meetme.conf.Allconferenceroomsshouldbelisted underheader[rooms].Thesyntaxusedtoconfigureconferenceroomis: conf=>conference_number[,pin][,adminpin] Thefollowingisanexampleofaconferenceroomsetupwiththenumber2500andPIN1234: [rooms] conf=>2500,1234 Ifwesetupmorethanoneroom,itisrecommendedthatyoulabelthemsoastorememberwhich numberforwhichconference. [rooms] ;marketingteam conf=>2500,1234 ;publisherteam conf=>2501,5678 Sincebeinganadministratordoesnotprovideuswithauthorizationthatcouldusethefeatures otherwiseavailablewhenweuseAsteriskforsomethingmuchmorecomplicated,itisnotnecessaryto setthePIN.

VoIPCookbook:191

Thereareseveraloptionsthatcanbeused,suchas: mcallercanlistenbutnotspeak. tcallercanspeakbutcannothear. pcallercangetoutoftheConferencebypressingthe#key. Therearetwoadditionaloptionsthathavenotbeenimplemented: sAsteriskprovidesmenutotheuserif*ispressed. agivetheuseradministratorprivilegesonaconference.

Configuring Dialplan for Conference


Toconfigurethisdialplan,wehavetoeditfile/etc/asterisk/extensions.confandincludetheconference roomwewishtohaveinit.Thiscanbedonebyusingadifferentcontextforeachroom,forexample: [marketing_team_conference_room] exten=>300,1,MeetMe,2500(1234) [publisher_team_conference_room] exten=>301,1,MeetMe,2501(5678) Sothecallersneedonlytocallthephonenumber300or301,enterthePINwhenasked,andtheywill gointoconference.MeetMewillringabelltoinformthosealreadyinconferencethatthereissomeone enteringintotheconference. Wecancertainlygatherallthe"room"conferenceswithinacontext.Oradda"room"toanexisting context,withthefollowingcommand. [localusers] exten=>250,1,Dial(SIP/alrac,10,r) exten=>250,2,VoiceMail(u250@localvmusers) exten=>250,dial+101,VoiceMail(b250@localvmusers) exten=>300,1,MeetMe,2500(1234) Oraddacomprehensivecontext

VoIPCookbook:192

include=>marketing_team_conference_room IftheestablishedconferencegivesthecallerstheopportunitytolistentospeechesfromtheBoss withoutinterruptingthespeech,thenwehavetodothefollowing: [marketing_team_conference_room] exten=>300,1,MeetMe,2500|m|1234 Newcallerswhohavejoinedtheconferencecanfindouthowmanypeopleintheconferenceuse MeetMeCountapplications,byexecutingthefollowingcommand: [marketing_team_conference_room] exten=>300,1,Playback(there_are) exten=>300,2,MeetMeCount,2500 exten=>300,3,Playback(callers) exten=>300,4,MeetMe,2500 Ofcourseyouneedtosavetwosoundfilesthatsomewhatreads"Thereare"and"Callerspresentinthe conference".Aftereditingextensions.conf,donotforgettoreloadthenewconfiguration.Inorderto preventanomaliesencounteredduringoperation,wecanrunasteriskconsoleandexecutethefollowing command: #asteriskr asterisk1*CLI>extensionsreload

Activating Conference while Operating


OneofneedsthatmayariseisthesettingofaconferenceroomatanytimeduringoperatingVoIP.For thispurpose,itisnotnecessaryforustochangethecontentofextensions.conffile.Howeverweneedto setupaconferencethatitsgeneralcontextintheextensions.conffileandmeetme.conf: ;meetme.conf [rooms] ;generalpurposeconferenceroom conf=>3500,1234 ;extensions.conf ;genericconferenceroom VoIPCookbook:193

[gen_conference] Ifweneedestablishanewconference,wecanimmediatelymakeitthroughCLI,withthefollowing command: localhost*CLI>addextension400,1,Dial,3500intogen_conference Extension'400,1,Dial,3500'addedinto'gen_conference'context Hereextension400willbeaddedwithpriority1togen_conference.Ofcourse,thisextensionwill disappearifwerestarttheasterisk,orwecandeleteitthroughthefollowingcommand: localhost*CLI>removeextension400@gen_conference Wholeextension400@gen_conferenceremoved Inmultilineextensions,wecanomitasinglelineorcommandbygivingapriority,forexample localhost*CLI>removeextension400@gen_conference2 Extension400@gen_conferencewithpriority2removed

VoIPCookbook:194

CHAPTER 11: Trunk Peering in Asterisk


OneofthemainreasonswhyweuseVoIPistohavefreelongdistanceorinternationalcalls.Imagine thatifyou'rehavingabranchofficeorworkingpartnerswhooftencommunicatewithyou.Youhaveto establishaprivatenetworkbetweenofficebranchesorthoseworkingpartnerssoyoucanbypassthe PSTN.ThereareanumberwaysyoucandothisthroughAsterisk. DUNDi,DistributedUniversalNumberDiscoveryprotocol. Centralizeddirectory,suchasVoIPRakyat

Onthisoccasion,youwillbeshownatrunkpeeringprocessusingVoIPRakyat.Thesamemechanism canbeappliedtootherSIPproxyacrosstheworld. Inaddition,wewillalsodiscusstherealproblemswefaceinconfiguringnetworkinvolving NAT/ProxyServer,asmostnetworksareprotectedbyfirewallthatblocksVoIPsignal. WepresumethatwealreadyhaveanaccountinVoIPRakyat.Inthissense,thegivennumberand passwordare: number number 2012345passwordabcdef 2055555password123456

Nextwewilldoacomprehensiveconfigurationoffilesip.confandextensions.conf,including providingthefacilitiesrequiredfortesting. Ingeneral,thereareseveralimportantthingsinconfiguringtrunkinAsterisk RegistrationtoSIPaccountinvoiprakyat(sip.conf) Creatingusername&passwordforvariousextensions(sip.conf) ConfiguringDialoutforavarietyofconfigurations(extensions.conf) Configurationforinboundcall(extensions.conf[inboundsip])

Withthisconfiguration,wecannowplaceoutgoingcallsusingvariousavailablelines.Inaddition,we canalsoreceivecallsdialedfromvoiprakyatandtheinternetthroughinboundsipmodule.Thedetailof eachofavarietyofconfigurationsisavailableintheenclosedconfiguration.

VoIPCookbook:195

CHAPTER 12: NAT and Firewall


NetworkAddressTranslation(NAT)orbetterknownasproxyserverisoftentroublesomeforSIP configuration.TheresultingproblemusuallyfoundiseitherpoorVoIPconnectivityornoconnectivity atallastheconnectivityisblockedbyaFirewall/NAT.Whensomethinglikethisoccurs,youhaveto dothefollowing: 1. ensurethatanantivirussoftwareorfirewallactiveinyourPCisnotblockingVoIP 2. ContactyournetworkadministratorandtellhimorhertoenableNATforyouorgiveyoua PublicIP,andopenthefollowingports: ForSIP: UDPport3478and3479(STUN,NATtypediscovery) UDPport5060and5066(SIP,signaling) UDPport8000to20000(RTP,data,voice+video) ForIAX2: UDPport4569(IAX2,signalinganddata) AsteriskmayactasaSIPclientorSIPserver.Tomakeitaclient,dothefollowingcommand: register=> inpartof[general]insip.conf. WemayhaveAsteriskfunctionasaSIPserver,byconfiguringtheusername,password,andother detailsoftheSIPclientthatwillberegisteredtoAsteriskinsip.conf. TherearesomescenariosofSIPNATnetworkchannels: 1. 2. 3. 4. 5. 6. 7. 8. AsteriskSIPclientbehindtheNAT,withtheclientconnectedtoaSIPproxyoutsidetheNAT AsteriskSIPclientbehindtheNAT,withtheclientconnectedtoaSIPproxywithintheNAT AsteriskSIPserverbehindtheNAT,withtheclientoutsidetheNATconnectedtoAsterisk AsteriskSIPserverbehindtheNAT,withtheclientwithintheNATconnectedtoAsterisk AsteriskSIPclientoutsidetheNAT,withtheclientconnectedtoSIPproxyoutsidetheNAT AsteriskSIPclientoutsidetheNAT,withtheclientconnectedtoSIPproxywithintheNAT AsteriskSIPserveroutsidetheNAT,withtheclientoutsidetheNATconnectedtoAsterisk AsteriskSIPserveroutsidetheNAT,withtheNATclientconnectedtoAsterisk VoIPCookbook:196

Ingeneral,thesetupcanworkwiththeexistingconfiguration,ofcourse,dependingonthe configurationoftheclient,NAT,serverandmanyotherfactors,especiallythefirewallconfiguration. Ofthosesetups,number3and6aredifficulttodobecauseSIPisapeertopeerprotocolandmost NATsallowonlyclientsinsidetheirnetworktoconnecttoaserverlocatedoutsidebutnotviceversa. 1. 2. 3. 4. 5. 6. 7. 8. RunningwithaproxyserverthatsupportsNAT RunningwithnoNATinbetween RunningbydoingportforwardingintheNAT/proxyserver RunningwithnoNATinbetween RunningwithnoNATinbetween RunningbydoingportforwardingontheNAT/Proxyserver RunningwithnoNATinbetween Runningwithconfigurationnat=yesandqualify=xxxinsip.conf.SomeclientsusingXLikeuse STUNandsendUDPkeepalivepackets.QualifywillsendakeepalivepacketsfromAsterisk toanyclientintheNAT

However,theworstcaseoccurswhenAsteriskiswithinNATandtheclientiswithindifferentNAT.For this,weneedtohaveamediatorthatcouldseebothwayssimultaneously.Tochannelvoicedataor streaming,weneedamediaserver.AsteriskwhichisplacedoutsidetheNATwouldbeabletofunction asamediaserver,andwecanalsoaddthefeaturetodoCodecconversion.

VoIPCookbook:197

CHAPTER 13: Voicemail in Asterisk


VoicemailisusedinAsterisktoleaveamessage,whenthereisnoonetoreceivetheincomingcall. VoicemailconfigurationforAsteriskisavailableinvoicemail.conffileavailablein/etc/asterisk/.We cancreateamailboxwithinthedefaultmailboxcontext,eitherusetheonealreadyavailableorcreate anotherindifferentcontext.Itisimportanttounderstandthatthecontextinvoicemailmailboxisnot relatedtothecontextinextensions.conf Thecommandtocreateavoicemailmailboxisapproximatelyasfollows mailbox_number=>password,name,email mailbox_numberisthenumberusedinextension.confforVoiceMail()commandandforregisteringa usertosip.conforiax.conf.Passwordisthepasswordusedtoregisterausertosip.conforiax.conf. Nameisthenameassociatedwithamailbox,andemailistheemailusedtoinformifthereisan incomingvoicemail. Sampleofvoicemail.confcontentisasthefollowing: [mb_tutorial] 777=>1212,ivan,ivan@voiprakyat.or.id Herethemailboxcontextiscreatedusingthenamemb_tutorialcontext,mailboxnumber777with password1212,whichisownedbyivanwhoseemailisivan@voiprakyat.or.id.Forauserwhocalls Ivanatextension1234tobeabletoleaveamessageinIvan'smailbox,thefollowingcommandcanbe used: Voicemail(mailbox_number@context) Inextensions.conffile,thecontentisasthefollowing: exten=>1234.1,Dial(SIP/ivan,30) exten=>1234.2,VoiceMail(777@mb_tutorial) exten=>1234.3,PlayBack(vmgoodbye) exten=>1234.4,HangUp() Intheexampleabove,AsteriskwillattempttocallSIPuserivanforextension1234andwaitfor30 seconds.Ifnobodyanswersthephone,Asteriskwillcarryoutthenextpriority,thatis,Asteriskwill VoIPCookbook:198

openmailbox777inmb_tutorialcontext.Oncethecallerhasleftamessage,Asteriskwillcarryout playback(rewindthemessage)andhangupthecall.Playback(vmgoodbye)willexecutevmgoodbye filethatshouldbeavailablein/var/lib/asterisk/sounds/. TheVoicemailmessageisrecordedin /var/spool/asterisk/voicemail/<context>/<mailbox>/INBOX/ ThereforethefullpathtoIvanis /var/spool/asterisk/voicemail/mb_tutorial/777/INBOX/. Tolistentothemessagestoredinthemailbox,wecanplaceacallbyusingVoiceMailMaincommand inAsterisk.Thecommandisasfollows: VoiceMailMain(mailbox@context) InthedefaultconfigurationofAsterisk,ifthesampleconfigurationremainsaswhatis,VoiceMailMain canbecontactedusingthenumber8500. Theconfigurationsampleofextensions.confforaccessingVoiceMailMainis: exten=>9999.1,VoiceMailMain(777@mb_tutorial) Bydialing9999,wewillbeabletogointomailbox777,ofcourseafterweenteredthecorrect passwordforthismailbox,whichis1212. VariousoptionsareavailablewhenaccessingmailboxesusingVoiceMailMain: 0Mailboxoptions 1Recordunavailablemessage 2Recordbusymessage 3Recordourname 4Changeourpassword *Backtomainmenu 1Listentooldmessages 2Changefolders 3Advancedoptions 1Sendreply VoIPCookbook:199

2Callback 3Envelope 4Outgoingcall 5Leavemessage *Backtomainmenu 4Playpreviousmessage 5Repeatmessage 6Playnextmessage 7Deletethismessage 8Forwardmessagetoanothermailbox 9Savemessageinafolder *Help;duringmessageplayback:Rewind #Exit;duringmessageplayback:FastForward Whenwelistentoavoicemailmessagerecording,wecanusethefollowingbuttonstonavigate,ie, *torewind(goingback) #toFastForward(forward) Note:the'#'and'*'buttonsworkonlywhenthemessageisintheprocessofplayback.

VoIPCookbook:200

CHAPTER 14: More on Asterisk's Dialplan


Oneofthemostdifficultpartsinconfiguringatelephoneexchangeistheconfigurationofdialplan. Asteriskdialplanconfigurationisintheextensions.conffile,whichisusuallylocatedin /etc/asterisk/extensions.conf.Dialcontrolswhatneedstobecarriedoutwhenthereisincomingor outgoingcall.Inotherwords,dialplancontrolsthepatternofcallsinoursoftswitch. Extensions.confisconfiguredbasedonanumberofmodulescontainingdefinitionsorstaticparameter settings.Thesemodulesarealsoknownascontext,definedbythesystemadministrator.Incontext, theretwoparts,generalandglobal.Theformer,availableinthethetoppartofextensions.conf,allows ustosetanumberofmainconfigurationsforextensionsinAsterisk.Thelatterallowsustodefinea numberofvariablesofglobalconstantsandinitializethevalues.Oncethesepartsofcontextareset,the restofcontentofextensions.conffileistakenbytheDialplan.SoDialplanconsistsofcontexts,with everycontextconsistingofextensions. Inaddition,thereisalsoMacro,aspecialtypeofcontext,labeledbythenamedefinedbytheuserwho typicallyusesmacroprefix.Macrocanbeexecutedrepeatedly,behavingsimilartothesubroutinein programminglanguage. Eachsectioninextensions.confbeginswithanamewritteninsquarebrackets,soastomake extensions.conf'sstructuresimilarto.inifileinWindows.

Pattern Extension
Whenwedefineextensionsinacontext,notonlycanweuseordinarynumbers,namesorletters,but wecanalsodefinetheextensionsthatmatchasetofnumbersdialedusingextensionpattern.

Attaching context
Acontextcontainingextensionscanbeincorporatedintoorassociatedwithothers.Forexample, considerthefollowingcontext: Context"default": Extension 101 102 Note MarkSpencer WillMeadows VoIPCookbook:201

Operator

Context"local": Extension Note _9NXXXXXX Localcalls include=>"default" Context"longdistance": Extension Note _91NXXNXXXXXX Longdistancecalls include=>"local" Wehavedefinedthreeextensions: Operator.Defaultcontextallowsustodial3telephoneextensions:Mark,Willandtheoperator Localcontexthasonlyoneextensionthatallowsustodial7digitnumber.Inaddition,ifwe incorporatethedefaultcontextintothelocalone,wecanalsodialMark,Willandtheoperator. Thelongdistancecontexthasanextensionpatternallowingustoplacealongdistancecall. Thiscontextalsoincludeslocalcontext,andthusalsoallowsustocallalocalnumberoreven theextensionofMark,Wilandtheoperator.

Usingcontextintheextension,wecancarefullyregulatewhocanhaveaccesstoalargernetwork.Be careful.Ifthereismorethanonepatternthatmatchthedialednumber,Asteriskmaynotusethe numberswewant.

The Extension Pattern


WhenAsteriskacceptsincomingconnectionthroughachannel,Asteriskwillseethecontextdefined forsuchachanneltoseewhatcommandsthatneedtobecarriedoutbyAsterisk.Contextwilldefinea setofcommandsdependingontheextensioncalledbytheuser.Forexample,agivencontextmaygive asetofcommandsifausercallsthenumber"123",andasetofothercommandsiftheuserdials"9". Wecanalsocreateanothersetofcommandsiftheusercallsnumberbeginningwith"555. Ifthereareincomingconnectionssuchasthatcomingfromphonelineoutsideitimpliesthatthe userhasnotdialedanextension.Inthiscase,Asteriskwillactasauserdialingaparticularextension called"s"(originatingfromthewordStart).Asteriskwilllookfortheextension"number"sinthe definitionofcontextforthechannelandlookforinstructionsthatneedstobecarriedoutforthe"s" extension. VoIPCookbook:202

Forexample,wehaveachannel"Zap/1",whichisconnectedtoatelephoneinanoffice.Forexample, intheZapchannelconfiguration(zapata.conf)wehavedefinedcontext=johnforZapchannel1. Therefore,ifweuseahandsettodialanumber,Asteriskwilllookforcontextwiththename"john"in extensions.conftoseewhathastobedone.Wecanstartacontextbywritingthenameinsquare brackets


[john]

Foreachcontext,wecandefineoneormoreextensionsthatcanbeusedbyAsterisktocomparethe numberstobedialed.Foreachextension,wecantellAsteriskwhatneedstobedonethoughasetof commands.

Extension
Anextensioncanbeaseriesofnumbersorapattern.Extensioncanbeaseriesofnumber,like123,and mayalsocontainsomestandardsymbols*and#,whichareavailableonthephonekeypad.So34#76is avalidextensionnumber.SomekeypadsarelabeledA,B,C,andD.Becauseofthis,extensioncan alsobedefinedbasedonletters.Sobasicallyanextensioncanbedefinedusingbothlettersand numbers.KeepinnotethattherearemanyVoIPphonesthatcancallextensionnumbersconsistingof textSembang,like"Office".ThereforeitisnotaproblemtodefinesuchanextensionnameinAsterisk. Areextensionnamescasesensitive?Yesandno.ExtensioncasearesensitivebecausewhenAsterisk attemptstomatchtheextensiondialedbyausertoextensionthatisdefinedincontext,theextension nameshouldbepreciselymatched,includinguppercaselettersandsmall.Therefore,ifausercalls extension"OFFICE"throughtheirVoIPphone,Asteriskwillnotimmediatelyrunthecommandswe defineforextension"Office".Butinreality,extensionnamesarenotcasesensitiveinthesensethatwe cannotdefinedifferentextensionsbasedonlyonuppercase/lowercaseletters.Itmeanswedonotdefine thecommandforextension"Office"and"OFFICE"inacontext.

PredefinedExtensionNames
Asteriskdefinesanumberofextensionnamesforspecificneeds.Theseextensionsare: i s :Invalid :Start VoIPCookbook:203

h t T o

:Hangup :Timeout :AbsoluteTimeout :Operator

andmanymore.

DefiningExtension
UnliketheextensionsintraditionalPABX,wheretheextensionisusuallyassociatedwithaphone, interfaceormenuin,theextensioninAsteriskisdefinedasasetofcommandstorun.Thesecommands areusuallyexecutedaccordingtotheirlevelofpriority.Somecommands,suchasDialorGotoIf,have theabilitytofollowothercommandsdependingonacertaincircumstance. Atthetimewhentheextensionisdialed,thecommandmarkedas1willbeexecuted,followedby commandnumber2andsoon,untilthephoneishungup. Inthesyntaxusedinextensions.conffile,astepinagivenextensioniswrittenusingthefollowing format: exten=extension,priority,Command(parameter) Thesignequalto=canalsobewrittenusing=>,justliketheformoftenusedinmanyexamples. Inconclusion,a"context"hasaname,suchas"john".Ineveryofthem,wecandefineoneormore "extension".Inanextension,wecandefineasetofcommands.Howdowedefinetheseextensionsand thecommandsrequiredtohandlethem?Todefineboth,weneedtoeditextensions.conffileusingatext editor.Thereareseveraltoolsthatallowustoeditthemusinggraphic/web. Thecomponentsthatbuildthestagesofextensioncommandorthecommandlineareasfollows: Extensionisthelabelofanextension,whichcanbeastring(containingallowednumbers, lettersandsymbols).Extensionisapatternthatmustbeevaluateddynamicallyirordertomatch manypossiblephonenumbers.Everycommandlinethatbecomespartofaparticularextension shouldhavethesamelabel. Priorityusuallyisofintegernumber.Itisthesequenceofacommandthatmustberunwithina givenextension.Thefirstcommandthatwillberunmustbeginwithpriority1.Ifthereisno VoIPCookbook:204

suchthingaspriority1,thenAsteriskwillnotexecutetheextensioncommand.Afterrunning priority1,Asteriskwillthenaddanotherprioritytothepriority2andsoon,ofcourse,provided thatthereisnocommandthatdetermineswhichsubsequentprioritywhichmustberun.Ifthe nextcommandturnsouttobeundefined,Asteriskwillstoptheprocessrunningthecommand, notwithstandingtherearestillcommandswithhigherpriority. Commandisthe"application"toberunbyAsterisk. Parametersaretheparametersthatmustgiventoacommand.Notallcommandrequires parameter,assomeofthemcanbeexecutedwithoutparameters.

Forexample: exten=>123,1,Answer exten=>123,2,Playback(ttweasels) exten=>123,3,Voicemail(44) exten=>123,4,Hangup Withthesedefinitions,anextensionisnumbered"123".Whenacallisdialedtothisextension,Asterisk willrespondtothecall,executingasoundfilewiththenamettweaselsandgivethecallerthechance toentervoicemailintomailbox33,andwillbeendedupwithahangup. Asteriskitselfdoesnotreallycareabouttheorderoflineplacementinextensions.conf.Sowithrandom placementoflines,thecommandwewanttoexecutewillstillbecarriedoutaccordingtotheorderwe want. exten=>123,4,Hangup exten=>123,1,Answer exten=>123,3,Voicemail(44) exten=>123,2,Playback(ttweasels) AnotherwayindefiningthecommandistouseCallerIDtomatchthecaller. exten=>123/100,1,Answer() exten=>123/100,2,Playback(ttweasels) exten=>123/100,3,Voicemail(123) exten=>123/100,4,Hangup() Withsuchcommand,compabilitywithextension123willbepossibleonlywhentheCallerIDofthe VoIPCookbook:205

calleris100.Thiscanalsobedonethroughpatternmatchingprocess,suchasthefollowing: exten=>1234/_256NXXXXXX,1,Answer() andsoon Thisway,thecompabilitywithextension1234willonlypossibleiftheCallerIDbeginswithjustthe codeareanumber256. Wecanevendothefollowing: exten=>s,1,Answer exten=>s/9184238080,2,Set(CALLERID(name)=EVILBASTARD) exten=>s,2,Set(CALLERID(name)=GoodPerson) exten=>s,3,Dial(SIP/goodperson)

Inthesecondpriority,itisshownthatwecanmarkanypersonwedislike,whileanypersonotherthan theonewedislike,afterthirdpriority,willreturntothepathspecified.

AninterestingExtensionExamples
Asteriskisabletotransfercalls.Thiscanbedonebyaddingtheparametert(lowercaps)totheuser context,suchasinthefollowingsyntax: exten=>250,1,Dial(SIP/alrac,10,rt) Thisway,thecalltransfercanbedonebypressing"#",followedbytheextensionnumber.Asteriskwill say"transfer"whenyoupress"#"andsoundsadialtoneuntilweentertheextensionnumbertowhich wewishtocall. Asteriskhastwentyparkingspaces,number701720.Transferthecallthatyouwanttoparkat extension#700andAsteriskwillautomaticallyparkitatanyemptylotandprovideyouwithextension ofwhereitisparked.Toretrievethecall,youonlyhavetodialtheextensionnumber.temparextension mendialenoughparking. Thestepsnecessaryforparkingcallsareasthefollowing: Addinclude=>parkedcallstothedefaultcontext,ortheonethatyouwishtohaveparkcall facility. VoIPCookbook:206

Youshouldhavethefile/etc/asterisk/features.confwhichwascreatedduringinstallation.Make surethatyouhavethefollowingsyntax: [general] parkext=>700 parkpos=>701720 context=>parkedcalls parkingtime=>180

YouneedtorestartyourAsteriskserverthroughtheconsole,asreloadingisnotsufficient.Youcan attemptitintheinternalextension.Soifthereisanincomingcall,thecallcanbeparkedbypressing #700,andAsteriskwillsaytheextensionnumberofwherethecallisparked.Thecallerwillheara beautifulmusicplayedthroughMusicOnHold.Whentheparkingtimeisup,thenourextension numberfirstdialedwillbedialedagainandwehavetheoptionwhethertoreceivethecallornotto receiveandforwardthecalltovoicemail. Theparameter"t"(lowercase)meansthatonlytherecipientofthecallcantransfercalls.Thismeanswe canonlyparkacalljustonce.Butifweaddtheparameter"T"(capitalized),suchas: exten=>250,1,Dial(SIP/alrac,10,rT) thenwecantransferthecalls,whetherassomeonewhoreceivethecallsorasthecaller.Allthisalso meansthatwecanunparkacall,parkthecallandtransferthecall. Asteriskcanbeconfiguredforhuntingtelephonenumbers.Ahuntgroupisalistofphonenumbers whichwillberangconsecutivelyuntilwepickupthephone.Theexampleshowstwophoneextensions andamobilephonenumber.Thecallersimplycallextension100andAsteriskwilldotherestofthe tasks.Eachphonewillringfor20seconds,andwhennobodypickitup,Asteriskwilldialthenext phone. [alracfollowme] exten=>100,1,Dial(SIP/350,20,r) exten=>100,2,Dial(SIP/351,20,r) exten=>100,3,Dial(Zap/1/1231234567,20,r) exten=>100,4,VoiceMail(u350) exten=>100,dial+101,VoiceMail(b350) Othervariationofthehuntingtechniqueaboveisthatallnumberscouldringatthesametime.Thisis knownasgroupring.Youcanringallthephonesinadepartmentifyouwishthemtodoso.The VoIPCookbook:207

sampleconfigurationis: [customerservice] exten=>666.1,Dial(SIP/605&SIP/604&SIP/606,40,tr) exten=>666.2,Voicemail(s699) Intheexample,extension604,605,and606willberangsimultaneouslywhensomeoneplaceacallto extension666fromtheCustomerServiceDepartment.Ifthereisnoonetoanswerthecallwithin40 seconds,thecallwillbeforwardedtoVoicemail.

Variable and Equation


InAsteriskthereissupportavailableforusingvariablewiththename${VARIABLENAME}.Wecan alsowriteanequationusingtheconstruction${EXPRESSION},wheretheexpression(equation)can bearegularexpression,comparison,addition,subtractionandmanymore.

Reloading
Afterwemadesomechangestothedialplanandotherthings,wehavetoapplythesechangeswe appliedtoasteriskbydoingthefollowingCLIasteriskcommand: CLI>reload Alargeconfigurationfilesizeormanysmallerfilesize? Throughthecommand#include<filename>inextensions.conf,otherfilescanbeincluded.Thisway, wecanconfigureextensions.conftobethemainfile,users.confthatcontainslocaluser,services.conf thatcontainsvariousserviceslikeconferencing.Bydoingso,itiseasiertomaintainthedialplanwe create.

Forwarding to another Asterisk


ToforwardcallstootherAsteriskserver,wecanusethefollowingsyntax: [iaxprovider] switch=>IAX2/user:[key]@server/context

VoIPCookbook:208

Theabovecommandwillcarryoutforwardingtootherserver.However,Userandkeyhavetobe definediniax.conffileoftheservertowhichthecallswillbeforwarded.Thecontextforthisserveris thesameasthatofextensions.confoftheserverthatdoestheforwarding.

VoIPCookbook:209

CHAPTER 15: VoIP IP PBX Hardware


Ifyourequireaphonesolutionforasmallofficewith616extensionlines,youwouldnormallyusea PBX(PrivateBranchExchange)machinetoperformswitchingbetweentheseextensionlinesandto manageoutboundconnectivity.Butastherearegreaterneedstoextendthenumberofextensions(say hundreds),youwillfindswitchingusingthisconventionalPBXrathercomplicated,withcablessnaking aroundyourpremise.InVoIP,thisisnolongeraproblem,asVoIPPBXisbasedonInternetProtocol,a fromfactormakingIPPBXamuchmorecompactsolutionwithfewerportcablestoconnect.

Linksys SPA9000

Figure 15.1: IP PBX Hardware Physical Dimension is small

AnexampleofIPPBXbeingusedasanexampleisLinksysSPA9000,adeviceconsistingonlytwo LAN(RJ45)portsandtwotelephone(RJ11)ports.SPA9000isactuallyarouterorproxyserver,with portconnectivitytoWANandLAN.TheRJ45enablingconnectivitytoWANislabeledInternet, whiletheRJ45connectiontoLANislabeledEthernet.ThedefaultIPaddressfortheLAN VoIPCookbook:210

connectivityis192.168.1.1.Meanwhile,thetwoRJ11telephoneportsarepartofPBXportthatcanbe connectedtotwoconventionalphones,includingfaxmachine.Despitethissimplicity,SPA9000isa PBXthatiscapableofbeingconnectedtouptofourPSTNlinesortoalargeVoIPinfrastructure. Internally,SPA9000couldaccommodate16extensionlines.Whencomparedtoasmallconventional PBX,SPA9000hasonlyfourportscomparedtoasmallPBXthatuses20telephonecalbles.Soall connectionswillbeestablishedthroughtheinternetinfrastructure.

LinksysSPA9000Configuration
ThewayLinksysSPA9000operatesissomewhatsimilartootherLinksysVoIPequipments.To configureLinksysSPA9000,weneedtohave: 1. informationonIPaddressforbothWANandLANports. 2. SIPaccountofaproviderintheinternettoallowSPA9000toregisteritselftofourdifferentSIP accounts. 3. NumberallocationforextensionlinesofthePBXtoSPA9000toprovideaddressupto16 telephonenumbersautomatically. Numbersallocatedforeachextensionarespecific,distinguishinganIPPBXfromotherVoIP appliances.Normally,atypicalVoIPequipmentdoesnotprovidetelephonenumberallocation.Soif youwanttoconnectyourconventionalphonetoLinksysSPA9000throughtheinternetorWANport, thefirstthingyouhavetodoisfindtheinternet/WANIPaddressofLinksysSPA9000solateryouwill beabletoconfigureusingtheweb,bydoingthefollowingsteps:

Press*ontheconventionaltelephonekeypadrepeatedlyuntilyouhearamantalkingthrough yourtelephone. Press110#andlistencarefullytotheSPA9000'sIPaddressgivenbytheman.Writeitdown soyoudonthavetomemorizeit.

AnothereasierwaytoobtaintheIPaddressistogointotheEthernet/LANport.TheIPaddressof SPA9000ethernetLANshouldbe192.168.1.1bydefault,thatis,providedyouhavenotchangedthe settings. ThenextstepistoconfigureyourPCIPaddresssoitwillmatchthatofLinksysSPA9000soyouwill beabletodotheconfigurationthroughtheweb.GotoPCandmatchthePC'sfamilyaddresstothatof SPA9000.GotoStartmenu,controlpanel,networkconnections,localareaconnection,internet protocol(TCP/IP),andproperties.

VoIPCookbook:211

NowyouwillbeabletologintoLinksysSPA9000'swebinterfacefromyourPCviahttp://ipaddress spa9000/. ThefirstmenuyouwillfindisthestatusoftheLinksysSPA9000.

Figure 15.2: Linksys SPA9000 Administration Panel

VoIPCookbook:212

Figure 15.3: The WAN Setup Tab of Linksys SPA9000

IntheWANsetup,wegettwooptions:

UsingastaticIP(requiringIPaddress,Netmask,gatewayetc.) UsingautomaticIP(connectiontypeshouldbesettoDHCP).

Ingeneral,theIPaddressallocationmethodusedinaWANnormallyisdynamic.However,fora softswitch,itisrecommendedthatyousettheIPaddressallocationtostaticinordertomakeiteasier fornonLinksysSIPclienttoregisteritselftothesoftswitch.

VoIPCookbook:213

Figure 15.4: The LAN Setup Tab of Linksys SPA9000 Administration Panel

IntheLANSetuptab,wecanconfigurethefollowing: whetherNAT/RouterinLinksysSPA9000shouldbeactivatedornot. IPaddress.Put102.168.1.1 Netmask.Put255.255.255.0 DHCPServerforclientinLAN WecanalsoconfiguretheIPaddresstobeallocatedtoaspecificMACaddress.

ConfiguringVoIPonLinksysSPA9000
Basically,thereareseveraltypesoftelephoneconnectioninavailableinLinksysSPA9000:

VoIPCookbook:214

TwoFXSorconnectionstothetelephone.Thisconnectionbasicallyneedsnottobeconfigured andbydefault,itsnumberis100and101. FourSIPconnectionstohighercentrallevel,toanySIPserver Thereare14nonFXSextensionsinformallocationforIPPhone.Thenumberallocatedranges from102to116.Still,configurationisnotneededand,anyIPPhoneattemptingtoconnectto LinksysSPA9000candosowithablankpassword.

Figure 15.5: FXS 1 Tab under Voice Tab of Linksys SPA9000 Administration Panel

Onthevoicemenuandadminmenu,wecanseetheconfigurationforFX1andFX2,orLine14.On theFXS1menu,weneedtosetLineEnabletoYes,sotheFX1willbeabletoreceivecallsdialedtoit. MakesurethatthereisaphonelineorfaxmachineconnectedtoFXS1orotherwiseanyincomingcalls willnotbereceived.ApplythesameconfigurationtoFXS2.Overall,theconfigurationallowsusto connecttwoconventionalphones,includingfaxmachine,toLinksysSPA9000. VoIPCookbook:215

Figure 15.6: Line 1 Tab of Administration Panel

OnthemenuofLine1toLine4,wecanconfiguretowhichSIPservereachoftheselineswillbe registeredto.MakesureLineEnableissettoYes.

VoIPCookbook:216

Figure 15.7: Line 1 Tab of Administration Panel

OnLinksysSPA9000wecouldsetfourSIPaccountstoberegisteredtoanySIPProxy,eachaccount connectedonlytoaline.Someimportantthingstodothisareasthefollowing:

setLineEnabletoyes Filltheinformationpertainingtoyouraccountinthefollowingparameters: Proxy UserID Password UseAuthID voiprakyat.or.id thenumbergivenbyvoiprakyat passwordofvoiprakyataccount no

IfyousetUseAuthIDtoye,thenfillthatparameterwiththenumberofyourVoIPRakyataccount. VoIPCookbook:217

DothesametoyourotherSIPaccount(s)fortherestofthelines(Line2,Line3andLine4).

VoIPCookbook:218

CHAPTER 16: Analog Telephone Adapter for connection to PSTN


ItisobviousthatmakingbothVoIPandPSTNtocoexistisdifficult,particularlywhenyouareseeking tominimizeyourtelecommunicationspendingbychoosingeitheroneofthem.Sothissectionwillhelp youunderstandhowtokeepyourPSTNlinebyusingatrunkingequipmenttobeconnectedtoPSTN. Generally,theequipmentsavailableinthemarkethaveoneFXOortwo.Coincidentally,theLinksys SPA400,theequipmentweuseasanexample,hasfourFXOsandisrelativelylessexpensive.The interesthereisthatyouwanttohaveVoIPbeconnectedtoyourconventionalphone,eithertoaPABX ordirectlytoyourPSTNnetwork.Thisusuallydoesnotrequireyoutoobtainalicense,unlessyou intendtobecomeaproviderwithcommercialinterest. Soforyourpurpose,youneedtohaveanAnalogTelephoneAdapter(ATA),whichcanbeconnectedto thecableofyourPSTNcable.InVoIP,thisisoftencalledFXO(usuallylabeledasLine).Thephysical conditionofthisinterfaceissimilartothatofRJ11(conventionaltelephonejack).Thedifferenceis thatininRJ11FXOline,thereisnovoltage,somethingthatistherewhenyouhaveaRJ11Phone. WithFXO,youcanyourVoIPbeconnectedtoPSTNandPABXextensions.AndATAphonecanbe connectedtobotharegularphoneandPABXCO. Inshort,therearetwotypeofRJ11connectionsinATA,namely,

FXOtobeconnectedtoPSTN/Telcoline/PABXextension. FXStobeconnectedtoTelephoneline/FAX.

WhenconnectingATAtoPSTNline,makesurethatyoudonotconnectittothewrongplug.Ifyou did,thePSTN'svoltage,whichusuallyisaround48V,wouldcollidewiththatoftheATAphone.This willdamageyourATAequipment.Sopriortoconnectingthem,youhavetosetyourATAequipmentso itrecognizeswhetherthevoltageinplaceis48Vor24V.

VoIPCookbook:219

Linksys SPA3000 Analog Telephone Adapter

Figure 16.1: ATA Linksys SPA3000 has two RJ-15 sockets on one of its sides

OneofthesmallestATAwetheauthorhaveeverseenisLinksysSPA3000.Fromthepictureabove, youcanseetwotelephonejacks,eachlabeledPhoneandLine.Connectthephonesockettoyour conventionalphonewhiletheLinesockettothePSTNcable.

Figure 16.2: ATA Linksys SPA3000 has a RJ-45 socket, power socket and LED indicator on the other side

OnthebackofLinksysSPA9000,thereisRJ45plugthatcanbeconnectedtoLANcableforcomputer andtheInternet.

VoIPCookbook:220

ConfigureLinksysSPA3000

Figure 16.3: Linksys SPA3000 Administration Panel

SPA3000logicalconfigurationisnotmuchdifferentfromotherVoIPequipment.Ingeneral,weneedto configure:IPaddress,Netmask,Gateway,DNS,thetelephonenumber,passwordandSIPserver.The initialappearanceofSPA3000issomewhatsimilartothatofotherLinksysproducts.Sothisisaplus forthosewhoarealreadyfamiliarwithLinksysproduct.

VoIPCookbook:221

Figure 16.4: The System tab of Linksys SPA3000 Administration Panel

OntheSystemmenuyoucansettheIPaddress,Netmask,gateway,andDNSoftheLinksysSPA3000. IfyouhaveaDHCPserver,youcanenableDHCPsoATAwillgetitsIPaddressautomaticallyfrom theserver.

VoIPCookbook:222

Figure 16.5: Line 1 tab of Linksys SPA3000 Administration Panel

RegistrationtotheSIPserverforthetelephoneiscarriedoutthroughLine1menu.Weneedtoenter someinformation: LineEnableyes ProxytheSIPServer. DisplayNamethephonenumberintheSIPserver. UserIDthephonenumberintheSIPserver. AuthIDthephonenumberintheSIPserver. PasswordthepasswordtoregistertotheSIPserver. Onceyoucompletedallthese,theconfigurationforregistrationtoSIPserverfortelephoneconnected tophone/FXSinterfaceiscompleted.

VoIPCookbook:223

Figure 16.6: PSTN Line tab of Linksys SPA3000 Administration Panel

ForconnectivitytoPSTN,theconfigurationforPSTNLineregistrationissimilartoLineconfiguration, usingthefollowingconfiguration: LineEnableyes ProxyIPaddress/hostnameofSIPServer. DisplayNamethephonenumberintheSIPserver. UserIDaphonenumberintheSIPserver. AuthIDaphonenumberintheSIPserver. PasswordpasswordtoregistertotheSIPserver. Oncethesearecompleted,soistheconfigurationforregisteringthePSTNLinetoSIPserverfor telephonecableconnectedtoFXOinterface.

VoIPCookbook:224

LinksysSPA3000ATAStatus

Figure 16.7: PSTN Line tab of Linksys SPA3000 Administration Panel

AtthebeginningoftheSPA3000configurationmenuisthestatusandinformationmenu.Slightly below,thereisastatusofSPA3000PSTNline.Despitethemanyparametersavailableinthisstatus, youhavetobeconcernedwithjusttwoofthem:registrationstateandLineVoltage.Fortheformer, makesurethattheparameterregistrationstatesaysregistered.ThisimpliesthatSPA3000isproperly registeredtoaSIPproxy.Forthelatter,checkthevoltagelevelattheconnectiontoPSTN/PABX.PSTN andanumberofPABXusuallyhavetheirvoltagelevelat48Vand24Vrespectively.Whilethe voltagelevelofthePSTNisfine,PABX'svoltagelevelwillbeproblematicforSPA3000,asitsdefault voltagethresholdisconfiguredonlytohaveSPA3000connectedtoPSTNorPABXwhentheirvoltage levelisabove30V.WhenyoudomakeacallusingthelineconnectedtotheunrecognizedPABX(or PSTN),SPA3000willgiveabusytone.TohaveSPA3000recognizeaPABXwhosevoltagelevelis below30V,wehavetochangetheparameteravailableinthePSTNLinemenu,whichyoucould accesswhenyou'reloggedinasadmin. VoIPCookbook:225

Figure 16.8: PSTN Line tab of Linksys SPA3000 Administration Panel

IntheInternationalcontrolunderthebottom,thereisparameter"LineinUse"Voltageisitsdefault valueis30.IfthePSTNLinevoltageof24VthePABXonlysetparameter"LineinUse"Voltageof 30VwillcausetheSPA3000thinkthattheSPA3000isnotconnectedtothePSTN/PABX.Thuswe needtothechangethevaluetobesmallerthan24V,suchas23or20V.Thisway,SPA3000will recognizethatitisconnectedtoaPSTN/PABXnetworkeventhoughthevoltagelineisonly24V.

VoIPCookbook:226

LevelOne VOI-2100 Analog Telephone Adapter

Figure 16.9: LevelOne VOI-2100

LevelOneVOI2100isanothertypeofATAwhichcanbeusedinSIPbasedVoIPnetwork.Similarto SPA3000,VOI2100hastwoRJ11s,onefortheconnectiontothetelephone,whileanothertoconnect toPSTNorPABXcable.IncontrasttoSPA3000,VOI2100hasanembeddedrouter,NATandDHCP serverinsideit.TherearetwoUTPRJ45plugs,onecanbeconnectedtoWANwhileanothertoLAN.

VoIPCookbook:227

Figure 16.10: LevelOne VoIP Administration Panel

AtthebeginningoftheLevelOneVOI2100menuisthestatusoftheVOI2100,suchasMACAddress, SystemUptime,etc..VariousconfigurationsofVOI2100isavailableontheleft.

VoIPCookbook:228

Figure 16.11: The WAN Status tab of LevelOne VoIP Administration Panel

OntheWANmenu,clicktheWANstatus.WecanseetheconditionofWANLevelOneVOI2100, somestandardinformationfromtheWANconnection,suchasIPaddress,SubnetMask,gateway,and DNSserver.AnumberoftagsthatispossiblytobeconfiguredtoimproveVoIPperformanceare VLANTagandPriorityTag,bothofwhichcanbefoundalsoinWANstatus.

VoIPCookbook:229

Figure 16.12: The WAN Settings tab of LevelOne VoIP Administration Panel

InWANSettings.Wecanconfigureseveralparameters,suchas, IPaddressoftheWANConnectionasstaticordynamic. Trafficlimitation.

VoIPCookbook:230

Figure 16.13: The PPPoE tab of LevelOne VoIP Administration Panel

InWANmenu,clickPPPoE.Coincidentally,thereisafeaturetoauthenticateADSLthatusesPPPoE. Thus,ifyoulikepleasefeelfreetoentertheusernameandpasswordofPPPoE.

VoIPCookbook:231

Figure 16.14: MAC Spooling tab of LevelOne VoIP Administration Panel

IntheWANmenu,clickMACspoofing.ThisallowsustochangetheMACaddressoftheEthernet WANwewanttouse.ThisisoftennecessarytodowhentheADSLprovidertowhomwesubscribeour servicesetsonlyacertainMACaddresscapableofconnectingtotheprovider.ThroughthisMAC Spoofingmenu,wecanchangetheMACaddressoftheEthernetWANinordertousetheMAC addressapprovedbytheprovider.

VoIPCookbook:232

Figure 16.15: LAN Settings tab of LevelOne VoIP Administration Panel

OnthemenuLAN,clickLANSettings.HerewecansettheIPaddressandSubnetMaskofthe EthernetLANthatweuse.

VoIPCookbook:233

Figure 16.16: DHCP tab of LevelOne VoIP Administration Panel

OntheLANmenu,clickonDHCP.WecanactivateordeactivateDHCPserver.Wecanalsoconfigure therangeofclientIPaddressesthatcanbeallocatedtothenetwork.Notethatinagivennetworkitis possibletohaveanumberofDHCPservers.ItisimportanttoensureaDHCPserver'sIPaddresses allocatedarenotcontradictorytothoseofdifferentDHCPservers.OtherinformationsuchasDomain andDNSServercanalsobeconfiguredunderDHCPtab.

VoIPCookbook:234

Figure 16.17: Routing tab of LevelOne VoIP Administration Panel

OntheLANmenu,clickRouting.Wecanaddstaticroutingtoothernetworksifnecessary.The informationneededforthisisjustIPaddressdestination,SubnetMask,andGatewayrouterthat connectstothenetwork.

VoIPCookbook:235

Figure 16.18: Port Forwarding tab of LevelOne VoIP Administration Panel

OnLANmenu,clickPortForwarding.Thisfeatureallowustodoaforwardingfromaport.For example,ifwehaveMail/SMTPServerbehindNAT,thenthroughthisportforwarding,alltraffic headingtoport25(SMTPserver)fromoutside/WANcanbeforwardedbyNATtoserverbehindNAT. Informationyouneedtoenterisportrangeandtheserver'sIPaddressbehindtheproxy.Forexample,if wewanttoincludejustport25,theportrangeshouldbejust25to25.

VoIPCookbook:236

Figure 16.19: The SIP tab of LevelOne VoIP Administration Panel

ThemostimportantpartofVOI2100istheSIPconfiguration.OntheSIPmenu,clickSIPtab.This tabsallowsyoutochangekeyparametersenablingVOI2100toenterSIPnetwork.Someoftheseare:

ServeraddressIPaddress/hostnameoftheSIPproxyserver Porttheportnumber.Thevalueoftenusedis5060. OutboundProxyIPIPaddress/hostnameofoutboundproxyisusuallysimilartothatofSIP Proxyserver. OutboundProxyPortwhichisusuallysimilartoSIPPort,thatis,5060.

VoIPCookbook:237

Figure 16.20: The SIP tab of LevelOne VoIP Administration Panel

AdditionalinformationpertainingtoSIPaccountinaSIPProxyserverneedstobeincludedalsoonSIP menu,atheverybottomofthemenu.Theseinformationinclude: PhonenumberusernameintheSIPProxyServer Phonenumber,whichistheusernameofaSIPProxyServer CallerID,thecallerIDwewanttouse Password,theonetobeusedtoregistertoSIPProxyserver TherearetwoSIPaccountsthatcanberegisteredwithSIPProxyServer:Line1canbeconnectedto thetelephonelinewhileline2toPSTNlinewhichplugisavailableinLevelOneVOI2100.UnderSIP menu,thereareothersubmenussuchasSIPExtension,OutofBand(OOB)Signaling,ToSetc. However,youdon'thavetochangetheseparameters,asVOI2100canstilloperatewithouttheneedto changetheseparameters.

VoIPCookbook:238

Figure 16.21: The CODECS tab of LevelOne VoIP Administration Panel

Nowclickoncodecs.Thisoptionallowsyoutodeterminewhichvoicecompressionmethodorcodec thatcanbeactivated.Usually,itisbettertoactivateallofthemsoyouwillhaveflexibilityin communicatingwithavarietyofsoftphonesorIPphones,justincaseacodecdoesnotworkproperly andyouhavetoswitchtodifferentone.

VoIPCookbook:239

Figure 16.22: The Security tab of LevelOne VoIP Administration Panel

NowclickonSystem,thentosecurity.Underthistab,wecanchangethewebadministratorpassword neededtoaccessLevelOneVOI2100webmenu.

VoIPCookbook:240

Figure 16.23: The AutoUpdate tab of LevelOne VoIP Administration Panel

NowclicktheAutoUpdatetab,nexttoSecurity.Thesubmenuunderthistaballowsyoutoupdate firmwareofLevelOneVOI2100automaticallythroughtheInternet.

VoIPCookbook:241

Figure 16.24: The Localization tab of LevelOne VoIP Administration Panel

NowclickLocalization.Setthetimetosynchronizeourtimetotheserver'sintheinternetandalsoset ourlocationtothetimezoneforourlocation.

VoIPCookbook:242

Figure 16.25: The Gain Control tab of LevelOne VoIP Administration Panel

NowclickGainControl.Thistaballowsustoadjustthevolumeofbothaudiooutputandaudioinput. Thisismeasuredindecibels.Todecreasethevolume,weneedtoenternegativeaudiogainvalues,such as2dBandsoon.Toincreasethevolume,putsomepositiveintegers.

VoIPCookbook:243

Figure 16.26: The Caller ID tab of LevelOne VoIP Administration Panel

NowclickCallerID.ChoosethesortofcallerIDyouwanttouse.

VoIPCookbook:244

Figure 16.27: Service Access tab of LevelOne VoIP Administration Panel

ClickServiceAccess,thelasttabunderSystemsubmenu.ServiceAccessallowsustodeterminewhich interfacewillbeaccessiblethrooughLevelOneVOI2100administration.Thedefaultconfiguration allowswebadministrationaccessthroughLANandWAN.

VoIPCookbook:245

Linksys SPA400 with four FXOs


IfyouneedmanyconnectionstoPSTN,oneofpossibleattractivealternativestobeusedisSPA400 whichhasfourFXOswhichcanbeconnecteddirectlytoPSTN.Inaddition,SPA400alsohasaUSB storagetostorevoicemail.

Figure 16.28: Linksys SPA400 with Four FXOs

UsingtheSPA400withAsterisk
StepsthatneedtobecarriedouttolinkSPA400toAsteriskareasfollows: ConfiguringtheSPA400IPaddress ConfiguringSPA400IPaddress ConfiguringAsteriskaccountinSPA400 Configuringsip.confinAsterisktohaveitregisteredtoSPA400 Conguringextensions.confinAsterisksoitdialoutusingSPA400 Makingalltheseconfigurationsisnotdifficultandcanbedonethroughtheweb.Thedefaultusername isAdmin(Casesensitive)withoutapassword. VoIPCookbook:246

Figure 16.29: The Setup tab of SPA400 VoIP Administration Panel

ToconfiguretheIPaddressofSPA400,clickSetupandunderthistab,clickBasicSetup.Donotuse DynamicIPAddress,sinceAsteriskneedstoseekSPA400andregisteritselftoSPA400.Instead, chooseFixedIPAddress.Ifnecessary,wecanalsosettheDNSandNTPserverweoftenuse.Obtain theinformationonDNSserverfromyourinternetserviceprovider.ForNTPserver,typein time.nist.govorpool.ntp.org.Afterallconfigurationiscompleted,clickSaveSettings.

VoIPCookbook:247

Figure 16.30: The Setup tab of SPA400 VoIP Administration Panel

Next,configuretheaccountsoeitherAsteriskorSPA9000willbeabletologintoSPA400.Thewayto dothisistogointotheSetupmenuandclickSPA9000Interface.ChangetheuserIDtotheusername weusetologin.Hereweuse9000asanexample.ThenchooseDiscoverAutomatically.Provided thissettingworksproperly,youmaywanttochangethissettinginordertohaveamoresecure connectivity,bysettingthevaluesofAsteriskservertomatchthoseofSPA400server.Onceeverything iscompleted,clickSaveSettingstosavetheconfiguration.

ConfigureAsterisktotalktoLinksysSPA400
OnAsterisk/etc/asterisk/sip.conf,youneedtoconfiguretheaccountexactlysimilartoUserIDof SPA400 Theentriesinsip.conftoenableAsteriskregistertoSPA400areasfollow: [general] register=>9000@192.168.0.6/9000 VoIPCookbook:248

Replace9000withthevalueyouenteredintheUserIDofSPA400,andreplace192.168.0.2withtheIP addressoftheSPA400. CreateaSIPentryforSPA400,withthefollowinginformation: 901user:UserIDofSPA400 902host:IPaddressofSPA400 903context:thecontextthatwillbeusedtohandleinboundcallsfromSPA400 SIPentrytoreceivecallsfromSPA400areasthefollowing: [9000] type=friend user=9000 host=192.168.0.6 dtmfmode=rfc2833 canreinvite=no context=fromtrunk insecure=very ToseewhetheryouareregisteredtoAsteriskornot,youcancarryoutthefollowingcommand: localhost*CLI>sipshowregistry HostUsernameRefreshState 192.168.0.6:50609000105Registered InExtension.conffilewecanconfiguretheroutingfordialoutusingSPA400.Anexampleofageneric configurationfordialoutroutebypressing9andenterSPA400FXOtrunkisasfollows: [general] Trunk=SIP/9000 TRUNKMSD=1 [trunkint] ; ;Internationallongdistancethroughtrunk ; exten=>_9011.,1,Macro(dundie164,${EXTEN:4}) VoIPCookbook:249

exten=>_9011.,n,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [trunkld] ; ;Longdistancecontextaccessedthroughtrunk ; exten=>_91NXXNXXXXXX,1,Macro(dundie164,${EXTEN:1}) exten=>_91NXXNXXXXXX,n,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [trunklocal] ; ;Localsevendigitdialingaccessedthroughtrunkinterface ; exten=>_9NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) [trunktollfree] ; ;Longdistancecontextaccessedthroughtrunkinterface ; exten=>_91800NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) exten=>_91888NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) exten=>_91877NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) exten=>_91866NXXXXXX,1,Dial(${TRUNK}/${EXTEN:${TRUNKMSD}}) NotethattheSPA400'saccountnumberinAsteriskis9000,thenumberweareusingasanexample. Incomingcallroutingismorecomplex.Ifweassumetheincomingcallwillbeconnectedtoextension 200,thentheconfigurationisapproximatelyasfollows: [fromtrunk] include=>frompstn ... [frompstn] include=>frompstncustom ... [frompstncustom] exten=>9000,1,Goto(extlocal,200,1) VoIPCookbook:250

ConnectPSTNusingLinksysSPA9000andLinksysSPA400
ConnectingPBXsoftswitchlikeLinksysSPA9000tothePSTNcanbecarriedoutinseveralways.One ofthemistousetheLinksysSPA400asmediatortoPSTN.WhatyouhavetodoistomakeSPA400's IPaddresstobefixed,enableUserIDtoregisteritselftoSPA400,enableSPA9000toregisteritselfto SPA400,andenableSPA9000touseSPA400'strunkforPSTNcalls.SPA400configurationcanbe donethroughtheweb,usingthegivendefaultusernamewithoutapassword.

Figure 16.31: The Setup tab of SPA400

ThroughtheSetupmenu,clickBasicSetup.HerewehaveconfigurefixedIPaddress,IPsubnetmask, andgatewayIPaddress,informationonDomainNameServer(DNS)AddressandNTP.Forour example,weuse202.134.2.5,202.46.3.178,andtime.nist.govforPrimaryDNS,SecondaryDNSand NTPServer,respectively.

VoIPCookbook:251

Figure 16.32: The Setup tab of SPA400

ThroughtheSetupmenu,clickSPA9000Interface.Theconfigurationyouhavetodoisasthe following: CreateanaccountonSPA400suchthatSPA9000softswitchcanregister.


CreateanaccountinSPA400soasoftswitchlikeSPA9000canberegistered. ConfigureSPA400soitwillknowtheIPaddressandportofthesoftswitch/SPA9000.Itis recommendedthatyouchooseDiscoverAutomatically

VoIPCookbook:252

Figure 16.33: Voice Menu in SPA400

OntheSetupmenu,clickVoice.Herewecanconfigurethesortofcodecwewanttouseandother settingparameterssuchasWaitforAnswertime.

VoIPCookbook:253

Figure 16.34: Menu Line Settings in Linksys SPA400

OntheSetupmenu,clickVoice.IntheLineSettingstab,youcanconfigurethetransmitgain,receive gain,impedance,ringvoltage,onhookspeed,etc..Basically,wedonotneedtochangethesevaluesof theseparameters,andsimplyusethedefaultvalues.

VoIPCookbook:254

Figure 16.35: Voicemail Menu in SPA400

ThroughtheSetupmenu,clicktheVoicemailServertab.Herewecansetsomeimportantparametersof theVoicemailserver,suchas:

ServerPortdefault5090 SPA9000UserIDuserIDfortheSIPProxytoregistertoLinksysSPA400 SPA9000subscriberIDsubscriberIDfortheSIPProxytoobtainVoicemail MailboxDepositNumberthenumberneededtoputvoicemail.Thedefaultvalueis900. MailboxmanagenumberthenumberusedtomanageVoicemail.Thedefaultvalueis800.

VoIPCookbook:255

Figure 16.36: Voicemail User Menu in SPA400

OneofmanygreatthingsaboutSPA400isitscapabilitytostoreVoicemaildatainUSBstorage. ThroughtheSetupmenuandVoicemailUsers,weconfiguretheuserandpasswordofourVoicemail. Byclickingontheenableboxofanyuser,wecannowactivatethatuseraccount.

VoIPCookbook:256

Figure 16.37: The Administration tab of Linksys SPA400

GotoAdministration,thenclickManagement.Herewecanconfigureourusernameandpasswordfrom GatewayAdministrator.ThedefaultusernameisAdmin,withoutapassword.

VoIPCookbook:257

Figure 16.38: The Status tab of Linksys SPA400

Throughthestatusmenu,youwillfindmoreinformationonSPA400operation,suchas,time,IP address,subnet,gateway,DNS,USBdisketc.ThemostimportantparameteristheSIPRegistration Status.ItindicatestheconditionoftheSIPProxyweuse:whetherSPA9000orAsteriskissuccessfully registeredwithSPA400ornot.IftheSIPProxyissuccessfullyregisteredwithSPA400,youcanuse SPA400asanAnalogTelephonyAdaptertocalltoTelkom.

VoIPCookbook:258

Figure 16.39: The Status tab of SPA400

Whileyouarestillinstatuspane,noticethatthereisalsothestatusforBatteryLevel.Thisshowsthe voltageavailableatRJ11portofSPA400.IfitisconnectedtoyourPSTNprovider,thenthevoltage normallyisabout45V.IfitisconnectedtoPABX,thevoltageexperiencedbytheRJ11portisaround 24V.Ifallportshavetheirvoltagelevel0V,thenSPA400,whenweattempttoplaceacall,willgeta busysignal.

VoIPCookbook:259

ConfigureLinksysSPA9000totalktoLinksysSPA400

Figure 16.40: The Line 4 tab of SPA400

TohaveSPA9000capableofcommunicatingwithSPA400,youneedtoregistertheuserIDyouhave setinSPA9000toSPA400.Gotoadminmenu,chooseAdvancedandchooseoneofthefourlines. UndertheSubscriberInformation,youneedtosetthefollowingparameters: DisplayNameaccordingtoSPA400. DisplayNameaccordingtoSPA400 UserIDaccordingtoSPA400 Passwordjustleaveitblank UserAuthIDshouldbeNo ProxySPA400IPaddress OutboundProxySPA400IPaddress

VoIPCookbook:260

CHAPTER 17: OpenBTS


OpenBTS(OpenBaseTransceiverStation)isa softwarebasedGSMBTSthatallowsGSMmobile phonetooperatewithoutusingcellullaroperator infrastructure.OpenBTSisknowntobethefirstopen sourceimplementationofindustrialstandardGSM protocolstack. TheheartofOpenBTSisanUniversalSoftware RadioPeripheral(USRP).USRPmaybeobtained fromEttushttp://www.ettus.com/products.TheestimatecostoftheUSRPhardwareneededfor OpenBTSisaroundUS$15002500muchlowerthanthenormalcommercialGSMequipments.

Open GSM Infrastructure


OpenBTSreplacestraditionalGSMinfrastructure,especiallybehindtheBaseTransceiverStation (BTS).Traditionally,trafficwillpassintoMobileSwitchingCenter(MSC).InOpenBTS,traffic terminatedonthesameBoxandforwardthedatatoAsteriskIPPBXthroughSIPandVoiceoverIP (VoIP). ThereferenceAirInterface(Um)usessoftwaredefinedradio(SDR)onUniversalSoftwareRadio Peripheral(USRP)USBboard.

History
TheprojectisstartedbyHarvindSamrahttp://www.linkedin.com/in/harvindsamraandDavidA. Burgesshttp://ecommconf.com/2009/speakers/davidburgess/.Theaimoftheprojectistoreducethe GSMcostinruralanddevelopingcountriestobeunderUS$1/month/subscriber.

Field Test
FieldtestisdoneinNevadaandNorthCalifornia,US.Temporaryradiolicenseforashortperiodis obtainedthroughKestrelSignalProcessing(KSP)usedtobeaconsultingfrimofthedeveloperof OpenBTS. VoIPCookbook:261

Niue
In2010,anOpenBTSispermanentlyinstalledinNieuanditisforthefirsttimeacellularBTS connectedtothelocaltelecommunicationoperator.Niueisasmallcountrywith1700inhabitantamd notsomuchattractingmobileoperator.CoststructureofOpenBTSfitstoNiuewhichunabletoprocure theconventionalGSMBaseStation.

GNURadio
Referencehttp://gnuradio.org/redmine/wiki/gnuradio/UbuntuInstall.Theneededdevelopmenttoolsare:

g++ subversion make autoconf,automake,libtool sdcc guile ccache

Theneededlibraryforruntimeandcompilationprocessesare

pythondev FFTW3.X(fftw3,fftw3dev) cppunit(libcppunitandlibcppunitdev) Boost1.35(orlater) libusbandlibusbdev wxWidgets(wxcommon)andwxPython(pythonwxgtk2.8) pythonnumpy(viapythonnumpyext)(forSVNonorafter2007May28) ALSA(alsabase,libasound2andlibasound2dev) Qt(libqt3mtdevforversionsearlierthan8.04;version4worksfor8.04andlater) SDL(libsdldev) GSLGNUScientificLibrary(libgsl0dev>=1.10requiredforSVNtrunk,notinbinary repositoriesfor7.10andearlier)

VoIPCookbook:262

LibraryInstallation
Update sudoaptgetupdate ForMaverick(Ubuntu10.10)wecanusethefollowingcommand sudoaptgetyinstalllibfontconfig1devlibxrenderdevlibpulsedevswigg++automake\ libtoolpythondevlibfftw3devlibcppunitdevlibboostalldevlibusbdevfort77sdcc\ sdcclibrarieslibsdl1.2devpythonwxgtk2.8subversiongitcoreguile1.8dev\ libqt4devpythonnumpyccachepythonopengllibgsl0devpythoncheetahpythonlxml\ doxygenqt4devtoolslibqwt5qt4devlibqwtplot3dqt4devpyqt4devtools\ libpcre3libpcre3dbglibpcre3devlibpcrecpp0

WxWidgetInstallation
Althoughthisseemstobenotcritical.ThosewhowishtoinstallthelatestWxWidgetcanfollowthe followingcommand. Edit/etc/apt/sources.list #wxWidgets/wxPythonrepositoryatapt.wxwidgets.org debhttp://apt.wxwidgets.org/DISTwxmain debsrchttp://apt.wxwidgets.org/DISTwxmain

Anexampleforgutsy #wxWidgets/wxPythonrepositoryatapt.wxwidgets.org debhttp://apt.wxwidgets.org/gutsywxmain debsrchttp://apt.wxwidgets.org/gutsywxmain

Doupdate sudoaptgetupdate Install VoIPCookbook:263

sudoaptgetinstallpythonwxgtk2.8pythonwxtoolswx2.8i18n sudoaptgetinstallpythonwxgtk2.8pythonwxtoolswx2.8i18nlibwxgtk2.8devlibgtk2.0dev

SWIGInstallation
TomanuallyinstallSWIG,weneedtodownloadthesourcecodefrom http://sourceforge.net/projects/swig/files/swig/ Thendothefollowings cpswig2.0.1.tar.gz/usr/local/src/ cd/usr/local/src/ tarzxvfswig2.0.1.tar.gz cd/usr/local/src/swig2.0.1/ ./configure make makeinstall

QWTInstallation
TomanuallyinstallQWT,weneedtodownloadthesourcecodefrom http://sourceforge.net/projects/qwt/files/ Thendothefollowings cpqwt5.2.1.tar.bz2/usr/local/src/ cd/usr/local/src/ tarjxvfqwt5.2.1.tar.bz2 cd/usr/local/src/qwt5.2.1/ qmake make makeinstall Forthosewhobravemayusethebetaversionsuchas cpqwt6.0.0rc5.tar.bz2/usr/local/src/ cd/usr/local/src/ VoIPCookbook:264

tarjxvfqwt6.0.0rc5.tar.bz2 cd/usr/local/src/qwt6.0.0rc5 qmake make makeinstall

GNURadioInstallation
Downloadthesourcecodefrom http://gnuradio.org/redmine/wiki/gnuradio/Download compilethesourcecode cpgnuradio3.3.0.tar.gz/usr/local/src/ cd/usr/local/src/ tarzxvfgnuradio3.3.0.tar.gz cd/usr/local/src/gnuradio3.3.0/ ./configure make makecheck makeinstall

USRPHandling
Ubuntuusesudevtohandlehotplugdevices,andbydefaultgivenoaccesstononroottoUSRP.The followingscriptwillgiveaccesstousertohandelUSRPviaUSBforeitherliveorhotplug. sudoaddgroupusrp sudousermodGusrpa<YOUR_USERNAME> echo'ACTION=="add",BUS=="usb",SYSFS{idVendor}=="fffe", SYSFS{idProduct}=="0002",GROUP:="usrp",MODE:="0660"'>tmpfile sudochownroot.roottmpfile sudomvtmpfile/etc/udev/rules.d/10usrp.rules Atthispoint,UbuntuhasbeenconfiguredtoknowwhatitshoulddowhendetectingUSRPintheUSB. "udev"mustbereloadrulestoloadournewrules.Thefollowingsmaydothetrickwithoutbootingthe VoIPCookbook:265

computer. or or sudoudevadmcontrolreloadrules sudo/etc/init.d/udevstop sudo/etc/init.d/udevstart sudokillallHUPudevd

WemaycheckifUSRPhasbeenrecongizedbymonitoring/dev/bus/usbafterUSRPispluggedusing thefollowingcommand lslR/dev/bus/usb|grepusrp weshouldseesomethinglike crwrw1rootusrp189,12010120917:38002 EverytimeUSRPispluggeditwillberegisteredingroup'usrp'andmode'crwrw'.

USRPVerification
NextweneedtoverifywetherGNURadiocanworkproperlywithUSRP.Atthispointweneedto connectUSRPtocomputer. ChecktheUSBspeedtoUSRP cd/usr/local/src/gnuradio3.3.0/gnuradioexamples/python/usrp ./usrp_benchmark_usb.py Wewillseesomethinglike Testing2MB/sec...usb_throughput=2M ntotal=1000000 nright=999918 runlength=999918 delta=82 OK VoIPCookbook:266

Testing4MB/sec...usb_throughput=4M ntotal=2000000 nright=1999492 runlength=1999492 delta=508 OK Testing8MB/sec...usb_throughput=8M ntotal=4000000 nright=3998860 runlength=3998860 delta=1140 OK Testing16MB/sec...usb_throughput=16M ntotal=8000000 nright=7997680 runlength=7997680 delta=2320 OK Testing32MB/sec...usb_throughput=32M ntotal=16000000 nright=15995986 runlength=15995986 delta=4014 OK MaxUSB/USRPthroughput=32MB/sec C++interfacetoUSRP,provideestimatemaximumthroughputbetweenPCandUSRP cd/usr/local/src/gnuradio3.3.0/usrp/host/apps ./test_usrp_standard_tx ./test_usrp_standard_rx TypicalresultfromUSRP_standard_txtest which:0 interp:16 rf_freq:1 amp:10000.000000 nsamples:3.2e+07 VoIPCookbook:267

SubdevicenameisFlex900TxMIMOB Subdevicefreqrange:(7.5e+08,1.05e+09) mux:0x000098 basebandrate:8e+06 target_freq:900000000.000000 ok:true r.baseband_freq:904000000.000000 r.dxc_freq:4000000.000000 r.residual_freq:0.000000 r.inverted:0 tx_underrun tx_underrun tx_underrun tx_underrun tx_underrun tx_underrun tx_underrun tx_underrun tx_underrun xfered3.2e+07bytesin1.01seconds.3.154e+07bytes/sec.cputime=0.16 9underruns TypicalresultfromUSRPstandardRXtest xfered1.34e+08bytesin4.19seconds.3.2e+07bytes/sec.cputime=0.8681 noverruns=0 Ifneeded,wecanupgradethewholesystem sudoaptgetyupgrade Thenrebootandupgradethedistro sudoaptgetydistupgrade

VoIPCookbook:268

OpenBTS Installation
BeforewedoOpenBTSinstallation,weneedtocompileandinstallGNURadio.WithoutGNURadio installed,OpenBTSmaynotbeinstalled.Weneedtoinstalladditionallibrary aptgetinstalllibosip24libosip2devlibortp8libortpdev Downloadthesourcecodefrom http://www.openbts.org http://sourceforge.net/projects/openbts/ Thendothefollowings cpopenbts2.6.0Mamou.tar.gz/usr/local/src/ cd/usr/local/src/ tarzxvfopenbts2.6.0Mamou.tar.gz cd/usr/local/src/openbts2.6.0Mamou/ ./configure make makeall makeinstall OpenBTSiscompiledandinstalled.ToenableSMSfacilityinOpenBTS,weneedtocompilethe smqueueseparately.Forstrangereason,weneedtoinstallg++4.3tocompilesmqueue aptgetinstallg++4.3 EditMakefile.standalonefileofsmqueue vi/usr/local/src/openbts2.6.0Mamou/smqueue/Makefile.standalone Replacetheg++ g++osmqueue$(CPPFLAGS)$(INCLUDES)smqueue.cppsmnet.cppsmcommands.cpp ../HLR/HLR.cpp$(LIBS) to VoIPCookbook:269

g++4.3osmqueue$(CPPFLAGS)$(INCLUDES)smqueue.cppsmnet.cpp smcommands.cpp../HLR/HLR.cpp$(LIBS) Compilesmqueue cd/usr/local/src/openbts2.6.0Mamou/smqueue/ makefMakefile.standalone Ifweuseg++4.4wewillseethefollowingerror smnet.cpp:423:error:invalidconversionfromconstchar*tochar* make:***[smqueue]Error1 CompilationofsmqueueofOpenBTSisdone.

A Glimpse on OpenBTS Configuration


SomespecificationofOpenBTSconfiguration AsteriskConfig CommonLib Control GSM SIP SMS TRXManager Transceiver apps doc tests smqueue AsteriskconfigurationfilesforusewithOpenBTS. Commonuselibraries,mostlyC++wrappersforbasicfacilities. ControllayerfunctionsfortheprotocolsofGSM04.08andSIP. TheGSMstack. ComponentsoftheSIPstatemachinesuedbythecontrollayer. TheSMSstack. TheinterfacebetweentheGSMstackandtheradio. Thesoftwaretransceiverandspecificinstallationtests. OpenBTSapplicationbinaries. Projectdocumentation. TestfixturesforsubsetsofOpenBTScomponents. RFC3428storeandforwardserverforSMS

OpenBTSassumethefollowingUDPport 5060AsteriskSIPinterface 5061localSIPsoftphone 5062OpenBTSSIPinterface VoIPCookbook:270

5063smqueueSIPinterface 5700rangeOpenBTStransceiverinterface Theseportscansetviaconfigurationfileapps/OpenBTS.config.ForthosewhodoOpenBTSinstalltion forthefirsttime,needtocopyOpenBTS.configfile cd/usr/local/src/openbts2.6.0Mamou/apps cpOpenBTS.config.exampleOpenBTS.config Ifneeded,wecanedittheconfigurationfile vi/usr/local/src/openbts2.6.0Mamou/apps/OpenBTS.config Mostofthedefaultparametermaybeusedasitis.Sometimes,weneedtochangethenetwork informationsuchas #Networkandcellidentity. #NetworkColorCode,07 #AlsosetGSM.NCCsPermittedlaterinthisfile. GSM.NCC0 #BasesationColorCode,07 GSM.BCC2 #MobileCountryCode,3digits. #MCCMUSTBE3DIGITS.Prefixwith0sifneeded. #Testcodeis001. GSM.MCC001 #MobileNetworkCode,2or3digits. #Testcodeis01. GSM.MNC01 #LocationAreaCode,065535 GSM.LAC1000 #CellID,065535 GSM.CI10

VoIPCookbook:271

smqueue Configuration
DisableIPv6byediting/etc/default/grubchange GRUB_CMDLINE_LINUX_DEFAULT=quietsplash into GRUB_CMDLINE_LINUX_DEFAULT=ipv6.disable=1quietsplash Aftersaveandexit,updategrubusing sudoupdategrub Editsmqueueconfiguration,copysmqueue.config.exampletosmqueue.config cd/usr/local/src/openbts2.6.0Mamou/smqueue/ cpsmqueue.config.examplesmqueue.config smqueueconfigfileisin./smqueue/smqueue.config. vi/usr/local/src/openbts2.6.0Mamou/smqueue/smqueue.config addtotheconfigfilethefollowingcommandtolimitalarmforSMSregistration Log.Alarms.Max10 createsavedqueue.txtin./smqueuedirectory touch/usr/local/src/openbts2.6.0Mamou/smqueue/savedqueue.txt Runsmqueue sudosu cd/usr/local/src/openbts2.6.0Mamou/smqueue/ ./smqueue& Ifitrunscorrectly,wewillseesomethinglike VoIPCookbook:272

1296968828.6030INFO3077809872smnet.cpp:319:listen_on_port:Listeningataddress'0.0.0.0:5063'. 1296968828.6045INFO3077809872smqueue.cpp:2222:main:MyownIPaddressisconfiguredas127.0.0.1 1296968828.6045INFO3077809872smqueue.cpp:2223:main:TheHLRregistryisat127.0.0.1:5060 1296968828.6046INFO3077809872smqueue.cpp:2110:read_queue_from_file:===Read0messagestotal,0badones. 1296968828.6047INFO3077809872smqueue.cpp:2230:main:Queuecontains0msgs. 1296968828.6048INFO3077809872smqueue.cpp:1852:main_loop:===Feb612:07:080queued;waiting.

Small Kludge in smqueue :(


WestillhavealotofproblemintheSMS.Tomakethings"easier"itmightbehelpfullintheregistration processifwecouldeditthesubscribertableinsmqueue.cppsuchas cd/usr/local/src/openbts2.6.0Mamou/smqueue vismqueue.cpp suchthat /*====FIXMEKLUDGE==== *TableofIMSIsandphonenumbers,fortranslation. *Thisisonlyfortestbenchuse.ReallifeusestheHomeLocation *Register(../HLR),currentlyimplementedviaAsterisk. */ static structimsi_phone{charimsi[4+15+1];charphone[1+15+1];}imsi_phone[]={ {"IMSI666410186585295","+17074700741"},/*Nokia8890*/ {"IMSI777100223456161","+17074700746"},/*PalmTreo*/ {"IMSI510110301694405","2101"},/*Bob*/ {"IMSI238209700014858","2102"},/*SB*/ {"IMSI310260254136340","2103"},/*Steve*/ {"IMSI520189606386106","2104"}, {{0},{0}} };

Asterisk Configuration to work with OpenBTS


IntegrationOpenBTStoAsteriskisprincipallyverysimple.EverySIMcardmaybeconfiguredasSIP userusingIMSIasusername.ProcesstoaddOpenBTSsubscriberthroughthefollowingtwosteps: 1. GetIMSIfromtheSIM.ThisisimplementedbysendingSMSasmobilephoneconnectto VoIPCookbook:273

OpenBTS. 2. Editsip.confandextensions.conftosupportthenewSIPuser. Thus,inprincipal,thereisnotmuchtoconfigureAsterisktobeabletotalktoOpenBTS.Weneedto edit /etc/asterisk/sip.conf /etc/asterisk/extensions.conf ExampleofAsteriskConfigurationcanbefoundin /usr/local/src/openbts2.6.0Mamou/AsteriskConfig Exampleof/etc/asterisk/sip.confisasfollows [IMSI510110301694405] callerid=2101 canreinvite=no type=friend callerid=2101 ;context=sipexternal allow=gsm host=dynamic [IMSI520010104743577] callerid=21011 canreinvite=no type=friend allow=gsm context=sipexternal host=dynamic Exampleof/etc/asterisk/extensions.confisasfollows exten=>2101,1,Dial(SIP/IMSI510110301694405,60,rt) exten=>2102,1,Dial(SIP/IMSI238209700014858,60,rt) exten=>2103,1,Dial(SIP/IMSI310260254136340,60,rt)

VoIPCookbook:274

IMSI520154100006647isobtainedfromtheSMSreceivedbytheOpenBTSuser.

AutomaticSIMRegistration
Asmentionathttp://gnuradio.org/redmine/wiki/gnuradio/OpenBTSThe_use_of_autocreatepeer=yeswe mayaddsomeparametersin/etc/asterisk/sip.conftoenableautomaticSIMregistration [general] allowoverlap=no;Disableoverlapdialingsupport.(Defaultisyes) bindport=5060;UDPPorttobindto(SIPstandardportis5060) bindaddr=0.0.0.0;IPaddresstobindto(0.0.0.0bindstoall) srvlookup=yes;EnableDNSSRVlookupsonoutboundcalls ;lineuntukautomaticsimregistration autocreatepeer=yes canreinvite=no calllimit=1 type=friend allow=gsm context=sipinternal host=127.0.0.1;assumingOpenBtsandAsteriskrunonthesamemachine Wecanexpandthecapabilityofasterisktorecognizenumbersusingcountrycodelike+62XXXusing ENUM.

OpenBTS Operation
TooperateOpenBTSwecanfollowthefollowingsteps. ChektheconnectionbetweenOpenBTSandUSRP.ThiscanbedoneusingUSRPpingasfollows cd/usr/local/src/openbts2.6.0Mamou/Transceiver ./USRPping AssumingAsteriskiscorrectlyconfigure,wecanrunitvia

VoIPCookbook:275

asterisk or /etc/init.d/asteriskrestart

Runsmqueue sudosu cd/usr/local/src/openbts2.6.0Mamou/smqueue/ ./smqueue& RunOpenBTS cd/usr/local/src/openbts2.6.0Mamou/apps ./OpenBTS WeneedtocopyOpenBTS.config.exampletoOpenBTS.configifwerunitforthefirsttimebeforerun OpenBTS. cd/usr/local/src/openbts2.6.0Mamou/apps cpOpenBTS.config.exampleOpenBTS.config ./OpenBTS Usingalldefaultvalues,withnomodification,wecanoperateOpenBTS.

VoIPCookbook:276

CHAPTER 18: Peering Among Providers


ThereareactuallyplentyoffreeserviceslikeVoIPRakyatacrosstheworld.Mostoftheseservicesare interconnectedthroughabrokerfacilityrunbyaSIPBrokerhttp://www.sipbroker.com.SIPBroker functionsasanSIPinternetexchangewhereallSIPaccountproviderssharetheirtraffic.SIPBroker providesareacodeforeachofthem,allowingthemtobeconnectedtoeachother.Inshort,thosewho haveaccountinVoIPRakyatcanalsocommunicatewithotherswhoownaccountindifferentservers. AcompletelistofmorethanathousandofavarietyofSIPaccountprovidersworldwidecanbefound intheSIPBroker'swhitepagesfromthefollowingURL: http://sipbroker.com/sipbroker/action/providerWhitePages. Noticethattherearesomeimportantinformationontheproviders,suchas,ProviderName,somewith theirURL;SIPProxy,theSIPserverinuse;Areacode,orbetterknowninSIPBrokerterminologyas SIPCode.AlsolistedinsuchalistisVoIPRakyat'sareacode,whichis*536.Thismeansthatother SIPproviderswillingtoconnecttoVoIPRakyathavetoaddthe*536codeasaprefixpreceedingVoIP Rakyat'sSIPaccountnumber.Forexample,ifaSIPproviderwishestocallsomeoneinVoIPRakyat whoseSIPaccountnumberis20123,thenuserofsuchprovidershoulddial*53620123insteadof 20123.

VoIPCookbook:277

Figure 18.1: Through SIPbroker.com you can find a number of SIP providers with their respective proxy. The site also indicates which provider is active and is not active

VoIPCookbook:278

Free SIP Proxy Servers


TherearealsootherfreeSIPProxyproviderswecanconnecttothroughSIPBroker.Someofwhich are,suchas: AreaCode *201 *208 *211 *234 *247 *258 *269 *272 *320 SIPProxy voip.brujula.net sip.faktortel.com.au sipgate.co.uk sip.pennytel.com sip.freshtel.net voiptalk.org sip03.astrasip.com.au sip2.bbpglobal.com sip.sipme.com.au URLforregistration http://voip.brujula.net/english/ http://www.faktortel.com.au/ http://www.sipgate.co.uk/user/index.php http://www.pennytel.com/ http://www.freshtel.net/ http://www.voiptalk.org/products/index.php http://www.astratel.com.au/ http://www.bbpglobal.com/global/ http://www.sipme.com.au/

Becoming a Peer in SIP Network


Ifyou'reoperatingyourownsoftswitchusingthepublicIPaddress,youcanregisterwithSIPBroker forfreeinordertoobtaintheareacodeoftheSIPBrokersothatyoucanbecalledbyotherVoIP network.Theprocedureyouhavetodoisasthefollowing:createanaccountinSIPBrokerat http://www.sipbroker.com/sipbroker/action/memberRegister,andregisteryourSIPProxythroughSIP Brokerathttp://www.sipbroker.com/sipbroker/action/providerWhitePages.EnteryourSIPProxyinthe providedblanksandclicktheSavebutton. TheprocessofcreatinganaccountatSIPBrokerisnotdifficult.Allyouhavetodoistoselectthe menuformemberregistration.

VoIPCookbook:279

Figure 18.2: Through SIPbroker.com you can find a number of SIP providers with their respective proxy. The site also indicates which provider is active and is not

Inthememberregistrationmenu,youonlyhavetoentertheinformationpertainingtotheSIPURL (suchas20123@voiprakyat.or.id),thepassword,emailaddresstoregisteryourselftotheSIPBroker throughhttp://www.sipbroker.com/sipbroker/action/memberRegister.

VoIPCookbook:280

CHAPTER 19: Internet Telephony Bandwidth


InVoIP,Voicequalityisimportant,asitwilldeterminehowclearthevoiceinagivenphone conversation.Suchqualityisdependentonanumberofthings:thecompressiontechniquebeingused (Codec),theamountofpacketlossoccurringinagivennetwork,andbandwidthavailability.Sothereis anumberofthingsyouneedtotakeintoaccountwhenplanningyourVoIPnetwork.Withthese information,youwillknowwhetherthebandwidthyouhaveissufficientforyourcommunication.

Coding Decoding (CODEC)


Ifyouwanttoknowhowavoiceproducedbyacodecsoundslike,youcanlistentoa8Kbpsmono WAV,whichcanbedownloadedfromhttp://www.signalogic.com/index.pl?page=codec_samples. Questionoftenaskedwhenusingthisserviceishowmuchbandwidthiscunsumed.Whenidle,the systemdoesnotneedlargeamountofbandwidth,butwhenyoucommunicate,thebandwidthneeded couldbeasbigas32kbpsupand32kbpsdownperchannel(1communicationsession),depending whichcodecisbeingused. Thereisanumberofcodecsused: Codec GIPS GSM iLBC ITUG.711 ITUG.722 ITUG.723.1 ITUG.726 ITUG.728 ITUG.729 Speex Bandwidthconsumption 13.3Kbpsorhigher 13Kbps(fullrate),20msframesize 15Kbps,20msframesize,13.3Kbps,30 msframesize 64Kbps,samplebasedisalsoknownas alaw/ulaw 48/56/64Kbps 5.3/6.3Kbps,30msframesize 16/24/32/40Kbps 16Kbps 8Kbps,10msframesize 2.15to44.2Kbps

VoIPCookbook:281

LPC10 DoDCELF

2.5Kbps 4.8Kbps

Thenextquestionwouldbewhichcodecisthemostsuitableforaprovider?Theanswerdependsonthe amountofbandwidthyouhave.Ifyouhaveamaximumbandwidthof32Kbpsbothupanddownfora VoIPtraffic,itisrecommendedthatyouuseGSMoriLBCasyourcodec.Ontheotherhand,ifthe amountofbandwidthishigher,say,higherthan128Kbps,youcanuseG711u(PCMU),whichwill increasethevoicequalityinacommunicationsession,withclearervoiceandlowerdelay.Othercodec thatcouldproduceoptimalresultistheG.729Codec.Unfortunately,itisaproprietarycodecwhichis notfavourableforthosewhouseopensourceplatform. ThemostcommonlyusedcodecsaretheG.729,GSM,andG.711.Ofthese,theG.711isfavorableasit deliversgoodqualityinLANnetwork,GSMispreferredbyopensourceusersasGSMisnot copyrighted,whilemanyVoIPdevicesuseG.729fortheircodec,theonewhichiscopyrighted.

Mean Opinion Score (MOS)


Tofindouthowgoodyourvoicequalityis,youcanmeasureitintermsofMeanOpinionScore(MOS) andRFactor,bothofwhicharetheunitmeasurementderivedfromtheusersperceptiononthevoice theyhear.MOScanbefoundathttp://www.voiptroubleshooter.com/diagnosis/emodel.html.Belowwe haveprovidedyouwithexamplesofMOSmeasurementsbasedonanumberofCodecs. User'sopinion MaximumvaluesobtainedbyG.711 Highlysatisfactory Satisfactory Good Unasatisfactory Poor Notrecommended RFactor 93 90100 8090 7080 6070 5060 050 MOSScore 4.4 4.35.0 4.04.3 3.64.0 3.13.6 2.63.1 1.02.6

MOS Score and R Factor are measured based on users' experience on a communication session

VoIPCookbook:282

Figure 19.1: VoIP Quality and Bandwidth Calculator.

Enteringothertypesofcodecandvaluespertainingtoourbandwidthforeverycodec,weobtainedthe followingMOSandRFactorcalculation: Codec G.711 G.723 5kbps G.723 6kbps G.729 Frame 20ms 20ms 20ms 20ms Packet Loss 0% 0% 0% 0% MOS 4.4 3.8 4.0 4.1 RFactor 93 74 78 83 Kbps 80.8 16.5 17.5 24.8

VoIPCookbook:283

MOS and R Factor values for G.711, G.723, and G.729


TheeffectcausedbypacketlossoccurringinagivennetworkwillmaketheMOSandRFactorvalue decreasing,asshownontableabove.Thehigherthepacketloss,thelowerthevalueofMOSandR Factor. Codec G.729 G.729 G.729 G.729 Frame 20ms 20ms 20ms 20ms Packet Loss 0% 5% 10% 20% MOS 4.1 3.3 2.7 1.9 RFactor Kbps 83 64 52 37 24.8 24.8 24.8 24.8

Typically,theframesizeusedformeasurementis20ms,withthebandwidtharound25Kbps.The longerthelengthofpayloadorvoiceframesize,thelessbandwidthisneededbecausetheoverhead protocolissmaller. Codec G.729 G.729 G.729 G.729 G.729 Frame 2.5ms 5ms 10ms 20ms 30ms Packet Loss 0% 0% 0% 0% 0% MOS 4.1 4.1 4.1 4.1 4.1 RFactor 83 83 83 83 83 Kbps 41.6 41.6 41.6 24.8 19.2

VoIPCookbook:284

Calculating The Required Bandwidth

Figure19.2:BandwidthCalculatoratAsteriskGuru. ToestimatetheamountofbandwidthconsumedbyaCodec,useAsteriskGuru'stools,whichis availableathttp://www.asteriskguru.org/tools/bandwidth_calculator.php.Thistoolenablesusto calculatetheamountneededbyavarietyofCodecsinrespecttoacertainnumberofcallstakingplace simultaneously.TheresultingcalculatedvalueswillbeshownasIncomingandOutgoingbandwidth.

VoIPCookbook:285

AnexampleofcalculatedrequiredbandwidthforGSMandG.729Codecisshowninthefollowing table Numberof calls 1 2 3 4 5 6 GSM Incoming (Kbps) 28.63 57.25 85.88 114.50 143.13 171.75 Outgoing (Kbps) 28.63 57.25 85.88 114.50 143.13 171.75 G.729 Incoming (Kbps) 23.63 47.25 70.88 94.50 118.13 141.75 Outgoing(Kbps) 23.63 47.25 70.88 94.50 118.13 141.75

Sosupposeyourbandwidthcapacityis64KbpsandtheCodecyouuseisG.729.Thenthemaximum numberofVoIPcallsyoucanhaveforoptimalvoicequalityistwo.Thisisofcourseassumingthatthe Internetisnotbeingusedforothertraffic,suchas,email,browsing,chattingordownloading. AmuchmoredetailedcalculationofaVoIPpacketcanbelookedat http://www.packetizer.com/voip/diagnostics/bandcalc.html.Byusingthistool,wecanseethe bandwidth,packetrate,delayandevenperformance.Theparametersusedtoderivethecalculationare Payload(Codec),typeofprotocolandwhetherwewanttouseSilenceSuppression.IfyoutickSilence Suppression,theaverageofbandwidthorpacketdeliveredwillbecomesmaller. Fromallofthesecalculations,wecandeduceatleasttwothings:

Thesmallerthebandwidth,thelargertheMegaInstructionPerSecond(MIPS)requiredto operateinaprocessor.Todaythismightnotbeaproblem,giventhathighspeedprocessorsare nowlargelyavailableataffordableprice. Thesmallerthebandwidth,thehigherthedelayprocess.Thisisrelatedtotheneedstoprocess highvoicecompression.

VoIPCookbook:286

Figure19.3:MoreDetailedBandwidthCalculatoratPacketizer. Therearemoreinterestingthingswecanconcludefromthesecalculation.Werecommendthatyou spendmoretimeusingthetoolsothatyouwillunderstandavarietyofeffectsoccurringinVoIP communicationsession.

VoIPCookbook:287

Calculation for Call Center


UnlikeanetworkservingsmallnumberofVoIPcalls,acallcenterisoftenusedtoaccommodateahigh numberofcallsservedbyagivennetwork,thusrequiringamuchmoresophisticatedcalculationand planningtools.ACallCentercantypicallybeabank,travelagent,ticketreservationorevenamobile operator.Soifyouintendtoestablishacallcenter,pleasevisithttp://www.erlang.com/calculator/call/ tocalculatehowmuchbandwidthneeded.

Figure19.4:CallCenterCalculatoronErlang.com Whatwehavetofillinasparameterarethelengthofcalls(seconds),resolvingtime(seconds), percentageofcallsansweredwithinseconds,andpercentageofcallsthatwillbeblocked.Blockedcalls willreceivebusytone,asignindicatingthatalllinesarebusy.Afterallparametersarefilledin,we VoIPCookbook:288

needtoenterthenumberofcallscominginanhour.Basedonthevaluesweentered,wewillobtain simulationresultshowinghowmanyagentsandlinesareneededtorespondtothecalls. Thenextstepistoestimatehowmuchbandwidthisneededforaspecificnumberoflinesoranumber ofminutes,inagivenpercentageofcallsthatwillbeblockedandreceivingbusytone.Thisisoften measuredusingErlangTrafficModelintermsofErlangs,theunitrepresentingusageofavoice channel.ErlangsTrafficModelmeasurementisveryimportanttohelpyoubeingatelecommunication networkengineertounderstandthetrafficpatternandnetworktopologynecessarytodeterminethesize oftrunkgroup.Inaddition,themeasurementcanalsobeusedtodeterminethenumberoflinesneeded betweenatelephonenetworkorsystemandtelephonecenter,orbetweennetworklocations. InpracticeErlangscanbeusedtogiveanoverallpictureoftrafficvolumeinanhour.Forexample,a usergroupmakes30callsinanhour,andeverycallhasanaveragetalkingdurationof5minutes,then theErlangsresultingfromthetrafficthattakesplaceis: Trafficminutesinagivenhour Trafficminutesinagivenhour Trafficminutesinagivenhour Traffichoursinagiventime Traffichoursinagiventime Trafficsize = Numberofcallxduration = 30x5 = 150 = 150/60 = 2.5 = 2.5Erlangs

ThesizeoftrafficisalsocalledBusyHourTraffic(BHT).TheBusyHourFactorparameterisa percentageofdailyminutesofcallsmadeduringthemostbusyhourinagivenday. InadditiontoErlangs,thereisalsoblocking.Blockingrepresentsunsuccessfulcallsbecauseof insufficientnumberoflines.Inotherwords,thecallerwillreceiveabusytonefromthecenterasall lines/trunksarebeingused.0.01blockingimpliesthat1%ofcallsmadewillbeblocked.Thisdecimal numberisusuallyusedintraffictelecommunicationengineering.Inanumberofapplications,blocking upto0.03(3%)isstilltolerable.Sothisnumbershouldideallybeassmallaspossible. Itappearsthatthemorewetoleratethenumberofblockedcalls,themoreminutesperdaywewill have.However,themorecallstakeplaceduringpeakhoursorwhenbusyhourfactorincreases,theless numberofminutesperdaywewillhave. NowthatyouknowwhatErlangTrafficModelmeasurementis,youcanplanyourconnectivity capacityforyourcallcenter,usinganumberofmeasurementtoolsavailableat VoIPCookbook:289

http://www.voipcalculator.com/calculator/.

VoIP Capacity Planning

Figure19.5:ErlangsandLinesCalculator. ByusingErlangsandLinesCalculator,youcanobtainthenumberofBusyHourTraffic(BHT)ofa numberoflines.Inourexample,wesimulate2,4and8voicepathsfacilitatedby64Kbpsconnectivity withsomeBlockingvalues.Thecalculationresultcanbeseenatthefollowingtable: VoicePath Blockin g 2 0.01 BHT (Erlangs) 0.15 VoIPCookbook:290

2 2 4 8

0.03 0.10 0.01 0.01

0.25 0.55 0.85 3.10

Figure19.6:ErlangsandBandwidthCalculator. Thiscalculatorcanbeusedtoestimatetheamountofbandwidthrequiredtodeliverthetraffic,when theBusyHourTrafficisknown.ByusingErlangsandbandwidthcalculator,wecanobtainthenumber ofBusyHourTraffic(BHT)ofagivenCodec.Supposewerunthesimulationusingavarietyof bandwidthvaluesandG.729Codec;wewillobtainthefollowingresult: Bandwidth Blocking VoicePath BHT VoIPCookbook:291

(kbps) 64 64 64 128 256 512

0.01 0.03 0.10 0.01 0.01 0.01

2 2 2 5 10 21

(Erlangs) 0.15 0.25 0.55 1.35 4.45 12.80

Figure19.7:MinutesandLinesCalculator. TheMinutesandLinesCalculatorallowsustoestimatehowmanyvoicechannelsareneededfora givenminutesofcallsonthenetwork.Anetworkplannermustmakesurethatthenetworkhas sufficientbandwidthtoaccommodatecommunicationsessionatpeakhours.AsshownintheFigure, TheBusyHourFactorparameterisapercentageofdailyminutesofcallsmadeduringthemostbusy VoIPCookbook:292

hourinagivenday.Thedefaultvalue17%isanacceptablepercentageforanofficeoperating8hours perday.Thepercentageisnormallyhigherforanofficeoperatinginlessnumberofhours,oranoffice thatoftenplacescallsinadifferenttimezone. ThefollowingistheresultofcalculationforaADSLchannelcapableoffacilitatingonlytwochannels: Voice Channel 2 2 2 2 2 2 Blockin g 0.01 0.03 0.10 0.03 0.03 0.03 BusyHour Factor 17% 17% 17% 20% 30% 40% Minutes/Day 52 88 194 45 30 22

Itappearsthatthemorewetoleratethenumberofblockedcalls,themoreminutesperdaywewill have.However,themorecallstakeplaceduringpeakhours,orwhenbusyhourfactorincreases,the lessnumberofminutesperdaywewillhave.

VoIPCookbook:293

CHAPTER 20: VoIP Evaluation


Inthischapter,wewilldiscusshowtoevaluateaVoIPsystem.Two(2)applicationsoftware,i.e.,

VQManagerSoftware SIPp

Willbeused.

Evaluate VoIP Performance using VQManager VQManagerInstallation


DownloadVQManagerfrom http://www.manageengine.com/products/vqmanager/91408665/ManageEngine_VQManager.bin Dothefollowingonshell sudosu cpManageEngine_VQManager.bin/usr/local/src/ cd/usr/local/src chmoda+xManageEngine_VQManager.bin ./ManageEngine_VQManager.binconsole Weneedtopress<ENTER>severaltimes.Normally,VQManagerwillbeinstalledin /root/ManageEngine/VQManager AllimportantscriptofVQManagerislocatedat /root/ManageEngine/VQManager/bin/

VoIPCookbook:294

SomeoftheImportantScriptsofVQManager
TostartVQManager sudosu cd/root/ManageEngine/VQManager/bin/ /root/ManageEngine/VQManager/bin/run.sh Tostartasbackgroundprocess, sudosu cd/root/ManageEngine/VQManager/bin/ /root/ManageEngine/VQManager/bin/run.sh& TostopVQManager sudosu cd/root/ManageEngine/VQManager/bin/ /root/ManageEngine/VQManager/bin/shutdown.sh ToreinitializedtheDatabaseincasewehaveacorruptdata, sudosu cd/root/ManageEngine/VQManager/bin/ /root/ManageEngine/VQManager/bin/reinitializeDB.sh

VoIPCookbook:295

ActivateVQManagerWebService
WhenwerunVQManagerWebServiceforthefirsttime,weneedtoactivatetheWebService.Firstly, weneedtostartVQManagerasbackgroundprocess,suchas, sudosu cd/root/ManageEngine/VQManager/bin/ /root/ManageEngine/VQManager/bin/run.sh& AccessviaWebtohttp://localhost:8647withdefaultusername&passwordadmin&admin.

Figure20.1LoginMenuinVQManager.

VoIPCookbook:296

Figure20.2.WelcomeMessageofVQManager. AsweaccesstheVQManagerWebforthefirsttime,itwilltellusthatwecanchoosewhether,

UseVQManagerbuiltinsniffer. ImporttheCallDetailedRecords(CDR)logfiles. ImporttheCDRsentasSyslogmessafesbytheCallServers.

Clicknexttocontinue.

VoIPCookbook:297

Figure20.3OptiontomonitorVoIPnetwork. Clickononeoftheoption.TheeasiestmaybeSniffer. ClickNext;afterwechoosethemethod.

VoIPCookbook:298

Figure20.4ProtocolSettingsinVQManager. Inthethefollowingmenu,wecanchoosetheprotocolstobemonitoredinthenetwork.Inthenormal VoIPnetwork,wedon'thavetochangethevalues. ClickNexttocontinue.

VoIPCookbook:299

Figure20.5SelecttheInterfacetobemonitored. Thisistheimportantpart.Weneedtoselect,theinterfacetobesniffed.

VoIPCookbook:300

Figure20.6InterfaceSelected.

Intheabovefigure,wechooseinterfaceeth0tobesniffed. ClickNexttocontinue.

VoIPCookbook:301

Figure20.7ConfigurationSummary. Finally,VQManagerwillshowthesummaryofourVoIPMonitoringplatform. ClickNexttocontinue.

VoIPCookbook:302

Figure20.8VQManagerWebConsole. FinishconfigureVQManager. TheabovefigureshowstheVQManagermonitoringdisplay.Itshowsalotofimportantinformation regardingthemonitoredVoIPinfrastructure.

VoIPCookbook:303

ChangingtheMonitoredInterface
Insomecases,weneedtomonitordifferentinterface.Inthiscase,weneedtologintothewebat http://localhost:8647 usernameadmin passwordadmin Clickonthefollowingsequence Admin>Sniffer>ProtocolSettings>Next>"selectinterface">Next>Save Ifweneedtochangethemonitoredinterface,weneedtoclickonthefollowingsequence. Admin>Sniffer>Reconfigure>ProtocolSettings>Next>"interfacenya">Next> Save

InsertingnewInterface
Insomecases,wehaveinsertedanewinterfaceintotheserverandneedtomonitorthisparticularnew interface.Todoso,weneedtoresetthedatabase, sudosu /root/ManageEngine/VQManager/bin/reinitializeDB.sh thenactivatetheinterfacethroughVQManagerWebagain

VoIPCookbook:304

MonitorVoIPPerformance

Figure20.9FrontendWebConsoleofVQManager. TheWebfrontendofVQManager.Wecaneasilyseethecallvolume,includingthesuccesscall,the failedcalls.Ontheright,wecanseethequalityofcallsingeneral,including,itsdelay,jitter,packet loss,MOS,RFactor.

VoIPCookbook:305

Figure20.10WebFrontEnd Attheend,oftheWebFrontend.Ontheleft,wecanseetrafficpassinginKbps.Ontheright,wecan seetrafficpassinginpacketpersecond.Inaddition,wecanseethetypeoftrafficpassingthroughour system.

VoIPCookbook:306

Figure20.11CallMenuVQManager. InVQManagercallmenu,wecanseeinsummeryofcalls,including,theusageprofile.Inaddition,we canseetheactivecallatthemoment.

VoIPCookbook:307

Figure20.12EndpointMenu. IntheEndpointmenu,wecanseeamoredetailedinformationofparticularendpoint,suchas,its activities,performanceandusage.Ontheleft,wecanseetheusageactivities.Ontheright,wecansee moredetailedonthestatisticsandvoicequality.Belowit,wecanseemoredetailedontheincoming andoutgoingcallQoS.

VoIPCookbook:308

Figure20.13EndpointDetailedCalls. Atthebottomofendpointmenu,wecanseedetailedcallsperformedbytheparticularendpoint.

VoIPCookbook:309

Figure20.14ConcurrentCall. InConcurrentCallReportmenu,wecaneasilyseehowmanyconcurrentcallishandledbythe softswitch.Inaddition,wecanalsoseethepeakhoursofthetrafficanditstotalandaverageconcurrent calls.

VoIPCookbook:310

Figure20.15GoodQualityCallsReport ThroughReportMenu>GoodQualityCallsReport,wecaneasilyseethegoodqualitycallmade throughoursoftswitch.

VoIPCookbook:311

Figure20.16UnsuccessfulCallsReport ThroughReportMenu>UnsuccessfulCallsReport,wecantheunsuccessfullcalls.Wemayfurthjer analyzethefailurereasons.

VoIPCookbook:312

Figure20.17SuccessfulCallsReport ThroughReportMenu>SuccessfulCallsReport,wecanseethereportonthesuccessfulcallthrough oursoftswitch.

VoIPCookbook:313

Evaluate VoIP Performance using SIPp InstallationofSIPp


ToinstallSIPp,wecanuse sudoaptgetinstallsiptester

InstallationofSIPpWebfrontend
DownloadSIPpWebfrontendfrom http://sourceforge.net/projects/sipp/files/sipp/3.1/ Copy&Extract mkdir/var/www/sipp cpsipp_webfrontend_v1.2.tgz/var/www/sipp/ cd/var/www/sipp/ tarzxvfsipp_webfrontend_v1.2.tgz mv/var/www/sipp/src/*/var/www/sipp/ Createdatabase mysqlurootp password: CREATEDATABASESIPpDB; USESIPpDB; \./var/www/sipp/tables.sql quit Editconfig.ini.php vi/var/www/sipp/config.ini.php Suchthat VoIPCookbook:314

[EXECUTABLES] 3.0="/usr/bin/sipp" [CONFIG] db_host="localhost" db_user="root" db_pwd="123456" db_name="SIPpDB" admin_pwd="" Tomakeiteasierforaccessingtheweb,emptytheadmin_pwdfield.SIPpWebfrontendcanbe accessedvia http://localhost/sipp using usernameadmin password<nopassword>

TransactionOrientedTestusingSIPp
Inthisexample,weassumetheIPaddressofthesoftswitchis192.168.0.3. Firstly,weneedtosetuptheconfigurationfile/usr/local/etc/opensips/cfgtestuas.cfgattheserverside. Thelistofcfgtestuas.cfgisintheAppendix.Testtheopensipsconfigurationfile,itcanbedonevia, #opensipscf/usr/local/etc/opensips/cfgtestuas.cfg Ifnoerror,wecanruntheserverusing #opensipsf/usr/local/etc/opensips/cfgtestuas.cfg RunSIPpattheclientside,using $sippsnuac192.168.0.3

VoIPCookbook:315

Orusingamorecomplexcommandsuchas, $sippsnuac192.168.0.3:5060m200000r10000d1l70 Exampleofstresstestingwith1000callpersecondand10000concurrentcallusing $sippsnuac192.168.0.3r1000l10000d10000

Figure20.18SIPpStressTestwith1000callpersecondand10000concurrentcall

VoIPCookbook:316

Figure20.19SIPpStressTestpage2 ThecompletelistofSIPpswitchcommandislistedintheAppendix.Forsome,itseemsverydifficult todoastresstestintextmode.WecanusetheSIPpWebfrontendforamoreuserfriendlygraphical interface.

VoIPCookbook:317

AccesstotheSIPpWebfrontend
SIPpWebfrontendcanbeaccessedvia http://localhost/sipp usernameadmin password<nopassword>

Figure20.20ManagedTestMenuinWebFrontend ShownintheFigureistheWebfrontendmenuformanagingthetest.Forsimple&commontest,we basicallyneedtoaccessthismenuonly.

VoIPCookbook:318

Figure20.21ManagedScenarioMenu SeveralscenariohasbeenbuiltininSIPpcanbeseenintheManagedScenariomenu.Wecanalways addmorescenarioifyoulike.

VoIPCookbook:319

Figure20.22SystemInformationMenu IntheSystemInformationMenu,wecanseesomeinformationonthesystem,suchas,anyrunningtest, freeharddiskspace,SIPpversionetc.

VoIPCookbook:320

Figure20.23CreateNewTestMenu Tocreateanewtest,intheManagedTestMenu,selectCreateNewTest.Wecantypeinthenameof testanditsdescription.Don'tforgertopressthe"Savetest"buttontosavethetest.

VoIPCookbook:321

Figure20.24CreateNewTest Intheexample,weusetest1000cps10000ccforatesttocreate1000callpersecondand10.000 VoIPCookbook:322

concurrentcall.Titlecanbeanything,aslongasitisinformative.

Figure20.25CreateNewTest

VoIPCookbook:323

Wecanthencompletetheformbyputtingsomeinfointhedescription.

Figure20.26CreateNewTest

VoIPCookbook:324

Belowthe"Savetest"buttonwillappearmenutoconfigurethetestinamoredetail.Itisinterestingto notethatwecansimultaneouslyconfiguretwo(2)devices,namely,PartyAandPartyB.

Figure20.27FirstSectionoftheAddCallinCreateNewTest VoIPCookbook:325

Whenweclickaddcalltooneoftheparty,someoftheparameterstobeconfiguredare,scenario(as uacoruas),remotehostipaddress,andmonitorcalltoseeactivitiesinrealtimeduringtest. Figure20.28LastSectionoftheAddCallinCreateNewTest

VoIPCookbook:326

Attheendofconfigurationcallmenu,wecansetcallrateandextendedparameter.PressSavecall buttonafterwecompletetheconfiguration.

Figure20.29Runtestmenu Afterallparameterscompletelyset,wecanclickonRuntestbutton.Todotheactualrun,weneedto doanotherclickon"Runtestnow".

VoIPCookbook:327

Figure20.30RuntheTest Ifthemonitorcallactive,wecanseetheactualtestrunbySIPponthescreen.Press1,2,3keytosee moreinformationontesttest.

VoIPCookbook:328

CHAPTER 21: VoIP Troubleshooting


Ingeneral,aVoIPcommunicationwillincludereceivetheanalogvoicefromtelephonehandset, digitized,compression,packetized,sentitoverthenetwork,decode,andreconstructedintovoiceatthe otherend. PacketnetworkusedforthejobcanbebasedonIP,ATM,FrameRelay,thus,itislogicaltousethe termVoiceoverincludingVoIP,VoATM,VoDSL,VoCable,VoPetc.Wecanuseallthetermfor VoIP. IPPhoneisusuallyusedintheprocessofdigitalization,compresion,andpacketizationinternally withinthephoneandtheproducedpacketissentovertheEthernetLAN. IPGatewayisaninterfaceforanalogtelephonesordigitaltelephonesorTDMtrunktoconvertitsaudio signaltoVoIPPacket.AnIPPBXorEnterpriseGatewaymaybeusedbyanenterprisetoconnectIP Phonetoconventionaltelephonenetwork.Atrunkgatewayusuallyusedbyacompanytoconnect analogphonelinestoVoIP.

CODEC and Vocoder


ThetermCODEC(CoderDecoder)andVocodermaybeinterchangeableandnormallyrefertothe subroutinefacilitiesinsideasoftphoneneededbytheIPPhoneorGatewayinthedigitalizationprocess. ThereareseveralCODECthatmaybeused,suchas,

G.711aPCMstandard,codeaudiointo8bitsampleat8000samplepersecond,produces 64kbpsdigitalaudio. G.729/G.729Athe8kbpsstandard. CODECthataimsforlowerspeedwillnormallyexperiencedistortioninthecodedaudio.

ThepublishedMOSoflowspeedCODEwillnormallyhavearelativelygoodquality.Inreality,low speedCODECwillexperienceadistortioninthecodedaudio.Inaddition,itwasspeculatedthatlow speedCODECsuchasG.729Acreatesstressforcontinuoususageincallcenter.

VoIPCookbook:329

Preparing A VoIP Ready Network


VoIPisverysensitiveonanyprobleminIPnetwork.Thus,itwouldbebeneficialtoprepareaclean networkpriortoVoIPoperation.Ingeneral,agoodnetworkcanbeeasilydeployedifweknowhowto designagoodnetwork.Weneedtounderstandthatmanyprobleminthenetworkthatdonotaffect applications,suchas,Web,emal,maycreateahugeproblemonVoIPapplications.

Minimal requirement / configuration


Use100MbpsLANswitchhubwithdedicatedsegment. UseGigabitEthernettoswitch/routerthatconnectedtotheserver. UseagoodIPPhone,itmaybebeneficialtouseaswitchthatcanprioritizedvoicetraffic. TalktoyourISP,makesurewereceiveenoughbandwidth.ItwouldbebeneficialiftheISPcan prioritizeRealTimeProtocol(RTP)traffic. MakesuretheroutermayprioritizeRTPtraffic. MakesurethefirewallisconfiguretopassVoIPtraffic. Designamanagementandmonitoringinfrastructuretohelpquickproblemdetectionand solving. Dotestpriortosystemoperation.

Test prior to operation of the system


Priortotheoperationofthesystem,itwouldbebeneficialtosystematicallytestthesystem performancetosupportVoIPoperation.Basically,thetestismerelysamplingthesystemperformance toseeifitfitstothedesignrequirement.Itmayincreaseourconfidenceaswellastoseeanypossible problems. Ingeneral,thereareseveraltypeoftestingpriortotheoperationofthesystem,namely,

Testbetweensites.Toseeanypossibleproblemsduetocongestionintheaccessnetworkoron thewideareanetwork.Itwouldbebetterifthetestcanbeperformedinthelongperiodoftime, sayone(1)month.TestprocesscanbedonebyusingasimpletoolstosimulateRTPtrafficas routershouldhandledifferentlyascomparedtoICMP. Pilottrial.LimitedtestoftheplannedIPtelephonysystemtoseeiftherewouldbeanyproblem infullfledgedeployment. VoIPCookbook:330

Desktoptesting.OurLANmayexperiencingalotofproblems,weneedtodevelopa mechanismtotesteachsegmenttoseehowseverethecollisionsandthepacketloss.UseVoIP analyzertoseepacketlossandjitterduringinstallation.

Some Useful References For VoIP Troubleshooting


http://www.voiptroubleshooter.com/ http://www.voiptroubleshooter.com/tools/index.html http://www.telchemy.com/ http://www.voiptroubleshooter.com/basics/mosr.html

VoIPCookbook:331

References

http://www.asterisk.org http://www.voipinfo.org/ http://www.voiptroubleshooter.com/ http://www.voiprakyat.or.id http://www.asteriskguru.com http://www.e164.org http://www.telchemy.com/ http://sipbroker.com/

VoIP Hardware

http://www.digiumcards.com/ http://www.voipon.co.uk/ http://www.thevoipconnection.com/ http://www.level1.com/ http://www.linksysbycisco.com/ https://www.digium.com/en/supportcenter/documentation/viewdocs/TDM2400P https://www.digium.com/en/supportcenter/documentation/viewdocs/TDM400P https://www.digium.com/en/supportcenter/documentation/viewdocs/TDM410

VoIP Softswitch

http://www.asterisk.org http://www.briker.org http://www.opensips.org http://www.asterisk.org/asterisknow

VoIP Client Software


http://www.counterpath.com/xlitedownload.html http://www.virbiage.com/cubix.php http://www.asteriskguru.com/idefisk/free/ http://www.sjlabs.com/sjp.html http://www.xten.com/index.php?menu=download http://ekiga.org

Testing Software

http://sipp.sourceforge.net/ http://sourceforge.net/projects/sipp VoIPCookbook:332

http://www.manageengine.com/products/vqmanager/

VoIPCookbook:333

APPENDIX A: Example of /etc/sip.conf


; ;SIPconfigurationforAsterisk ; [general] disallow=all allow=ulaw port=5060 ;theSIPportwhichhastobebind(attach). bindaddr=0.0.0.0 ;AddressintheSIPbind externip=xxx.xxx.xxx.xxx ;ifweknowthepublicIPaddressthatweuse localnet=192.168.0.0 localmask=255.255.255.0 context=inboundsip ;Defaultcontextforincomingcalls maxexpirey=180 defaultexpirey=160 tos=reliability srvlookup=yes ;IMPORTANT!RegistrationtoSIPServer register=>2012345:abcdef@voiprakyat.or.id/2012345 register=>2055555:123456@voiprakyat.or.id/2055555

;username2012345passwordabcdef ;username2055555passwd123456

;WeneedtoestablishaSIPaccountinourplaceinordertoreceivecallsfrom ;voiprakyatthroughourPABX ; [fwd1] type=friend secret=secret username=2055555 fromuser=2055555 fromdomain=voiprakyat.or.id host=voiprakyat.or.id dtmfmode=inband nat=yes canreinvite=no

VoIPCookbook:334

[fwd2] type=friend secret=secret username=2012345 fromuser=2012345 fromdomain=voiprakyat.or.id host=voiprakyat.or.id dtmfmode=inband nat=yes canreinvite=no ;ThefollowingisaSIPaccountforIPphoneinhouse/office ; [phone17] disallow=all allow=ulaw type=friend host=dynamic defaultip=192.168.0.17 dtmfmode=inband secret=voip17 mailbox=2206 context=home callerid="BillMandra"<2206> nat=no [phone18] disallow=all allow=ulaw type=friend host=dynamic defaultip=192.168.0.18 dtmfmode=inband secret=voip18 mailbox=2204 context=home callerid="Kitchen"<2204> VoIPCookbook:335

nat=no extensions.conf ; ;Staticextensionfileconfigurationusedbypbx_configmodule ;InthismoduleweconfigureallincomingcallsandoutgoingcallsinAsterisk ; [general] static=yes writeprotect=no [globals] DIALOUTANALOG=Zap/1 MAINPHONE=Zap/2 JESSICA=Zap/3 CHRISTOPHER=Zap/4 PORCH=Zap/5 KITCHEN=SIP/phone18 BILL=SIP/phone17 ; ;ForthisexamplethecardusedisZAPTEL ;WecanreplaceZap/1,Zap/2,Zap/3s/dZap/5 ;withSIPaccountinAsteriskforIPPhoneorWiFiPhone ;forexampleSIP/2000toIPPhonewithextension2000etc. FWDUSERID1=2012345 FWD1USERNAME=WilliamMandra FWDUSERID2=2055555 FWD2USERNAME=BujubunengMandra FWDPREFIX=* HOMENUMBER=4208888 BILLCELLPHONE=0811888888 MOMCELLPHONE=0811999999 JESSCELLPHONE=0813222222 ; ;MacroforAsteriskExtension VoIPCookbook:336

; [macrofastbusy] exten=>s,1,Answer exten=>s,2,Wait,1 exten=>s,3,Playback(ssnoservice) exten=>s,4,Wait(30) exten=>s,5,Hangup [macrodialoutsip] exten=>s,1,SetCallerID(${FWDUSERID2}) exten=>s,2,SetCIDName(${FWD2USERNAME}) exten=>s,3,Dial(SIP/${FWDPREFIX}${ARG1}@fwd1,70) exten=>s,4,Macro(fastbusy) exten=>s,5,Hangup exten=>s,104,Macro(fastbusy) exten=>s,105,Wait,3 exten=>s,106,Playtones(congestion) exten=>s,107,Wait,30 exten=>s,108,Hangup [macrobillcellfwdoutsip2] exten=>s,1,SetCallerID(${ARG2}) exten=>s,2,Dial(SIP/${FWDPREFIX}${ARG1}@fwd2,20) exten=>s,3,Goto(local,2206,4) exten=>s,102,Goto(local,2206,4) ; ;Outbound ; ; [operator] exten=>0,1,Dial(${DIALOUTANALOG}/${EXTEN},70) exten=>0,2,Macro(fastbusy) exten=>0,102,Playback(ssnoservice) exten=>0,103,Macro(fastbusy) [e911] exten=>911,1,Dial(${DIALOUTANALOG}/${EXTEN}) exten=>911,2,Macro(fastbusy) VoIPCookbook:337

exten=>911,102,Playback(ssnoservice) exten=>911,103,Macro(fastbusy) [forcedanalog] exten=>_9.,1,Dial(${DIALOUTANALOG}/${EXTEN:1},70) exten=>_9.,2,Macro(fastbusy) exten=>_9.,102,Macro(fastbusy) [fwd1out] exten=>_8.,1,SetCallerID(${FWDUSERID2}) exten=>_8.,2,SetCIDName(${FWD2USERNAME}) exten=>_8.,3,Dial(SIP/${EXTEN:1}@fwd1,70) exten=>_8.,4,Macro(fastbusy) exten=>_8.,5,Hangup [fwd2outpvt] exten=>_7.,1,SetCallerID(${FWDUSERID1}) exten=>_7.,2,SetCIDName(${FWD1USERNAME}) exten=>_7.,3,Dial(SIP/${EXTEN:1}@fwd2,70) exten=>_7.,4,Macro(fastbusy) exten=>_7.,5,Hangup [information] exten=>108,1,Dial(${DIALOUTANALOG}/${EXTEN},70) exten=>108,2,Macro(fastbusy) exten=>108,102,Playback(ssnoservice) exten=>108,103,Macro(fastbusy) ;LocalPSTN ; [pstnlocal] exten=>_021.,1,Dial(${DIALOUTANALOG}/${EXTEN:3}) exten=>_021.,2,Macro(fastbusy) exten=>_021.,102,Macro(dialoutsip,${EXTEN}) [tollfree] exten=>_0800.,1,Dial(${DIALOUTANALOG}/${EXTEN}) exten=>_0800.,2,Macro(fastbusy) exten=>_0800.,102,Macro(dialoutsip,${EXTEN}) VoIPCookbook:338

[longdistance] exten=>_0XXXXXXXXXX,1,Macro(dialoutsip,${EXTEN}) exten=>_0XXXXXXXXXX,2,Macro(fastbusy) exten=>_0XXXXXXXXXX,102,Dial(${DIALOUTANALOG}/${EXTEN}) exten=>_0XXXXXXXXXX,103,Macro(fastbusy) [home] include=>operator include=>e911 include=>forcedanalog include=>fwd1out include=>fwd2outpvt include=>information include=>local include=>pstnlocal include=>tollfree include=>longdistance ; ;Inbound ;analogline [nighttimeanalog] exten=>s,1,Wait(2) exten=>s,2,Background(nighttime) exten=>1,1,Goto(daytimeanalog,s,1) exten=>2,1,Voicemail(u2201) exten=>3,1,Voicemail(u2206) exten=>4,1,Voicemail(u2202) exten=>9,1,Playback(transfer) exten=>9,2,Ringing(1) exten=>9,3,Goto(local,2206,1) [daytimeanalog] exten=>s,1,Zapateller(answer|nocallerid) exten=>s,2,PrivacyManager exten=>s,3,Ringing(1) exten=>s,4,Dial(${MAINPHONE}&${KITCHEN},15) VoIPCookbook:339

exten=>s,5,Dial(${JESSICA},6) exten=>s,6,Dial(${BILL},6) exten=>s,7,Voicemail(u2201) exten=>s,8,Hangup [inboundanalog] include=>daytimeanalog|9:0021:00|*|* include=>nighttimeanalog|21:0009:00|*|* ;siplines ; [nighttimefwd1] exten=>s,1,Wait(2) exten=>s,2,Background(nighttime) exten=>1,1,Goto(daytimesip1,s,1) exten=>2,1,Voicemail(u2201) exten=>3,1,Voicemail(u2206) exten=>4,1,Voicemail(u2202) exten=>9,1,Playback(transfer) exten=>9,2,Goto(local,2206,1) [daytimefwd1] exten=>s,1,Dial(${MAINPHONE}&${KITCHEN},15) exten=>s,2,Dial(${JESSICA},6) exten=>s,3,Dial(${BILL},6) exten=>s,4,Voicemail(u2201) exten=>s,5,Hangup [inboundfwd1] include=>daytimefwd1|9:0021:00|*|* include=>nighttimefwd1|21:009:00|*|* [inboundsip] exten=>2055555,1,Goto(inboundfwd1,s,1) exten=>2012345,1,Goto(local,2206,1) ; ;InternalExtension VoIPCookbook:340

; [local] exten=>2201,1,Dial(${MAINPHONE},20,Tt) exten=>2201,2,Voicemail(u2201) exten=>2201,3,Hangup exten=>2201,102,Voicemail(b2201) exten=>2201,103,Hangup exten=>2202,1,Dial(${JESSICA},20,Tt) exten=>2202,2,Voicemail(u2202) exten=>2202,3,Hangup exten=>2202,102,Voicemail(b2202) exten=>2202,103,Hangup exten=>2203,1,Dial(${CHRISTOPHER},20,Tt) exten=>2203,2,Playback(vmnobodyavail) exten=>2203,3,Hangup exten=>2204,1,Dial(${KITCHEN},20,Tt) exten=>2204,2,Playback(vmnobodyavail) exten=>2204,3,Hangup exten=>2205,1,Dial(${PORCH},20,Tt) exten=>2205,2,Playback(vmnobodyavail) exten=>2205,3,Hangup exten=>2206,1,Dial(${BILL},20,Tt) exten=>2206,2,Playback(transfer) exten=>2206,3,Macro(billcellfwdoutsip2,${BILLCELLPHONE},${CALLERIDNUM}) exten=>2206,4,Voicemail(u2206) exten=>2206,5,Hangup exten=>2206,102,Voicemail(b2206) exten=>2206,103,Hangup exten=>2500,1,Wait,2 exten=>2500,2,VoicemailMain exten=>2500,3,Hangup ; ;Avarietyoffacilitiesthatcanbeusedfortesting VoIPCookbook:341

; exten=>2001,1,Answer exten=>2001,2,Playback(demoechotest) exten=>2001,3,Echo exten=>2001,4,Playback(demoechodone) exten=>2001,5,Hangup exten=>2002,1,Answer exten=>2002,2,WaitMusicOnHold(30) exten=>2002,3,Hangup exten=>2003,1,Answer exten=>2003,2,Wait(1) exten=>2003,3,SayUnixTime(||k) exten=>2003,4,SayUnixTime(||M) exten=>2003,5,Playback(vmand) exten=>2003,6,SayUnixTime(||S) exten=>2003,7,Wait(2) exten=>2003,8,Hangup exten=>2004,1,Answer exten=>2004,2,Wait(1) exten=>2004,3,Playback(vmextension) exten=>2004,4,SayDigits(${CALLERIDNUM}) exten=>2004,5,Wait(2) exten=>2004,6,Hangup exten=>2005,1,Goto(nighttimeanalog,s,1) ;exten=>2005,2,Playback(ssnoservice) ;exten=>2005,3,Playback(vmnobodyavail) ;exten=>2005,4,Playback(agentincorrect) ;exten=>2005,5,Playback(agentuser) ;exten=>2005,6,Playback(pbxinvalid) ;exten=>2005,7,Playback(ttsomethingwrong) ;exten=>2005,8,Playback(vmextension) ;exten=>2005,9,Playback(vmisunavail) ;exten=>2005,10,Playback(vmisonphone) ;exten=>2005,11,Playback(vmsorry) VoIPCookbook:342

exten=>2005,2,Hangup

VoIPCookbook:343

APPENDIX B: SIPp COMMANDS


Usage: sippremote_host[:remote_port][options] Availableoptions: v aa auth_uri :Displayversionandcopyrightinformation. :Enableautomatic200OKanswerforINFO,UPDATEandNOTIFYmessages. :ForcethevalueoftheURIforauthentication. Bydefault,theURIiscomposedofremote_ip:remote_port. base_cseq :Startvalueof[cseq]foreachcall. bg :LaunchSIPpinbackgroundmode. bind_local :BindsockettolocalIPaddress,i.e.thelocalIPaddressisusedasthesourceIP address.IfSIPprunsinservermodeitwillonlylistenonthelocalIPaddress insteadofallIPaddresses. buff_size :Setthesendandreceivebuffersize. calldebug_file:Setthenameofthecalldebugfile. calldebug_overwrite:Overwritethecalldebugfile(defaulttrue). cid_str :CallIDstring(default%u%p@%s).%u=call_number, %s=ip_address,%p=process_number,%%=%(inanyorder). ci :SetthelocalcontrolIPaddress cp :Setthelocalcontrolportnumber.Defaultis8888. d :Controlsthelengthofcalls.Moreprecisely,thiscontrolsthedurationof'pause' instructionsinthescenario,iftheydonothavea'milliseconds'section. Defaultvalueis0anddefaultunitismilliseconds. deadcall_wait:HowlongtheCallIDandfinalstatusofcallsshouldbekepttoimprovemessage anderrorlogs(defaultunitisms). default_behaviors:SetthedefaultbehaviorsthatSIPpwilluse.Possbilevaluesare: all Usealldefaultbehaviors none Usenodefaultbehaviors bye Sendbyesforabortedcalls abortunexp Abortcallsonunexpectedmessages pingreply Replytopingrequests Ifabehaviorisprefacedwitha,thenitisturnedoff.Example:all,bye error_file :Setthenameoftheerrorlogfile. error_overwrite:Overwritetheerrorlogfile(defaulttrue). VoIPCookbook:344

f fd i

:Setthestatisticsreportfrequencyonscreen.Defaultis1anddefaultunitisseconds. :Setthestatisticsdumplogreportfrequency.Defaultis60anddefaultunitisseconds. :SetthelocalIPaddressfor'Contact:','Via:',and'From:'headers. DefaultisprimaryhostIPaddress. inf :InjectvaluesfromanexternalCSVfileduringcallsintothescenarios. Firstlineofthisfilesaywhetherthedataistobereadinsequence(SEQUENTIAL), random(RANDOM),oruser(USER)order. Eachlinecorrespondstoonecallandhasoneormore';'delimiteddatafields. Thosefieldscanbereferredas[field0],[field1],...inthexmlscenariofile. SeveralCSVfilescanbeusedsimultaneously(syntax:inff1.csvinff2.csv...) infindex :filefield Createanindexoffileusingfield.Forexampleinfusers.csvinfindexusers.csv0 createsanindexonthefirstkey. ip_field :SetwhichfieldfromtheinjectionfilecontainstheIPaddressfromwhichtheclient willsenditsmessages.Ifthisoptionisomittedandthe'tui'optionispresent, thenfield0isassumed.Usethisoptiontogetherwith'tui' l :Setthemaximumnumberofsimultaneouscalls.Oncethislimitisreached, trafficisdecreaseduntilthenumberofopencallsgoesdown. Default:(3*call_duration(s)*rate). log_file :Setthenameofthelogactionslogfile. log_overwrite:Overwritethelogactionslogfile(defaulttrue). lost :Setthenumberofpacketstolosebydefault (scenariospecificationsoverridethisvalue). rtcheck :Selecttheretransmisisondetectionmethod:full(default)orloose. m :Stopthetestandexitwhen'calls'callsareprocessed mi :SetthelocalmediaIPaddress(default:localprimaryhostIPaddress) master :3pccextendedmode:indicatesthemasternumber max_recv_loops:Setthemaximumnumberofmessagesreceivedreadpercycle. Increasethisvalueforhightrafficlevel.Thedefaultvalueis1000. max_sched_loops:Setthemaximumnumberofcalslrunpereventloop. Increasethisvalueforhightrafficlevel.Thedefaultvalueis1000. max_reconnect:Setthethemaximumnumberofreconnection. max_retrans :MaximumnumberofUDPretransmissionsbeforecallendsontimeout. Defaultis5forINVITEtransactionsand7forothers. max_invite_retrans:MaximumnumberofUDPretransmissionsforinvitetransactions beforecallendsontimeout. max_non_invite_retrans:MaximumnumberofUDPretransmissionsfornoninvitetransactions beforecallendsontimeout. VoIPCookbook:345

max_log_size:Whatisthelimitforerrorandmessagelogfilesizes. max_socket :Setthemaxnumberofsocketstoopensimultaneously.Thisoptionissignificant ifyouuseonesocketpercall.Oncethislimitisreached, trafficisdistributedoverthesocketsalreadyopened.Defaultvalueis50000 mb :SettheRTPechobuffersize(default:2048). message_file:Setthenameofthemessagelogfile. message_overwrite:Overwritethemessagelogfile(defaulttrue). mp :SetthelocalRTPechoportnumber.Defaultis6000. nd :NoDefault.DisablealldefaultbehaviorofSIPpwhicharethefollowing: OnUDPretransmissiontimeout,abortthecallbysendingaBYEoraCANCEL Onreceivetimeoutwithnoontimeoutattribute,abortthecallbysendingaBYE oraCANCEL OnunexpectedBYEsenda200OKandclosethecall OnunexpectedCANCELsenda200OKandclosethecall OnunexpectedPINGsenda200OKandcontinuethecall Onanyotherunexpectedmessage,abortthecallbysendingaBYEora CANCEL nr :DisableretransmissioninUDPmode. nostdin :Disablestdin. p :Setthelocalportnumber.Defaultisarandomfreeportchosenbythesystem. pause_msg_ign:Ignorethemessagesreceivedduringapausedefinedinthescenario periodic_rtd :Resetresponsetimepartitioncounterseachlogginginterval. plugin :Loadaplugin. r :Setthecallrate(incallsperseconds).Thisvaluecanbechangedduringtest bypressing'+','_','*'or'/'.Defaultis10. pressing'+'keytoincreasecallrateby1*rate_scale, pressing''keytodecreasecallrateby1*rate_scale, pressing'*'keytoincreasecallrateby10*rate_scale, pressing'/'keytodecreasecallrateby10*rate_scale. Iftherpoptionisused,thecallrateiscalculatedwiththeperiodinms givenbytheuser. rp :Specifytherateperiodforthecallrate.Defaultis1secondanddefaultunit ismilliseconds.Thisallowsyoutohavencallseverymmilliseconds (byusingrnrpm). Example: r7rp2000==>7callsevery2seconds. r10rp5s=>10callsevery5seconds. rate_scale :Controltheunitsforthe'+','','*',and'/'keys. rate_increase:Specifytherateincreaseeveryfdunits(defaultisseconds). Thisallowsyoutoincreasetheloadforeachindependentloggingperiod. VoIPCookbook:346

Example:rate_increase10fd10s==>increasecallsby10every10seconds. rate_max :Ifrate_increaseisset,thenquitaftertheratereachesthisvalue. Example:rate_increase10rate_max100==>increasecallsby10until100cpsishit. no_rate_quit:Ifrate_increaseisset,donotquitaftertheratereachesrate_max. recv_timeout:Globalreceivetimeout.Defaultunitismilliseconds.Iftheexpectedmessageisnot received,thecalltimesoutandisaborted. send_timeout:Globalsendtimeout.Defaultunitismilliseconds.Ifamessageisnotsent (duetocongestion),thecalltimesoutandisaborted. sleep :Howlongtosleepforatstartup.Defaultunitisseconds. reconnect_close:Shouldcallsbeclosedonreconnect? reconnect_sleep:Howlong(inmilliseconds)tosleepbetweenthecloseandreconnect? ringbuffer_files:Howmanyerror/messagefilesshouldbekeptafterrotation? ringbuffer_size:Howlargeshoulderror/messagefilesbebeforetheygetrotated? rsa :Settheremotesendingaddresstohost:portforsendingthemessages. rtp_echo :EnableRTPecho.RTP/UDPpacketsreceivedonportdefined bympareechoedtotheirsender.RTP/UDPpacketscomingon thisport+2arealsoechoedtotheirsender(usedforsoundandvideoecho). rtt_freq :freqismandatory.Dumpresponsetimeseveryfreqcallsinthelogfiledefined bytrace_rtt.Defaultvalueis200. s :SettheusernamepartoftheresquestURI.Defaultis'service'. sd :Dumpsadefaultscenario(embededinthesippexecutable) sf :Loadsanalternatexmlscenariofile.TolearnmoreaboutXMLscenariosyntax, usethesdoptiontodumpembeddedscenarios.Theycontainallthenecessaryhelp. shortmessage_file:Setthenameoftheshortmessagelogfile. shortmessage_overwrite:Overwritetheshortmessagelogfile(defaulttrue). oocsf :Loadoutofcallscenario. oocsn :Loadoutofcallscenario. skip_rlimit :Donotperformrlimittuningoffiledescriptorlimits. Default:false. slave :3pccextendedmode:indicatestheslavenumber slave_cfg :3pccextendedmode:indicatesthefilewherethemasterandslaveaddressesarestored sn :Useadefaultscenario(embeddedinthesippexecutable). Ifthisoptionisomitted,theStandardSipStoneUACscenarioisloaded. Availablevaluesinthisversion: 'uac':StandardSipStoneUAC(default). 'uas':SimpleUASresponder. 'regexp':StandardSipStoneUACwithregexpandvariables. 'branchc':Branchingandconditionalbranchinginscenariosclient. 'branchs':Branchingandconditionalbranchinginscenariosserver. VoIPCookbook:347

Default3pccscenarios(see3pccoption): '3pccCA':ControllerAside(mustbestartedafterallother3pccscenarios) '3pccCB':ControllerBside. '3pccA':Aside. '3pccB':Bside. stat_delimiter:Setthedelimiterforthestatisticsfile stf :Setthefilenametousetodumpstatistics t :Setthetransportmode: u1:UDPwithonesocket(default), un:UDPwithonesocketpercall, ui:UDPwithonesocketperIPaddress. TheIPaddressesmustbedefinedintheinjectionfile. t1:TCPwithonesocket, tn:TCPwithonesocketpercall, l1:TLSwithonesocket, ln:TLSwithonesocketpercall, c1:u1+compression(onlyifcompressionpluginloaded), cn:un+compression(onlyifcompressionpluginloaded). Thispluginisnotprovidedwithsipp. timeout :Globaltimeout.Defaultunitisseconds.Ifthisoptionisset,SIPpquitsafter nbunits(timeout20squitsafter20seconds). timeout_error:SIPpfailsiftheglobaltimeoutisreachedisset(timeoutoptionrequired). timer_resol:Setthetimerresolution.Defaultunitismilliseconds.Thisoptionhasanimpact ontimersprecision.SmallvaluesallowmorepreciseschedulingbutimpactsCPU usage.Ifthecompressionison,thevalueissetto50ms.Thedefaultvalueis10ms. sendbuffer_warn:ProducewarningsinsteadoferrorsonSendBufferfailures. trace_msg :DisplayssentandreceivedSIPmessagesin<scenariofilename>_<pid>_messages.log trace_shortmsg:DisplayssentandreceivedSIPmessagesasCSV in<scenariofilename>_<pid>_shortmessages.log trace_screen:Dumpstatisticscreensinthe<scenario_name>_<pid>_cenaris.logfile whenquittingSIPp.Usefultogetafinalstatusreportinbackgroundmode(bgoption). trace_err :Traceallunexpectedmessagesin<scenariofilename>_<pid>_errors.log. trace_calldebug:Dumpsdebugginginformationaboutabortedcallsto <scenario_name>_<pid>_calldebug.logfile. trace_stat :Dumpsallstatisticsin<scenario_name>_<pid>.csvfile. Usethe'hstat'optionforadetaileddescriptionofthestatisticsfilecontent. trace_counts:DumpsindividualmessagecountsinaCSVfile. trace_rtt :Allowtracingofallresponsetimesin<scenariofilename>_<pid>_rtt.csv. trace_logs :Allowtracingof<log>actionsin<scenariofilename>_<pid>_logs.log. VoIPCookbook:348

users

:Insteadofstartingcallsatafixedrate,begin'users'callsatstartup,and keepthenumberofcallsconstant. watchdog_interval:Setgapbetweenwatchdogtimerfirings.Defaultis400. watchdog_reset:Ifthewatchdogtimerhasnotfiredinmorethanthistimeperiod, thenresetthemaxtriggerscounters.Defaultis10minutes. watchdog_minor_threshold:Ifithasbeenlongerthanthisperiodbetweenwatchdog executionscountaminortrip.Defaultis500. watchdog_major_threshold:Ifithasbeenlongerthanthisperiodbetweenwatchdog executionscountamajortrip.Defaultis3000. watchdog_major_maxtriggers:Howmanytimesthemajorwatchdogtimercanbetripped beforethetestisterminated.Defaultis10. watchdog_minor_maxtriggers:Howmanytimestheminorwatchdogtimercanbetripped beforethetestisterminated.Defaultis120. ap :Setthepasswordforauthenticationchallenges.Defaultis'password tls_cert :SetthenameforTLSCertificatefile.Defaultis'cacert.pem tls_key:SetthenameforTLSPrivateKeyfile.Defaultis'cakey.pem' tls_crl :SetthenameforCertificateRevocationListfile. Ifnotspecified,X509CRLisnotactivated. 3pcc :Launchthetoolin3pccmode("ThirdPartycallcontrol"). Thepassedipaddressisdependingonthe3PCCrole. Whenthefirsttwincommandis'sendCmd'thenthisis theaddressoftheremotetwinsocket.SIPpwilltryto connecttothisaddress:porttosendthetwincommand (Thisinstancemustbestartedafterallother3PCCscenario). Example:3PCCCAscenario. Whenthefirsttwincommandis'recvCmd'thenthisis theaddressofthelocaltwinsocket.SIPpwillopen thisaddress:porttolistenfortwincommand. Example:3PCCCBscenario. tdmmap :GenerateandhandleatableofTDMcircuits. Acircuitmustbeavailableforthecalltobeplaced. Format:tdmmap{03}{99}{58}{131} key :keywordvalue Setthegenericparameternamed"keyword"to"value". set :variablevalue Settheglobalvariableparameternamed"variable"to"value". dynamicStart:variablevalue Setthestartoffsetofdynamic_idvaraiable dynamicMax:variablevalue.Setthemaximumofdynamic_idvariable VoIPCookbook:349

dynamicStep:variablevalue.Settheincrementofdynamic_idvariable Signalhandling: SIPpcanbecontrolledusingposixsignals.Thefollowingsignalsarehandled: USR1:Similartopress'q'keyboardkey.IttriggersasoftexitofSIPp. NomorenewcallsareplacedandallongoingcallsarefinishedbeforeSIPpexits. Example:killSIGUSR1732 USR2:Triggersadumpofallstatisticsscreensin<scenario_name>_<pid>_screens.logfile. Especiallyusefulinbackgroundmodetoknowwhatthecurrentstatusis. Example:killSIGUSR2732 Exitcode: Uponexit(onfatalerrororwhenthenumberofaskedcalls(moption)isreached, sippexitswithoneofthefollowingexitcode: 0:Allcallsweresuccessful 1:Atleastonecallfailed 97:exitoninternalcommand.Callsmayhavebeenprocessed 99:Normalexitwithoutcallsprocessed 1:Fatalerror Example: Runsippwithembeddedserver(uas)scenario: ./sippsnuas Onthesamehost,runsippwithembeddedclient(uac)scenario ./sippsnuac127.0.0.1

VoIPCookbook:350

APPENDIX C: File /usr/local/etc/opensips/cfg-test-uas.cfg


#globalconfigurationparameters debug=3#debuglevel(cmdline:dddddddddd) fork=yes log_stderror=no#(cmdline:E) children=8 disable_tcp=yes disable_dns_blacklist=yes disable_dns_failover=yes #Uncommenttheselinestoenterdebuggingmode #fork=no #log_stderror=yes #listen=udp:192.168.2.102:5070 #listen=192.168.0.2:5060 #moduleloading #setmodulepath #mpath="/usr/local/lib/openser/modules/" #mpath="/usr/lib/opensips/modules/" mpath="/usr/local/lib/opensips/modules/" loadmodule"sl.so" #requestroutinglogic #mainroutinglogic route{ sl_send_reply("200","OK"); }

VoIPCookbook:351

Вам также может понравиться