Elastic SIP Trunking | Twilio
文章推薦指數: 80 %
Trunks. Twilio Elastic SIP Trunking is a cloud based solution that provides connectivity for IP-based communications infrastructure to connect to the PSTN, for ...
TwilioDocs
SMS
Voice
Runtime
Video
Studio
Alldocs...
English
English
日本語
Deutsch
Français
Português
SDKs
Help
Login
Signup
SMS
Voice
Runtime
Video
Studio
Alldocs...
SDKs
Help
Login
Signup
ElasticSIPTrunking
Twilio
Menu
ElasticSIPTrunking
Configure
ElasticSIPTrunking
Scale&limits
IPaddresses
Codecs
CallsperSecond(CPS)—TrunkingTermination
EmergencyCallingforSIPTrunking
ExtendedCallDuration
SIPHeaderManipulation
ConfigureyourTrunkusingTwilioInterconnect
TestyourElasticSIPTrunk
ProtectyouraccountwithVoiceDialingGeographicPermissions
Troubleshooting
TestyourElasticSIPTrunk
TroubleshootingyourTrunk
VoiceInsights
SolutionBlueprintsandConfigurationGuides
SolutionBlueprints
ConfigurationGuides
APIReference
ElasticSIPTrunkingRESTAPIReference
CredentialListResource
IPAccessControlListResource
OriginationUrlResource
PhoneNumberResource
TrunkResource
EmergencyCallingforSIPTrunkingAPI
ProgrammableVoiceAPIOverview
Pricing:TrunkingResource
Libraries
C#/.NET
Java
Node
PHP
Python
Ruby
Collapse
Expand
Ratethispage:
GettingStarted:ConfigureyourTwilioElasticSIPTrunk
BeforeYouBegin
InordertouseTwilioElasticSIPTrunking,you'llneedaTwilioaccount.Signupfor
afreeTwilioaccountifyoudon'talreadyhaveone.
ConfigureyourElasticSIPTrunk:
ConfigureTrunks
Generalsettings
Terminationsettings
Originationsettings
Numbers
ConnectyourNetworkover
PublicInternet
TwilioInterconnect
Twilio'sIPaddresses
Features
Codecs
CallsperSecond
CallRecording
SecureTrunking
CallRedirect
ExtendedCallDuration
SIPDiversionHeaders
CallTransferviaSIPREFER
DisasterRecoveryURL
EmergencyCalling
CallerName:CNAMLookup&CNAMRegistration
TrustedCallingwithSTIR/SHAKEN
SIPHeaderManipulation
ConnectwithyourIPcommunicationsinfrastructure:
ElasticSIPTrunking-SolutionBlueprints
ElasticSIPTrunking-ConfigurationGuides
RESTAPIdocumentation:
ElasticSIPTrunkingRESTAPIReference
Requirements
InordertouseTwilioElasticSIPTrunking,you'llneedtoensurethatyou
havethefollowing:
ASIPenablednetworkelement(e.g.SessionBorder
Controller,SIPCallServer,IP-PBX,SIP-PRIIAD,etc.)withaccesstotheinternet.
SufficientInternetbandwidthtosupportthepeakcalltraffic.Thepeak
bandwidthcanbedeterminedby:
SIPTrunkPeakBandwidth=MaxSimultaneousCallsx100kbps
The100kbpsvaluereflectsthenecessarybandwidthfortheG711codecplussufficientroomforoverhead.
Dashboard
Logintotheconsoleandgotothe"ElasticSIPTrunking"section.Your
Dashboardwillbedisplayed,providingahighleveloverviewofyour
Trunkingusage:Minutes,Calls&Cost.
Ontheleftnavigationmenuyou'llhavelinksto:
Overview:Getstartedhere,reviewtutorialdocs,oraccessfeatures&pricing.
Manage:AccessTrunks,IPaccesscontrollists,credentiallists,ornetworkinginfo.
Manage
Underthe"Manage"menuyouwillhaveaccesstoalloftheconfiguration
aspectsofyourTrunks.Specifically,youwillhavelinksto:
Trunks:ListofyourexistingSIPTrunks.Create,deleteand
configureyourtrunks.
IPAccessControlLists:ManageyourIPAccessControlLists(asetofIPs
thatareallowedtoreachyourSIPDomain).
CredentialLists:Manageyourusercredentials(asetofusernamesand
passwordsthatareallowedtoreachyourSIPDomain).
NetworkingInfo:ImportantinformationaboutTwilio'splatformthatyouwill
needtoconfigureyourcommunicationsinfrastructure.
Trunks
TwilioElasticSIPTrunkingisacloudbasedsolutionthatprovides
connectivityforIP-basedcommunicationsinfrastructuretoconnecttothePSTN,
formakingandreceivingtelephonecallstothe'restoftheworld'viaany
broadbandinternetconnection.
Atrunkiscomposedofthefollowingsettings:
General:Provideafriendlynameforyourtrunkandseeitsuniqueidentifier
(TrunkSID).
Termination:Configurethesettingsforplacingoutgoingtrafficfromyour
communicationsinfrastructuretothePSTN.
Origination:Configurethesettingsforreceivingincoming
trafficonyourTwilionumberstodelivercallstoyour
communicationsinfrastructurefromthePSTN.
Numbers:Allowsyoutoassociatenumberswithagiventrunk,andseeall
numberscurrentlyassociatedwithatrunk.
FromtheTrunksnavigationbaritemyou'llbeabletoviewafull
listofyourElasticSIPTrunksandclickoneachonetomodifyits
configuration.Youalsohavetheabilitytodeleteagiventrunkfromthis
view.
CreateaTrunk
FromtheTrunksnavigationbarclickon"CreateNewTrunk"to
createanewtrunk.ThismayalsobedonefromtheGetting
Startedsection.
Generalsettings
Thesesettingsapplytotheentiretrunkregardlessofthedirectionofyour
traffic.
FriendlyName
Provideafriendlynameforyourtrunk.
TrunkSID
Thisistheuniqueidentifierofthistrunk,andisassignedautomaticallyonce
youcreateatrunk.
CallRecording
Fromthisdrop-downyoucanenablecallrecordingforthistrunk.Whenenabled,
allcallsarerecorded(bothoriginationandterminationtraffic),ina
pay-as-you-goconsumptionmodel.Recordingoptionsforasinglechannelordualchannels
canbeselected.ThedefaultsettingofatrunkisDoNotRecord.Youcanselect:
DoNotRecord:Recordingisdisabledonthistrunk.
Recordfromringing:Recordingwillbeginwhentheringingstarts.
Recordfromanswer:Recordingwillbeginwhenacallisanswered.
DualRecordfromringing:Recordingwillbeginwhentheringingstartsandbothtrackswillbevisualizedseparately.
DualRecordfromanswer:Recordingwillbeginwhenacallisansweredandbothtrackswillbevisualizedseparately.
RecordingTrim:Ifenabled,silencewillbetrimmedfromtherecording.Ifdisabled,silencewillnotbetrimmedfromtherecording.
ExtendedCallDuration
TwilioextendedthemaximumcalldurationonElasticSIPTrunkingcallsfrom4hoursto24hours.Thisallowsthebusinesstohaveextendedconversationsthatlastlongerthan4hours.Youcanseedetailshere.
SecureTrunking
Encryptionensuresthatthecallmediaandassociatedsignallingremainsprivateduringtransmission.TransportLayerSecurity(TLS)providesencryptionforSIPsignalingandSecureReal-timeTransportProtocol(SRTP)providesencryptionforcallcontent/mediapackets.LearnabouthowtoenableandtroubleshootTLSissuesfromthisblog.
TheTLSprotocolisdesignedtoestablishasecureconnectionbetweenaclientandaservercommunicatingoveraninsecurechannel.RFC5246,theTransportLayerSecurity(TLS)Protocol,Version1.2,specifiesVersion1.2oftheTransportLayerSecurity(TLS)protocol.
TLSSpecifications:
SupportedTLSversions:TLSv1.0,TLSv1.1andTLSv1.2.
PLEASENOTE:Tobettercomplywithsecurityrequirements,wehavedeprecatedTLSv1.0andTLSv1.1forinboundandoutboundElasticSIPtrunkingcalls.
IfyourSIPinfrastructurerequiresusingTLSv1.0orTLSv1.1,youcanconfigureyourTwilioAccounttoallowthesedeprecatedversionsinyourconsoleunderVoice→Settings→AllowDeprecatedSIP/TLSversions.Ifthissettingisenabled,yourSIPendpointscanusethedeprecatedTLSv1.0andTLSv1.1versionsforSIPsignalingsenttoorreceivedfromTwilio.Ifdisabled,onlynon-deprecatedTLSv1.2+isallowed.
TwiliostronglyrecommendstheuseofTLSversion1.2whenconnectingyourSIPinfrastructure.
SupportedCiphers:ECDHE-ECDSA-AES128-GCM-SHA256,ECDHE-RSA-AES128-GCM-SHA256,ECDHE-ECDSA-AES128-SHA256,ECDHE-RSA-AES128-SHA256,ECDHE-ECDSA-AES256-GCM-SHA384,ECDHE-RSA-AES256-GCM-SHA384,ECDHE-ECDSA-AES256-SHA384,ECDHE-RSA-AES256-SHA384,AES128-GCM-SHA256,AES128-SHA256,AES128-SHA,AES256-GCM-SHA384,AES256-SHA256,AES256-SHA
SRTPprovidesaframeworkfortheencryptionofRTP&RTCP.RFC4568,SessionDescriptionProtocol(SDP)SecurityDescription(SDES)forMediaStreams,definessuchaprotocolspecificallydesignedtoexchangecryptographicmaterialusinganewlydefinedSDPcryptoattribute.
SRTPSpecifications:
TrunkingOrigination:Onlyasinglecryptosuitewillbeincluded:AES_CM_128_HMAC_SHA1_80
TrunkingTermination:CryptosuitessupportedincludeAES_CM_128_HMAC_SHA1_80andAES_CM_128_HMAC_SHA1_32.Bothmaybeincludedinanorderofpreference.
Theoptionalmasterkeyidentifier(MKI)parameterisnotsupported
WhenSecureTrunkingisenabled,anynon-encryptedcallswillberejected.PleaseensureyouconfiguretheuseofTLSinyour
OriginationSettingsbyincludingthetransport=tlsparameter.IfthetransportparameterispresentonanyofyourURIsspecifyingadifferenttransport(e.g.transport=udp),itwillbeignoredandTLSwillbeused.Bydefaultport5061willbeusedforTLS,howeveryoumayspecifytheportyouwishtouseinyourOriginationURI.
ImportingTwilio'sRootCACertificate
TLSisusedtoencryptSIPsignalingbetweenSIPendpoints.InorderforthistofunctionproperlyitisrequiredthatcertaindevicesinthenetworkimportanSSLcertificate.TwiliousescertificatesfromaCA(CertificateAuthority).Itisimportantthatyouaddthefollowingrootcertificatetoyourcommunicationsinfrastructuretoestablishitsauthenticityonthenetwork.DownloadTwilio'sCAcertificate.
ItisimportanttonotethatTwiliousesawildcardcertificatewhichcanbeusedformultiplesubdomainsofadomain(*.pstn.twilio.com).Ifyournetworkelementdoesnotsupportwildcardedcertificatespleasedisablecertificatevalidation.
TLS/SRTPsupportwithAsterisk
Asteriskshipsbydefaultwithchan_sipdriverandworkswellwithTwilio.However,ifyouhavesomereasontorunPJSIPdriverwithAsterisk,pleasenotethefollowing:
Asterisk13.8cert2defaultstoPJSIP2.5anditdoesnotworkwithTwilioforTLS/SRTPpurposes.Non-encryptedcallsdowork
Asterisk13.8cert2canalsousethelatestPJSIPdriver,whichatthistimeis2.5.5.Twilioworkswellwithitdespitethefollowingmessageappearinginyourlog:
PJSIP2.5.5outputsthefollowingerrorbutthecallisstillshowntowork.
Sep2713:03:56]ERROR[10886]:pjproject:0>:tlsc0x7f217c03RFC5922(section7.2)doesnotallowTLSwildcardcertificates.AdviseyourSIPprovider,please!
Thefollowinglinkisaguidetoinstallinganon-bundledversionofPJSIP.Changetheversionto2.5.5inthesteps.
InstallingPJSIPchanneldriver
CallTransferviaSIPREFER
WhenCallTransferisenabled,TwiliowillconsumeanincomingSIPREFERfromyourcommunicationsinfrastructureandcreateanINVITEmessagetotheaddressintheRefer-Toheader.Pleasegohereformoredetails.
MediaSettings
SymmetricRTP
Ingeneral,yourIPcommunicationsinfrastructureshoulduseyourpublicIPaddressintheSDPandthatwillbetheONLYdestinationwhereTwiliowillsendmediatowards.However,ifyou’retraversinganon-SIPawareNAT,youmaynotknowyourpublicIPandyourSDPwillincludeyourprivateIPaddress,typicallyleadingtoone-wayaudioissues.TwilioisabletoresolvethisbylatchingontotheincomingRTPmediastreamandsendingRTPtowardsthatdestinationbyenablingSymmetricRTP.
WhenSymmetricRTPisenabledTwiliowilldetectwheretheremoteRTPstreamiscomingfromandstartsendingRTPtothatdestinationinsteadoftheonenegotiatedintheSDP.PleasenotethatthissettingismorevulnerabletoRTPattacks.
WhenSymmetricRTPisdisabled,TwiliowillsendRTPtothedestinationnegotiatedintheSDP.Thissettingisconsideredtobemoresecureandthereforerecommended.
TerminationSettings
Configuringyourterminationsettingswillallowyoutoplaceoutgoingtraffic
fromyourcommunicationsinfrastructuretothePSTN.Inordertouseatrunk
forterminationitmusthaveaTerminationSIPURIandatleastone
authenticationscheme(IPAccessControlListsand/orCredentialsLists).
TerminationURI
ConfigureaSIPDomainNametouniquelyidentifyyourTerminationSIPURIfor
thistrunk.ThisURIwillbeusedbyyourcommunicationsinfrastructureto
directSIPtraffictowardsTwilio.
{example}.pstn.twilio.com
Twiliorecommendsthatyouuseadashinsteadofadottoimprovereadabilityofyourdomain.
However,insomecasesyoumaypreferasub-domainlikea.b.pstn.twilio.comofthehigher-leveldomainb.pstn.twilio.com
Asub-domainlikea.b.pstn.twilio.comcanbecreatedunderthefollowingrequirements:
Thehigher-leveldomain(b.pstn.twilio.com)mustbecreatedfirst
Thehigher-leveldomain(b.pstn.twilio.com)mustbecreatedbythesameaccountortheparentaccount
Configureatrunkonyourcommunicationsinfrastructure(e.g.IP-PBXorSBC)
Configureatrunkonyourcommunicationsinfrastructureandpointittowards
{example}.pstn.twilio.comforoutboundtraffictowardsTwilio.
LocalizedTerminationURIs
Ifyouwishtomanuallyconnecttoaspecificgeographicedgelocationthatisclosestto
thelocationofyourcommunicationsinfrastructure,youmaydosobypointing
yourcommunicationsinfrastructuretoanyofthefollowinglocalized
TerminationSIPURIs:
{example}.pstn.ashburn.twilio.com(NorthAmericaVirginia)
{example}.pstn.umatilla.twilio.com(NorthAmericaOregon)
{example}.pstn.dublin.twilio.com(EuropeIreland)
{example}.pstn.frankfurt.twilio.com(EuropeFrankfurt)
{example}.pstn.singapore.twilio.com(AsiaPacificSingapore)
{example}.pstn.tokyo.twilio.com(AsiaPacificTokyo)
{example}.pstn.sao-paulo.twilio.com(SouthAmericaSãoPaulo)
{example}.pstn.sydney.twilio.com(AsiaPacificSydney)
YoucanfindthelegacylocalizedURIslisthere.eg:{example}.pstn.us1.twilio.com
RedundancywithTerminationURIs
Twilio'sElasticSIPTrunkingusesanFQDN({example}.pstn.twilio.com)asaTerminationURIthatisusedbyyourcommunicationsinfrastructuretodirectSIPtraffictowardsTwilio.Asexplainedintheprevioussection,localizedTerminationURIsareavailable.
Forexample,{example}.pstn.ashburn.twilio.com,thisspecificFQDNresolvesinthefollowingDNSA-Record:
Type
IPAddress
TTL
A
54.172.60.3
10min
A
54.172.60.0
10min
A
54.172.60.2
10min
A
54.172.60.1
10min
Foreachedgelocationwehave3-4IPaddressesthatareusedforreliabilitypurposes(seeIPaddresses.EachoftheseIPaddressesrepresentsauniquepublicedgeforourElasticSIPTrunkingservicesintotheTwiliocloud,distributedacrossmultipleAvailabilityZonesforreliabilitypurposes.
ItishighlyrecommendedthatyoudonotpegtowardsasingleIPaddressbutratherutilizeallIPaddressesandfailoverincaseoneIPisnotresponding.
Acommonstrategy,whichwedeployinternallyandwhatwehaveinstructedourcarrierstodotowardsusaswell,isthatifthereisnoresponsetoanINVITE,gotothenextIPafter4seconds.AsinglemachinebehindasingleIPwillalwaysfailatsomepointsotheoverallsolutionmusttakethatintoconsiderationandguarditselftowardsthesefailures.
Furthermore,ifthereisacompleteAshburnoutage,itisrecommendedthatyoufailovertoanotheredgelocation(e.g.Ifconnectingtoashburn,failovertoumatilla),keepinginmindthattheEdgeLocationwillinturnresolveto3-4differentIPaddressesforreliability.
Authentication
Configuretheauthenticationdetailstoensurethesecurity/authenticityofyourterminationtraffic.YoumustconfigureaminimumofeitheranACLorcredentialauthentication.Ifyouconfigureboth,thenbothACLsandcredentialsareenforced.
ItishighlyrecommendedthatyouconfigureUserCredentials.IPACL'salonedoesnotprotectagainstcertaintypesofattacks.
TocreateanewAccessControlList(ACL):
Click"CreateIPAccessControlList"fromthe"Authentication"section.
GivetheAccessControlListafriendlynamethatisdescriptiveofwhatthat
listofIPs.Somethinglike"DallasDatacenterIPs".
AddIPstoyournewIPAccessControlList(theseshouldbetheIPaddresses
usedforoutboundSIPtrafficbyyourCommunicationsInfrastructureborder
elements,e.g.SBC).
GiveyourIPsafriendlynamethatisdescriptiveofwhatthatIPis,for
example"ProductionSBC".
Click"CreateACL"
TocreateanewCredentialList:
Click"CreateCredentialList"fromthe"Authentication"section.
GivetheCredentialListafriendlynamethatisdescriptiveoftheuser
you'reauthenticating.Somethinglike"Admin,Twilio".
Enterausername(theseshouldbetheusernameusedfordigestauthentication
foroutboundSIPtrafficbyyourcommunicationsinfrastructureborder
elements,e.g.SBC).
Enterthecorrespondingpasswordforthatuser.
Click"CreateCredentialsList"
IfyouareusingUserCredentials,yourSIPINVITEwillbechallengedwitha
407ProxyAuthenticationRequiredrequestingtheappropriateusercredentials.
Bytheendofthisstepyourtrunkwillbeabletoprocessterminationcalls
fromyourcommunicationsinfrastructure,viaTwilio,tothePSTN.
AllowedCallerIDNumbersinTerminationcalls
YoumustspecifyaCallerIDNumberthateithercorrespondstoaTwilioDIDonyouraccountoraCallerIDNumberthathasbeenverifiedontheConsoleorwiththeOutgoingCallerIDAPI.
IfaCallerIDNumberisnotspecifiedintheSIPINVITE'sFromField,thentheRemote-Party-IDortheP-Asserted-Identitywillbeused.
ForTrialaccounts,inadditiontousingaverifiedCallerID,youcanonlycallnumbersthatarealsoverified.Toremovethisrestriction,UpgradeyouraccountviatheConsole.
MakeyourfirstTerminationcall
INVITEsip:+15108675309@{example}.pstn.ashburn.twilio.comSIP/2.0
MakesurethatanyphonenumberssentviaSIPtoTwilioarealwaysE.164-formatted(e.g.+12128675309).IfE.164formatisnotused,thenthecallwillberejectedwithaSIP400BadRequestresponse.
MakesureyourE.164formattednumberalwaysincludes+.Thisplusprefixisamust.
Originationsettings
Configuringyouroriginationsettingswillallowyoutoreceiveincoming
trafficfromthePSTNtoaTwilionumber,deliveredtoyourcommunications
infrastructure.Withphonenumbersavailableinover100countries,Twiliogives
youatrulyglobalSIPTrunk.AminimumofoneTwilionumbershouldbe
associatedwiththistrunkifyou'reconfiguringitfororigination.
Theoriginationsettingsconfiguredinthissectionwillapplytoallnumbers
associatedwiththistrunk.
OriginationSIPURI
ConfigureyouroriginationSIPURI,whichidentifiesthenetworkelemententry
pointintoyourcommunicationsinfrastructure(e.g.IP-PBX,SBC).ThehostpartoftheSIPURImaybe
eitheranIPaddressoraFullyQualifiedDomainName(FQDN).
sip:172.56.42.132
sip:mysbc.com
TwiliowillautomaticallypopulatetheuserpartoftheSIPURIbasedonthe
TwilionumberthecallfromthePSTNisdestinedtowards.Forexample,ifthe
callfromthePSTNisreceivedforTwilionumber+14158675309,whichis
associatedwiththistrunk,theresultingURIsenttoyourcommunications
infrastructurewillbe:
sip:[email protected]
sip:[email protected]
Alternatively,youmayalsoconfigureaspecificuser-part(e.g."anniebp")
withintheoriginationSIPURI.NotethatthesameURIwillbeusedforall
Numbersassociatedwiththistrunk.Hence,ifthecallfromthePSTNis
receivedforTwilionumber+14158675309,whichisassociatedwiththistrunk,
theresultingURItowardsyourcommunicationsinfrastructurewillstillbethe
followingforallphonenumbers:
sip:[email protected]
sip:[email protected]
Note:TheTwilionumberdialed(+14158675309)willalwaysbeconveyedin
aSIPDiversionheaderforTrunkingOriginationcalls.
X-headers
ItispossibletosendanySIPheaderbeginningwiththeX-prefix,by
appendingthemtotheoriginationSIPURI.Forexample,youcouldconfigure:
sip:[email protected]?X-myheader=foo
tosendX-myheader:fooonalloriginatedcalls.
Thetransportparameter
Bydefault,TwiliosendsoriginatingSIPrequeststowardsyourcommunicationsinfrastructureoverUDP.ThismaybecustomizedtobesentoverTCPratherthanUDP.ChangethisbyusingthetransportparameterintheoriginationSIPURI:
sip:[email protected];transport=tcp
Alternatively,youmaycustomizeittouseTLSforSIPsignalling.WhenusingTLS,thedefaultportwillbe5061,howeveradifferentonemaybespecified.ChangethisbyusingthetransportparameterintheoriginationSIPURI,andoptionallybyspecifyingadifferentportnumber:
sip:[email protected]:5062;transport=tls
Note:ElasticSIPTrunkingOriginationURIconfigurationsusingthesipsURIschemeinordertoenableend-to-endencryptionisNOTsupportedbyTwilio.However,wedosupportsipURIschemesusingtransport=tlsforpoint-to-pointencryption.
IfyouconfigureyourElasticSIPTrunkingOriginationURIstousesipsschemes,thesesipsURIswillbehandledasiftheyweresipURIsusingTLStransport.TwiliowilleffectivelyadjusttheURIinternallytoinsteadberoutedusingthesipschemeandtransport=tlsontheoutboundmessages,resultinginpoint-to-pointencryptionbetweenTwilioandthecustomerequipment.
TwiliostronglysuggestsnotusingsipsschemesinyourTwilioSIPconfigurations,asthiscouldcausepossiblyunintendedbehavior,duetohowweprocesssuchURIs.Instead,wesuggestusingsipschemeswithTLStransport.Thismethod,alongwiththesecurityofourvoicearchitectureandSuperNetwork,isaneffectivewayofaddingencryptiontoyourTwilioSIPconnections.
Theedgeparameter
TospecifythegeographicedgefromwhichTwiliowillsendtheoriginatingSIPtraffictowardsyourcommunicationinfrastructure,youmustincludetheedgeparameterinyourOriginationSIPURI.Forexample,iftheedge=dublinparameterisincludedinyourOriginationSIPURI,TwiliowillsendtheSIPtrafficfromtheEuropeIrelandedgelocation:
sip:[email protected];edge=dublin
Iftheedgeparameterisnotspecified,TwiliowillsendtheOriginatingSIPtrafficfromtheedgelocationwheretheincomingPSTNcallcomesin.
Note:YoumustmakesureyouallowtheIPaddressesoftheTwilioedgelocationforSIPsignallingandRTPmediatraffic.
Thisparameterwaspreviouslynamedregionanditisstillsupported.Viewalistoflegacyregionidentifiershere.eg:sip:[email protected];region=ie1
UsingMultipleOriginationSIPURIs
Itispossibletoconfigureuptoten(10)OriginationSIPURIswithdifferentpriority&weight.
ThepriorityfielddeterminestheprecedenceofuseoftheSIPURI.TwiliowillalwaysusetheSIPURIwiththelowest-numberedpriorityvaluefirst,andfallbacktootherSIPURIsofequalorhighervalueifthesessiontothatSIPURIfails.
IfaservicehasmultipleoriginationSIPURIswiththesamepriorityvalue,TwiliowillusetheweightfieldtodeterminewhichSIPURItouse.TheweightvalueisrelevantonlyinrelationtootherSIPURIswiththesamepriorityvalue.
PriorityrankstheimportanceoftheURI.Valuesrangefrom0to65535,wherethelowestnumberrepresentsthehighestimportance.WeightisusedtodeterminetheshareofloadwhenmorethanoneURIhasthesamepriority.Itsvaluesrangefrom1to65535.Thehigherthevalue,themoreloadaURIisgiven.
ItispossibletoenableordisableanoriginationSIPURI.WhenanoriginationSIPURIisenabled,it'sactiveintherouteselection.Ifitisnotenabled,thenitwillnotbeusedforroutingtraffictowardsyourcommunicationsinfrastructure.
Inthefollowingexample,boththepriorityandweightfieldsareusedtoprovideacombinationofloadbalancingandfailoverservices.
OriginationSIPURI
Priority
Weight
sip:mysbc1.com
10
60
sip:mysbc2.com
10
20
sip:mysbc3.com
10
20
sip:mysbc-backup.com
20
10
ThefirstthreeSIPURIsshareapriorityof10,sotheweightfield'svaluewillbeusedTwiliotodeterminewhichservertocontact.Thesumofallthreevaluesis100,sosip:mysbc1.comwillbeused60%ofthetime.ThetwoSIPURIssip:mysbc2.comandsip:mysbc3.comwillbeusedfor20%ofrequestseach.Ifsip:mysbc1.comisunavailable,thesetworemainingmachineswillsharetheloadequally,sincetheywilleachbeselected50%ofthetime.
Ifallthreeserverswithpriority10areunavailable,therecordwiththenextlowestpriorityvaluewillbechosen,whichissip:mysbc-backup.com.
Note:IfanyofthefollowingSIPstatuscodesarereturned("2xx","400","404","405","410","416","482","484","486","6xx"),TwiliowillnotfailovertothenextoriginationSIPURI.IfthereisnoSIPresponsefromagivenserver,Twiliowillfailoverafter4seconds.
DisasterRecoveryURL
Inthecaseofadisasterpreventingyourcallsfrombeingdeliveredtoyour
originationSIPURIabove,youcanconfigureaDisasterRecoveryURLpointing
toanapplicationbuiltonTwilio'spowerfulscriptingtoolcalledTwiML.You
canuseTwiMLtobuildanapplicationthatwillmanagecallsasrequiredby
yourdisasterrecoveryplan,includingreplicatingthefunctionalityofyour
PBX(e.g.IVR).
http://fallback.mycompany.com/index
FormoreinformationonbuildingyourTwiMLapplication,pleaserefertothe
TwilioQuickStartandTwiMLAPIGuide.Pleasenotethatwhencallsare
redirectedtoyourdisasterrecoveryURL,normalTwilioVoiceratesapply:seevoice
pricing.
CNAMLookups
CNAMisanacronymwhichstandsforCallerIDName.CNAMisusedtodisplaythecallingparty'snamealongsidethephonenumber,tohelpuserseasilyidentifyacaller.
WhenyouenableCNAMLookup,theCallerIDNameisinsertedintheSIPINVITEviathe“From”,and“Contact”and(ifapplicable)“P-Asserted-Identity”fieldsforeachcaller.
NotethatCNAMlookupsforUS/CAnumbersarebilledperlookup,evenifdatamaynotbeavailable.Currently,requestingCallerIDNameLookupforinternationalnumberswillreturnnullvalues,butwillnotbebilled.
EnablethisFeatureUsingtheTwilioConsole:
ToenableCNAMLookupusingtheconsole,logintotheconsoleandgotothe"ElasticSIPTrunking"section.
WhenyouhaveselectedaTrunk,navigatetothe“Origination”Settings(viatheleft-handsub-menu).Here,youwillseeaswitchwhereyoucanenableCNAMLookup.Youwillknowthesettinghasbeenenabledwhentheswitchhasturned‘blue’andtheword‘ENABLED’appears.
CNAMLookupmustbeenabledonaperTrunkbasis
CNAMLookupisonlysupportedforUS/CAphonenumbers
CNAMLookupisbilledpersuccessfullookup(thisincludesthecasewheretheNameisnotavailableforaNumberintheCNAMNationaldatabases).ItisknownthatmanyAT&TnumbersarenotpublishedtotheCNAMNationaldatabases.
CNAMLookupisbilledpersuccessfullookup,evenifthecallitselffails
CallRedirect
CallredirectenablesyoutoredirectaTrunkingOriginationcall.YourcommunicationsinfrastructurecanredirectanincomingINVITEbyrespondingwithaSIP302(MovedTemporarily).Thisresponsecontainsacontactheaderfieldwiththenewaddressesthatshouldbetried.
Twiliosupportsasingleredirectionpercall:
IfaredirectedtargetalsosendsaSIP302responsetoanothertarget,Twiliowillfailthecall.
TwiliohonorsthefirstURIoftheSIP302response:MultipleURIsintheSIPContactheaderexceptthefirstoneormultipleSIPContactheadersexceptthefirstonewillbeignored.
CallredirectionstowardsTwiliodomains(*.sip.twilio.comor*.pstn.twilio.com)arenotsupported
IfthecallistoaregisteredSIPendpoint,redirectionisnotallowed
TheedgeparameterisnotsupportedinaSIP302contactURI.Theredirectedcallwillusethesameegressedgelocationastheoriginalcall
ThetnxparameterisnotsupportedinaSIP302contactURI.TheredirectedcallwillusethesameInterconnectConnectionastheoriginalcall
IfSecureTrunkingwasusedfortheoriginalINVITEthentheredirectedcallwillalsouseTLS/SRTP
IfCallRecordingwasusedfortheoriginalINVITEthentheredirectedcallwillalsoberecorded
SIPDiversionHeaders
TrunkingOrigination
WhenTwilioreceivesincomingtrafficonyourTwilionumbersfromthePSTNtobedirectedtoyourcommunicationsinfrastructure,itwilladdaSIPDiversionheadernotingtheTwilionumberthatwasdialed.ThisheaderservesasahistoricalrecordthatindicatesthatthecallwasdivertedfromthedialednumbertotheOriginationSIPURIofyourSIPTrunk.AnexampleofwhatthisDiversionheadermightlooklikeisshownbelow.
Diversion:
延伸文章資訊
- 1What is Session Initiation Protocol (SIP)? - Twilio
Using SIP to connect to Twilio is one way to get access to Twilio's global reach and powerful aut...
- 2Inbound - Sending SIP to Twilio
Twilio's Programmable Voice SIP product enables you to use your existing SIP communications infra...
- 3SIP Protocol - Definition & How it Works - ExtraHop
- 4SIP Interface: Add cloud capabilities to your PBX - Twilio
Twilio's SIP capabilities enable us to quickly implement new functionality in our contact center....
- 5What is Session Initiation Protocol (SIP)? - Twilio