6. VoIP Service Configuration Scenario - Sipwise

文章推薦指數: 80 %
投票人數:10人

Enter your SIP domain name and press Save. Adjust the new SIP domain's preferences if necessary. You can create multiple SIP domains reusing the existing IP ... PrevHomeNext6. VoIPServiceConfigurationScenarioAbasicVoIPserviceconfigurationisfast,easyandstraight-forward.ProvidedthatyournetworkandrequiredDNSrecordshavebeenpreconfigured,theconfigurationofaVoIPservicecanbedonepurelyviatheadministrativewebinterface.Theconfigurationmainlyincludesthefollowingsteps: Resellercreation(optional) SIPdomainconfiguration Customercreation Subscribersprovisioning Letusassumeyouareusingthe1.2.3.4IPaddresswithanassociatedsip.yourdomain.comdomaintoprovisionVoIPservices.Thisallowsyoutoprovideaneasy-to-rememberdomainnameinsteadoftheIPaddressastheproxyserver.Also,yoursubscribers'URIswilllooklike1234567@sip.yourdomain.com.tipUsinganIPaddressinsteadofanassociatedFQDN(domainname)foraSIPdomainisnotsuggestedasitcouldaddextraadministrativeworkifyoudecidetorelocateyourserverstoanotherdatacenterorjustchangeIPaddresses.GototheAdministrativeWebPanel(AdminPanel)runningonhttps://:1443/login/adminandfollowthestepsbelow.Thedefaultwebpaneluserandpasswordareadministrator,ifyouhavenotalreadychangeditinChangingAdministratorPassword.6.1. CreatingaSIPDomainASIPdomainisaconnectionpointforyoursubscribers.TheSIPdomainalso containsspecificdefaultconfigurationforallitssubscribers.tipThoroughlyplanyourdomainnamespolicyinadvanceandtakeintoaccount that:1)thenameofaSIPdomaincannotbechangedaftercreatingitinthe administrativewebpanel;2)subscriberscannotbemovedfromonedomainto anotherandmustberecreated.TocreateaSIPdomain,followthesesteps: Firstly,configureanFQDNonyourDNSserverforit. ThedomainnamemustpointtothephysicalIPaddressyouaregoingtousefor providingtheVoIPservice.AgoodapproachistocreateanSRVrecord:SIPviaUDPonport5060 SIPviaTCPonport5060 SIPviaTCP/TLSonport5061 CreateanewSIPdomainintheadministrativewebpanel. GototheDomainspageandcreateanewSIPDomainusingtheFQDNcreatedabove.SelectaResellerwhowillownthesubscribersinthisSIPdomain.Usethe defaultvirtualresellerifyouprovideservicesdirectly.Enteryour SIPdomainnameandpressSave. AdjustthenewSIPdomain’spreferencesifnecessary. YoucancreatemultipleSIPdomainsreusingtheexistingIPaddressoraddinga newone.ExtraSIPdomainsarerequirede.g.ifyouwouldliketohostavirtual operatoronyourplatform,createseparatedomainsforprovidingservicesindifferent countriesorjustofferanewservice.6.2. CreatingaCustomerACustomerisaspecialtypeofcontractactingaslegalandbillinginformation containerforSIPsubscribers.AcustomercanhaveoneormoreSIPsubscriber entitiesthatrepresentSIPlines.tipForcorrectbilling,notificationandinvoicing,createacustomerwith asingleSIPsubscriberfortheresidentialservice(asitnormallyhasonly onetelephoneline)andacustomerwithmultipleSIPsubscriberstoprovide aservicetoacompanywithmanytelephonelines.TocreateaCustomer,gotoSettings→Customers.ClickonCreateCustomer.EachCustomerhasaContact — acontainerforthepersonalandlegalinformationthatidentifiesaprivateorcorporatecustomer.tipCreateadedicatedContactforeveryCustomerasitcontainsspecificdatae.g.name,addressandIBANthatidentifiesthiscustomer.ClickonCreateContacttocreateanewContact.SelecttherequiredResellerandenterthecontactdetails(atleastan Emailisrequired),thenpressSave.YouwillberedirectedbacktotheCustomerform.ThenewlycreatedContactisselectedbydefaultnow, soonlyselectaBillingProfileandpressSave.YouwillnowseeyourfirstCustomerinthelist.HoveroverthecustomerandclickDetailstomakeextraconfigurationifnecessary.6.3. CreatingaSubscriberInyourCustomerdetailsview,clickontheSubscribersrow,thenclickCreateSubscriber.SelectaSIPDomaincreatedearlierandspecifyrequiredandoptionalparameters: Domain:ThedomainpartoftheSIPURIforyoursubscriber. E164Number:Thisisthetelephonenumbermappedtothesubscriber,separatedintoCountryCode(CC),AreaCode(AC)andSubscriberNumber(SN).Forthefirsttests,youcansetanimaginarynumberhereandchangeitlaterwhenyougetnumberblocksassignedbyyourPSTNinterconnectpartner.Soinourexample,we’lluse43asCC,99asACand1001asSNtoformtheimaginarynumber+43991001. tipThisnumbercanactuallybeusedtoplacecallsbetweenlocalsubscribers,evenifyoudon’thaveanyPSTNinterconnection.Thiscomesinhandyifyouusephonesinsteadofsoft-clientsforyourtests.Theformatinwhichthisnumbercanbedialled,sothesubscriberisreachedisdefinedinSection 6.7,“ConfiguringRewriteRuleSets”.importantSipwiseC5allowsasinglesubscribertohavemultipleE.164numberstobeusedasaliasesforreceivingincomingcalls.Also, SipwiseC5supportsso-called"implicit"extensions.Ifasubscriberhasphonenumber012345,butsomebodycalls012345100,thenNGCP firsttriestosendthecalltonumber012345100(eventhoughtheuserisregisteredas012345).IfSipwiseC5thenreceivesthe 404-NotFoundresponse,itfallsbackto012345(theuser-partwithwhichthecalleeisregistered). Email:Anemailaddressforsendingservice-relatednotificationsto. WebUsername:ThisistheuserpartoftheusernamethesubscribermayusetologintoherCustomerSelfCareInterface.TheuserpartwillbeautomaticallysuffixedbytheSIPdomainyouchoosefortheSIPURI.Usually,thewebusernameisidenticaltotheSIPURI,butyoumaychooseadifferentnamingschema. cautionThewebusernameneedstobeunique.Thesystemwillreturnafaultifyoutrytousethesamewebusernametwice. WebPassword:ThisisthepasswordforthesubscribertologintoherCustomerSelfCareInterface.Itmustbeatleast6characterslong. SIPUsername:TheuserpartoftheSIPURIforyoursubscriber. SIPPassword:ThepasswordofyoursubscribertoauthenticateontheSIPproxy.Itmustbeatleast6characterslong. Status:Youcanlockasubscriberhere,butforcreatingone,youwillmostcertainlywanttousetheactivestatus. ExternalID:Youcanprovisionanarbitrarystringhere(e.g.anIDofa3rdpartyprovisioning/billingsystem). Administrative:Ifyouhavemultiplesubscribersinoneaccountandsetthisoptionforoneofthem,thissubscribercanadministrateothersubscribersviatheCustomerSelfCareInterface. RepeatthecreationofCustomersandSubscribersforallyourtestaccounts.Youshouldhaveatleast3subscriberstotestthefunctionalityoftheNGCP.tipAtthispoint,you’reabletoregisteryoursubscriberstoSipwiseC5andplacecallsbetweenthesesubscribers.YoushouldnowrevisetheDomainandSubscriberPreferences.6.4. DomainPreferencesTheDomainPreferencesarethedefaultsettingsforSubscriberPreferences,soyoushouldsetproper valuesthereifyoudon’twanttoconfigureeachsubscriberseparately.YoucanlateroverridethesesettingsintheSubscriberPreferencesifparticularsubscribersneedspecialsettings. ToconfigureyourDomainPreferences,gotoSettings→DomainsandclickonthePreferencesbutton ofthedomainyouwanttoconfigure.ThemostimportantsettingsareintheNumberManipulationsgroup.Hereyoucanconfigurethefollowing: forincomingcalls-whichSIPmessageheaderstotakenumbersfrom foroutgoingcalls-whereintheSIPmessagestoputcertainnumbersto forboth-howthesenumbersarenormalizedtoE164formatandviceversa ToassignaRewriteRuleSettoaDomain,createasetfirstasdescribedinSection 6.7,“ConfiguringRewriteRuleSets”,thenassign ittothedomainbyeditingtherewrite_rule_setpreference.SelecttheRewriteRuleSetandpressSave.Then,selectthefieldyouwanttheUserProvidedNumbertobetakenfromforinboundINVITEmessages.Usually theFrom-Usernameshouldbefine,butyoucanalsotakeitfromtheDisplay-NameoftheFrom-Header,and otheroptionsareavailableaswell.6.5. SubscriberPreferencesYoucanoverridetheDomainPreferencesonasubscriberbasisaswell.Also,thereareSubscriberPreferenceswhichdon’thaveadefaultvalueintheDomainPreferences.ToconfigureyourSubscriber,gotoSettings→SubscribersandclickDetailsontherowofyour subscriber.There,clickonthePreferencesbuttonontop.YouwanttolookintotheNumberManipulationsandAccessRestrictionsoptionsinparticular,whichcontrolwhatisusedasuser-providedandnetwork-providedcallingnumbers. Foroutgoingcalls,youmaydefinemultiplenumbersorpatternstocontrolwhatasubscriberisallowedtosendasuser-providedcallingnumbersusingtheallowed_clispreference. Ifallowed_clisdoesnotmatchthenumbersentbythesubscriber,thenthenumberconfiguredincli(thenetwork-providednumber)preferencewillbeusedasuser-providedcallingnumberinstead. Youcanoverrideanyuser-providednumbercomingfromthesubscriberusingtheuser_clipreference. infoSubscriberspreferenceallowed_cliswillbesynchronizedwithsubscribersprimarynumberandaliasesifossbss→provisioning→auto_allow_cliissetto1in/etc/ngcp-config/config.yml.infoSubscriberspreferencecliwillbesynchronizedwithsubscribersprimarynumberifossbss→provisioning→auto_sync_cliissettoyesin/etc/ngcp-config/config.yml.6.6. CreatingPeeringsIfyouwanttoterminatecallsatorallowcallsfrom3rdpartysystems(e.g.PSTNgateways,SIPtrunks),youneedtocreateSIPpeeringsforthat.Todoso,gotoSettings→Peerings.Thereyoucanaddpeeringgroups,andforeachpeeringgroupaddpeeringserversandrulescontrollingwhichcallsareroutedoverthesegroups.Everypeeringgroupneedsapeeringcontractforcorrectinterconnectionbilling.6.6.1. CreatingPeeringGroupsClickonCreatePeeringGrouptocreateanewgroup.Inordertocreateagroup,youmustselectapeeringcontract.Youwillmostlikelywanttocreateonecontract perpeeringgroup.ClickonCreateContractcreateaContact,thenselectaBillingProfile.ClickSaveontheContactsform,andyouwillgetredirectedbacktotheformforcreatingtheactual PeeringGroup.Putaname,priorityanddescriptionthere,forexample: PeeringContract:selecttheidofthecontractcreatedbefore Name:testgroup Priority:1 Description:peeringtoatestcarrier ThePriorityoptiondefineswhichPeeringGrouptofavor(Priority1 givesthehighestprecedence)iftwopeeringgroupshavepeeringrulesmatching anoutboundcall.PeeringRulesaredescribedbelow.ThenclickSavetocreatethegroup.6.6.2. CreatingPeeringServersInthegroupcreatedbefore,youneedtoaddpeeringserverstoroutecallstoandreceivecallsfrom.Todoso,clickonDetailsontherowofyournewgroupinyourpeeringgrouplist.ToaddyourfirstPeeringServer,clickontheCreatePeeringServerbutton.Figure 9. CreatePeeringServerInthisexample,wewillcreateapeeringserverwithIP2.3.4.5andport5060: Name:test-gw-1 IPAddress:2.3.4.5 Hostname:leaveempty Port:5060 Protocol:UDP Weight:1 ViaRoute:None Figure 10. PeeringServerPropertiesClickSavetocreatethepeeringserver.tipThehostnamefieldforapeeringserverisoptional.Usually,theIPaddressofthepeerisusedasthedomainpartoftheRequestURI.FillinthisfieldifapeerrequiresaparticularhostnameinsteadoftheIPaddress.TheIPaddressmustalwaysbegiventhoughasitisusedfortheselectionoftheinboundpeer.BydefaultoutboundrequestswillalwaysbesenttothespecifiedIPaddress,nomatterwhatyouputintothehostnamefield.IfyouwanttosendtherequestusingtheDNSresolutionoftheconfiguredhostname,disregardinginthatwaytheIP,youhavetoenableoutbound_hostname_resolutionoptioninpeerpreferences.tipIfyouwanttoaddapeeringserverwithanIPv6address,entertheaddresswithoutsurroundingsquarebracketsintotheIPAddresscolumn,e.g.::1.Youcanforceanadditionalhop(e.g.viaanexternalSBC)towardsthepeeringserverbyusingtheViaRouteoption.Theavailableoptionsyoucanselecttherearedefinedin/etc/ngcp-config/config.yml,whereyoucanaddanarrayofSIPURIsinkamailio→lb→external_sbclikethis:kamailio: lb: external_sbc: -sip:192.168.0.1:5060 -sip:192.168.0.2:5060Executengcpcfgapply"addedexternalsbcgateways",thenedityourpeeringserverandselectthehopfromtheViaRouteselection.Onceapeeringserverhasbeencreated,thisservercanalreadysendcallstothesystem.6.6.2.1. OutboundPeeringRulesimportantTobeabletosendoutboundcallstowardstheserversinthePeeringGroup,youalsoneedto defineOutboundPeeringRules.Theyspecifywhichsourceanddestinationnumbersaregoingtobeterminatedoverthis group.Tocreatearule,clicktheCreateOutboundPeeringRulebutton.Figure 11. CreateOutboundPeeringRuleSincethepreviouslycreatedpeeringgroupwillbetheonlyoneinourexample,wehavetoaddadefaultruletorouteallcallsviathisgroup.Todoso,createanewpeeringrulewiththefollowingvalues: CalleePrefix:leaveempty CalleePattern:leaveempty CallerPattern:leaveempty Description:DefaultRule Figure 12. OutboundPeeringRulePropertiesThenclickSavetoaddtheruletoyourgroup.tipIncontrasttothecallee/callerpattern,thecalleeprefixhasaregular alphanumericstringandcannotcontainanyregularexpression.tipIfyousetthecallerorcalleerulestorefinewhatisroutedviathispeer,enterallphonenumbersinfullE.164format,thatis.tipTheCallerPatternfieldcoversthewholeURIincludingthesubscriberdomain,soyoucanonlyallowcertaindomainsoverthispeerbyputtingforexample@example\.comintothisfield.6.6.2.2. InboundPeeringRulesStartingfrommr5.0release,SipwiseC5supportsfilteringSIPINVITErequests sentbySIPpeers.Thesystemadministratormaydefineoneormorematchingrules forSIPURIsthatarepresentintheheadersofSIPINVITErequests,andselectwhich SIPheader(orpartoftheheader)mustmatchthepatterndeclaredintherule.IftheincomingSIPINVITEmessagehastheproperheaders,SipwiseC5willacceptand furtherprocesstherequest.Ifthemessagedoesnotmatchtheruleitwillberejected.cautionAnincomingSIPINVITEmessagemustmatchalltheinboundpeeringrules sothatSipwiseC5doesnotrejecttherequest.Inordertocreateaninboundpeeringruleyouhavetoselectapeeringgroup, pressDetailsandthenpressCreateInboundPeeringRulebutton.Figure 13. CreateInboundPeeringRuleAninboundpeeringrulehasthefollowingproperties:Figure 14. InboundPeeringRuleProperties MatchField:selectwhichheaderandwhichpartofthatheaderinaSIPINVITE messagewillbecheckedformatchingthepattern Pattern:aPOSIXregularexpressionthatdefinestheacceptedvalueofaheader; example:^sip:.+@example\.org$ — thiswillmatchaSIPURIthatcontains"example.org" inthedomainpart Rejectcode:optional;aSIPstatuscodethatwillbesentasaresponseto anINVITErequestthatdoesnotmatchthepattern;example:403 Rejectreason:optional;anarbitrarytextthatwillbeincludedintheSIP responsesentwiththerejectcode Enabled:aflagtoenable/disabletheparticularinboundpeeringrule infoBothofthepropertiesRejectcodeandRejectreasonmustbeleftempty ifapeeringserver(i.e.aspecificIPaddress)ispartofmorepeeringgroups. SuchaconfigurationisusefulwhenanincomingSIPINVITErequestneedstobe treateddifferentlyintheaffectedpeeringgroups,basedonitscontent,andthat’s whyiftheINVITEmessageonlypartlymatchesaninboundpeeringruleitshould notsimplyberejected.tipInboundpeeringrulessupportPOSIXregularexpressions,thataredifferentfromPCREregularexpressions. So,forinstance,anexpressionlike^3910[0-9]{5}$canbewrittenas^3910\d{5}$inPCREand^3910[[:digit:]]{5}$ inPOSIX.Thekindofregexpuseddependsontheunderlyingtechnologythatusesthatexpression. Sincerangessuchas[0-9]arealwayscorrect,wesuggestusingthatsyntax.Whenallsettingsforapeeringgrouparedonethedetailsofthegrouplooklike:Figure 15. PeeringServersOverview6.6.2.3. RoutingOrderSelectionTheselectionofpeeringgroupsandpeeringserversforoutgoingcallsisdonein thefollowingway: Allpeeringgroupsthatmeetthefollowingcriteriaconfiguredinthe outboundpeeringruleareaddedtothelistofroutesforaparticularcall: Callee’susernamematchescalleeprefix Callee’sURImatchescalleepattern Caller’sURImatchescallerpattern Whenallmatchingpeeringgroupsareselected,theyareorderedbycallee prefixaccordingtothelongestmatchbasis(sometimesreferredtoas thelongestpatternmatchormaximumpatternlengthmatch).Oneor morepeeringgroupwithlongestcalleeprefixmatchwillbegivenfirst positionsonthelistofroutes. Peeringgroupswiththesamecalleeprefixlengtharefurtherorderedby Priority.Peeringgroup(s)withthehigherprioritieswilloccupy higherpositions. importantPriority1givesthehighestprecedencetothecorresponding peeringgroup.Hence,alowerpriorityvaluewillputthepeeringgroup higherinthelistofroutes(comparedtootherpeeringgroupswiththesame calleeprefixlength).Prioritycanbeselectedfrom1(highest)to9(lowest). Allpeeringserversinthepeeringgroupwiththehighestpriority (e.g.priority1)aretriedone-by-onestartingfromthehighestserver weight.Peeringgroupswithlowerprioritiesorwithshortercallee prefixwillbeusedonlyforfail-over. Theweightofthepeeringserversintheselectedpeeringgroupwill influencetheorderinwhichtheserverswithinthegroupwillbetriedfor routingtheoutboundcall.Theweightofaservercanbesetintherange from1to127.importantOppositetothepeeringgrouppriority,apeeringserverwitha higherweightvaluehasahigherprecedence,buttheserverweightrather setsaprobabilitythanastrictorder.E.g.althoughapeeringserverwith weight127hasthehighestchancetobethefirstinthelistofroutes, anotherserverwithalowerweight(e.g.100)sometimeswillbeselected first.Inordertofindoutthisprobabilityknowingtheweightsofpeeringservers,use thefollowingscript:#!/usr/bin/perl #Thisscriptcanbeusedtofindoutactualprobabilities #thatcorrespondtoalistofpeeringweights. $num_args=$#ARGV+1; if($num_args<1){ print"Usage:lcr_weight_test.pl\n"; exit0; } my$iters=10000; my@rands; for(my$i=1;$i<=$iters;$i++){ my%elem; for(my$j=0;$j{$key}>$higher){ $higher=$rand->{$key}; $higher_key=$key; } } $counts[$higher_key]++; } for(my$j=0;$j peer_auth_pass: peer_auth_realm: importantIfyoudoNOTauthenticateagainstapeerhost,thenthecallerCLIisputintotheFromandP-Asserted-Identityheaders,e.g."+4312345".IfyouDOauthenticate,thentheFromheaderis"+4312345"(theCLIisintheDisplayfield,thepeer_auth_userintheFromusernameandthepeer_auth_realmintheFromdomain),andtheP-Asserted-Identityheaderisasusuallike.SoforpresentingthecorrectCLIinCLIPnoscreeningscenarios,yourpeeringproviderneedstoextractthecorrectusereitherfromtheFromDisplay-NameorfromtheP-Asserted-IdentityURI-User.tipIfpeer_auth_realmisset,thesystemmayoverwritetheRequest-URIwiththepeer_auth_realmvalueofthepeerwhensendingthecalltothatpeerorpeer_auth_realmvalueofthesubscriberwhensendingacalltothesubscriber.Sincethisisrarelyadesiredbehavior,itisdisabledbydefaultstartingwithSipwiseC5release3.2.Ifyouneedthereplacement,youshouldsetset_ruri_to_peer_auth_realm:'yes'in/etc/ngcp-config/config.yml.6.6.3.2. RegisteringataPeeringServerUnfortunately,thecredentialsconfiguredabovearenotyetautomaticallyusedtoregisterSipwiseC5atyourpeerhosts.Thereishoweveraneasymanualwaytodoso,untilthisisaddressed.Configureyourpeeringserverswiththecorrespondingcredentialsin/etc/ngcp-config/templates/etc/ngcp-sems/etc/reg_agent.conf.tt2,thenexecutengcpcfgapply"addedupstreamcredentials".importantBeawarethatthiswillforceSEMStorestart,whichwilldropallcalls.6.7. ConfiguringRewriteRuleSetsOntheNGCP,everyphonenumberistreatedinE.164format.RewriteRuleSetsisaflexibletooltotranslatethecallerandcalleenumberstotheproperformatbeforetheroutinglookupandaftertheroutinglookupseparately.ThecreatedRewriteRuleSetscanbeassignedtothedomains,subscribersandpeersasapreference.HerebelowyoucanseehowtheRewriteRulesareusedbythesystem:Asfromtheimageabove,followingthearrows,youwillhaveanideaaboutwhichtypeofRewriteRulesareappliedduringacall.Ingeneral: CallfromlocalsubscriberAtolocalsubscriberB:InboundRRfromlocalDomain/SubscriberAandOutboundRewriteRulesfromlocalDomain/SubscriberB. CallfromlocalsubscriberAtothepeer:InboundRRfromlocalDomain/SubscriberAandOutboundRewriteRulesfromthepeer. CallfrompeertolocalsubscriberB:InboundRRfromthePeerandOutboundRewriteRulesfromlocalDomain/SubscriberB. YouwouldnormallybeginwithcreatingaRewriteRuleSetforyourSIPdomains.Thisisusedtocontrolwhatanendusercandialforoutboundcalls,andwhatisdisplayedasthecallingpartyoninboundcalls.ThesubscriberswithinadomaininheritRewriteRuleSetsofthatdomain,unlessthisisoverriddenbyasubscriberRewriteRuleSetpreference.YoucanuseseveralspecialvariablesintheRewriteRules,belowyoucanfindalistofthem.Someexamplesofhowtousethemarealsoprovidedinthefollowingsections: ${caller_cc}:Thisisthevaluetakenfromthesubscriber’spreferenceCCvalueunderNumberManipulation ${caller_ac}:Thisisthevaluetakenfromthesubscriber’spreferenceACvalueunderNumberManipulation ${caller_emergency_cli}:Thisisthevaluetakenfromthesubscriber’spreferenceemergency_clivalueunderNumberManipulation ${caller_emergency_prefix}:Thisisthevaluetakenfromthesubscriber’spreferenceemergency_prefixvalueunderNumberManipulation ${caller_emergency_suffix}:Thisisthevaluetakenfromthesubscriber’spreferenceemergency_suffixvalueunderNumberManipulation TocreateanewRewriteRuleSet,gotoSettings→RewriteRuleSets.ThereyoucancreateaSetidentifiedbyaname.Thisnameislatershowninyourpeer-,domain-anduser-preferenceswhereyoucanselecttherulesetyouwanttouse.ClickCreateRewriteRuleSetandfillintheformaccordingly.PresstheSavebuttontocreatetheset.ToviewtheRewriteRuleswithinaset,hoverovertherowandclicktheRulesbutton.TherulesareorderedbyCallerandCalleeaswellasdirectionInboundandOutbound.tipInEurope,thefollowingformatsarewidelyaccepted:+,00and0.Also,somecountriesallowtheareacode-internalcallswhereonlysubscribernumberisdialedtoreachanothernumberinthesamearea.Withinthissection,wewillusetheseformatstoshowhowtouserewriterulestonormalizeanddenormalizenumberformats.6.7.1. InboundRewriteRulesforCallerTheserulesareusedtonormalizeuser-providednumbers(e.g.passedinFromDisplayNameorP-Preferred-Identityheaders)intoE.164format.Inourexample,we’llnormalizethethreedifferentformatsmentionedaboveintoE.164format.Tocreatethefollowingrules,clickontheCreateRewriteRuleforeachofthemandfillthemwiththevalues providedbelow.Stripleading00or+ MatchPattern:^(00|\+)([1-9][0-9]+)$ ReplacementPattern:\2 Description:InternationaltoE.164 Direction:Inbound Field:Caller Replace0bycaller’scountrycode: MatchPattern:^0([1-9][0-9]+)$ ReplacementPattern:${caller_cc}\1 Description:NationaltoE.164 Direction:Inbound Field:Caller Normalizelocalcalls: MatchPattern:^([1-9][0-9]+)$ ReplacementPattern:${caller_cc}${caller_ac}\1 Description:LocaltoE.164 Direction:Inbound Field:Caller Normalizationfornationalandlocalcallsispossiblewithspecialvariables${caller_cc}and${caller_ac}thatcanbeusedinReplacementPatternandaresubstitutedbythecountryandareacodeaccordinglyduringthecallrouting.importantThesevariablesareonlybeingfilledinwhenacalloriginatesfromasubscriber(becauseonlythenthecc/acinformationisknownbythesystem),soyoucannotusethemwhenacallscomesfromaSIPpeer(thevariableswillbejustemptyinthiscase).tipWhenroutingacall,therewriteprocessingisstoppedafterthefirstmatchofarule,startingfromtoptobottom.Ifyouhavetworules(e.g.agenericoneandamorespecificone),wherebothofthemwouldmatchsomenumbers,reorderthemwiththeup/downarrowsintotheappropriateposition.6.7.2. InboundRewriteRulesforCalleeTheserulesareusedtorewritethenumbertheenduserdialstoplaceacalltoastandardformatforroutinglookup.Inourexample,weagainallowthethreedifferentformatsmentionedaboveandagainnormalizethemtoE.164,soweputinthesamerulesasforthecaller.Stripleading00or+ MatchPattern:^(00|\+)([1-9][0-9]+)$ ReplacementPattern:\2 Description:InternationaltoE.164 Direction:Inbound Field:Callee Replace0bycaller’scountrycode: MatchPattern:^0([1-9][0-9]+)$ ReplacementPattern:${caller_cc}\1 Description:NationaltoE.164 Direction:Inbound Field:Callee Normalizeareacode-internalcalls: MatchPattern:^([1-9][0-9]+)$ ReplacementPattern:${caller_cc}${caller_ac}\1 Description:LocaltoE.164 Direction:Inbound Field:Callee tipOurprovidedruleswillonlymatchifthecallerdialsanumericnumber.IfhedialsanalphanumericSIPURI,noneofourruleswillmatchandnorewritingwillbedone.Youcanhoweverdefinerulesforthataswell.Forexample,youcouldallowyourenduserstodialsupportandrewritethattoyoursupporthotlineusingthematchpattern^support$andthereplacepattern43800999000orwhateveryoursupporthotlinenumberis.6.7.3. OutboundRewriteRulesforCallerTheserulesareusedtorewritethecallingpartynumberforacalltoanenduser.Forexample,ifyouwantthedeviceofyourendusertoshow0ifanationalnumbercallsthisuser,and00ifaninternationalnumbercalls,putthefollowingrulesthere.ReplaceAustriancountrycode43by0 MatchPattern:^43([1-9][0-9]+)$ ReplacementPattern:0\1 Description:E.164toAustriaNational Direction:Outbound Field:Caller Prefix00forinternationalcaller MatchPattern:^([1-9][0-9]+)$ ReplacementPattern:00\1 Description:E.164toInternational Direction:Outbound Field:Caller tipNotethatbothoftheruleswouldmatchanumberstartingwith43,soreorderthenationalruletobeabovetheinternationalone(ifit’snotalreadythecase).6.7.4. OutboundRewriteRulesforCalleeTheserulesareusedtorewritethecalledpartynumberimmediatelybeforesendingoutthecallonthenetwork.Thisgivesyouanextraflexibilitybycontrollingthewayrequestappearsonawire,whenyourSBCorotherdeviceexpectsthecalledpartynumbertohaveaparticulartech-prefix.ItcanbeusedoncallstoenduserstooifyouwanttodosomeprocessinginintermediateSIPdevice,e.g.applylegalinterceptselectivelytosomesubscribers.Prefixsipsp#forallcalls MatchPattern:^([0-9]+)$ ReplacementPattern:sipsp#\1 Description:Interceptthiscall Direction:Outbound Field:Callee 6.7.5. EmergencyNumberHandlingThereare2waystohandlecallsfromlocalsubscriberstoemergencynumbersinNGCP: Simpleemergencynumberhandling:inboundrewriterulesappendanemergency tagtothecallednumber,thiswillberecognisedbyNGCP’scallroutinglogicand thecallisrouteddirectlytoapeer.Pleasereadthenextsectionfordetails ofsimpleemergencynumberhandling. Anemergencynumbermappingisapplied:adedicatedemergencynumbermapping databaseisconsultedinordertoobtainthemostappropriateroutingnumberof emergencyservices.Thislogicensuresthatthecallerwillcontactthegeographically closestemergencyservice.PleasevisittheEmergencyMapping sectionofthehandbookformoredetails. 6.7.5.1. SimpleEmergencyNumberHandlingOverviewTheoverviewofemergencycallprocessingisasfollows:Figure 17. SimpleEmergencyCallHandlingConfiguringEmergencyNumbersisalsodoneviaRewriteRules.6.7.5.2. TaggingInboundEmergencyCallsForEmergencyCallsfromasubscribertotheplatform,youneedtodefineanInboundRewriteRuleForCallee,which addsaprefixemergency_tothenumber(andcanrewritethenumbercompletelyaswellatthesametime).Iftheproxy detectsacalltoaSIPURIstartingwithemergency_,itwillenteraspecialroutinglogicbypassingvariouschecks whichmightmakeanormalcallfail(e.g.duetolockedorblockednumbers,insufficientcreditsorexceedingthemax.amount ofparallelcalls).TaganEmergencyCall MatchPattern:^(911|112)$ ReplacementPattern:emergency_\1 Description:TagEmergencyNumbers Direction:Inbound Field:Callee TorouteanEmergencyCalltoaPeer,youcanselectaspecificpeeringgroupbyaddingapeeringrulewitha calleeprefixsettoemergency_toapeeringgroup.6.7.5.3. NormalizeEmergencyCallsforPeersInordertonormalizetheemergencynumbertoavalidformatacceptedbythepeer,youneedtoassignanOutboundRewrite RuleForCallee,whichstripsofftheemergency_prefix.Youcanalsousethevariables${caller_emergency_cli}, ${caller_emergency_prefix}and${caller_emergency_suffix}aswellas${caller_ac}and${caller_cc},whichareallconfigurableper subscribertorewritethenumberintoavalidformat.NormalizeEmergencyCallforPeer MatchPattern:^emergency_(.+)$ ReplacementPattern:${caller_emergency_prefix}${caller_ac}\1 Description:NormalizeEmergencyNumbers Direction:Outbound Field:Callee 6.7.6. AssigningRewriteRuleSetstoDomainsandSubscribersOnceyouhavefinishedtodefineyourRewriteRuleSets,youneedtoassignthem.Forsetstobeusedforsubscribers,youcanassignthemto theircorrespondingdomain,whichthenactsasdefaultsetforallsubscribers.Todoso,gotoSettings→DomainsandclickPreferencesonthedomainyouwantthesettoassignto.ClickonEditandselecttheRewriteRuleSetcreatedbefore.YoucandothesameinthePreferencesofyoursubscriberstooverridetheruleonasubscriberbasis. Thatway,youcanfinelycontroldowntoanindividualuserthedial-plantobeused.GotoSettings→Subscribers,clicktheDetailsbuttononthesubscriberyouwanttoedit,theclickthePreferencesbutton.6.7.7. CreatingDialplansforPeeringServersForeachpeeringserver,youcanuseoneoftheRewriteRuleSetsthatwascreatedpreviouslyasexplainedinSection 6.7,“ConfiguringRewriteRuleSets”(keepinmindthatspecialvariables${caller_ac}and${caller_cc}cannotbeusedwhenthecallcomesfromapeer).Todoso,clickonthenameofthepeeringserver,lookforthepreferencecalledRewriteRuleSets.Ifyourpeeringserversdon’tsendnumbersinE.164format,youneedtocreateInboundRewriteRulesforeachpeeringservertonormalizethenumbersforcallerandcalleetothisformat,e.g.bystrippingleading+orputthemfromnationalintoE.164format.Likewise,ifyourpeeringserversdon’tacceptthisformat,youneedtocreateOutboundRewriteRulesforeachofthem,forexampletoappenda+tothenumbers.6.7.8. CallRoutingVerificationTheSipwiseC5providesautilitythathelpswiththeverificationofcall routingamonglocalsubscribersandpeers.ItiscalledCallRoutingVerification andemploysrewriterulesandpeerselectionrules,inordertoprocesscalling andcallednumbersorSIPusersandfindtheappropriatepeerforthedestination.TheCallRoutingVerificationutilityperformsonlybasicnumberprocessingand doesnotinvokethefullnumbermanipulationlogicappliedonrealcalls.Thegoal istoenabletestingofrewriterules,ratherthanvalidatethecompletenumber processing. Whatisconsideredduringthetest: subscriberpreferences:cliandallowed_clis domain/subscriber/peerrewriterules Whatisnottakenintoaccountduringthetest: othersubscriberorpeerpreferences LNP(LocalNumberPortability)lookuponcallednumbers;LNPrewriterules YoucanaccesstheutilityfollowingthepathonAdminwebinterface:Tools→CallRoutingVerification.Expectedinputdata Callernumber/uri:2formatsareacceptedinthisfield: Asimplephonenumberininternational(00431..,+431..)orE.164(431..)format. ASIPURIinusername@domainformat(withoutadding"sip:"atthebeginning). Calleenumber/uri:ThesameappliesasforCallernumber/uri. CallerType:SelectSubscriberorPeer,dependingonthesourceofthecall. CallerSubscriberorCallerPeer:Optionally,youcanselectthesubscriber orpeerexplicitly.Withouttheexplicitselection,however,theCallRoutingVerification toolisabletofindthecallerinthedatabase,basedontheprovidednumber/URI. CallerRWROverride,CalleeRWROverride,CalleePeerOverride:Thecaller/ calleerewriterulesandpeerselectionrulesdefinedindomain,subscriberand peerpreferencesareusedforcallprocessingbydefault.Butyoucanalsooverride thembyexplicitlyselectinganotherrewriteorpeerselectionrule. Examples Usingonlyphonenumbersandexplicitsubscriberselection InputData: Figure 18. CallRoutingVerif.-OnlyNumbers-Input Result: Figure 19. CallRoutingVerif.-OnlyNumbers-Result UsingphonenumberandURI,withoutexplicitsubscriberselection InputData: Figure 20. CallRoutingVerif.-NumberandURI-Input Result: Figure 21. CallRoutingVerif.-NumberandURI-ResultPrev HomeNext



請為這篇文章評分?