Sie sind auf Seite 1von 8

Search....

LOGIN | REGISTER

Home QuickLinks BusinessVOIP ResidentialVOIP SIP CallCenterSoftware

WholesaleVOIP Forums

View Discussion(4) History

AsteriskSIPchannels
SIPChannelModule
BusinessPBXSolutions
TheSIPChannelModuleenablesAsteriskto
Provider SolutionDetails
communicateviaVOIPwithSIPtelephonesand
exchanges.Asteriskisabletoactas BecomeanITSP
Now!
Becomeaserious
aSIPclient:ThismeansthatAsterisk competitorinVoIP
Immediately
registersasaclienttoanotherSIP FULLConsultancy, Details
Installation,Training&
serverandreceivesandplacescallsto Support
SellHostedIPPBXs,Biz
thisserver.Incomingcallsareroutedto Lines,CallCentre
TurnkeyProvisioningat
anAsteriskextension. yourdatacenter

aSIPserver:Asteriskcanbe
3CXSoftwarePBX
configuredsothatSIPclients(phones,
forWindows,Linux
softwareclients)registertotheAsterisk
andtheCloud
serverandsetupSIPsessionswiththe OpenStandards
SoftwareSolution Details
server,i.e.callsandanswersincoming EasytoInstalland
Manage
calls.Thissaid,Asteriskisnotafull AutoConfiguresPhones
&Trunks
featureSIPserverlikeSIPexpress Android,iOS,Windows
&Macclients
routerorOpenSER.Ifyouaregoingto
*RatesshowndonotincludeE911chargesorgovernmentmandatedtaxes.
havethousandsofSIPphones,you Providersofferingunlimitedcallingplansmayhaverestrictions.Read
shoulduseSERorOpenSERand providerstermsandconditionscarefullybeforebuying.

forwardcallstoAsteriskforvoicemailor
PSTNaccess.
aSIPgateway:AsteriskactsasaMediagatewaybetweenSIP,IAX,MGCP,H.323and
PSTNconnections.Asanexample,anAsteriskservercanbeconnectedtoISDNtogive
yourSIPclientsconnectivitytotheswitchedtelephonynetwork.
WhyisAsterisknotaSIPproxy?

Notes
AsterisksupportsENUMseeAsteriskconfigenum.conf.
AsterisksupportDNSSRVrecords,pointerstoSIPproxyserversforInternetdomains.See
AsteriskSIPsrvlookup
WhenandwhyisAsteriskamediagatewayforSIPcalls?seeAsteriskSIPmediapath
Withabitoftweaking,AsterisksupportsSIPURLdialing.
AsterisksupportsSIPoverUDP,butnotoverTCP.
YoucanstoreyourSIPdevicesinadatabasefordynamicconfiguration,seeAsteriskSIP
MysqlPeers

ConfiguringSIPChannels
ConfigurationofSIPChannelsisdonebymodifyingthesip.conffile.See:

SIPChannelConfiguration

UsingtheDialCommandwithSIPChannels
RecallthattheformatoftheDialcommandislikethis:

Dial(type/identifier,timeout,options,URL)

ForSIPchannels,thetypeisalwaysSIP.Thetimeout,optionsandURLpartsareexplainedontheDial
page.

Theidentifierparametercanbemadeupofuptothreeparts:

[exten@]peer[:portno]

peer:thenameofapeertoconnectto.Thiscanbeoneof:
apeerorfrienddefinedinsip.conf
anIPaddress(e.g.192.168.1.8)
adomainname(e.g.asterisk.org).Fordomainnames,AsteriskwillfirstlookforaDNS
SRVrecordforthatdomainname(Ifthesrvlookupoptionisturnedon).Ifpresent,this
tellsAsteriskwhichcomputeritshouldconnectto.IfthereisnoSRVrecorddefinedfor
thedomain,thenAsteriskwillconnecttothemachinedirectly.
portno:theUDPporttouse.Ifomitted,AsteriskwillusethestandardSIPport,5060.
exten:ifdefined,thenAsteriskwillrequestthepeertoconnectustoextensionexten.

Note:Onlyifyouuseapeerorfriendidentifier(i.e.thetitleofasectioninsip.conf),thecorresponding
optionsforauthenticationetc.willbeused.

HerearesomeexamplesofcompleteDialcommandsastheymightappearinyourDialplan:

exten=>s,1,Dial(SIP/ipphone)Callourpeer"ipphone"whoseconnectiondetailsareinsip.conf
exten=>s,1,Dial(SIP/joshua@ipphone)Callourpeer"ipphone",requestingextension"joshua"
exten=>s,1,Dial(SIP/john@foo.com)Connecttofoo.com,requestingextension"john"
exten=>s,1,Dial(SIP/192.168.1.8:9999,20)Connectto192.168.1.8onport9999,witha20sectimeout.
exten=>s,1,Dial(SIP/8500@sip.com:9876)Connecttosip.comport9876,requestingextension8500.

Asterisk1.8:WhendialingSIPpeers,anewcomponentmaybeaddedtotheendofthedialstringto
indicatethataspecificremoteIPaddressorhostshouldbeusedwhendialingtheparticularpeer.The
dialstringformatis

Dial(SIP/peer/exten/host_or_IP)

DistinctiveRingStyles
Theredoesn'tyetseemtobeastandardforhowtotellaSIPphonethatyouwantittoringwithadistinctive
ring.OnSIPhandsetsthatsupportdistinctiveringatall,theexactmethodofspecifyingdistinctiveringvaries
fromonemodeltoanother.Often(oralways?)itisbysendingaSIP"Alertinfo"header,butwhatthevalue
ofthisheadershouldbeisnotconsistent.IfyoucanfigureoutwhatAlertinfoheaderAsteriskshouldsend,
thenyoucangetAsterisk1.0and1.2tosendsuchaheaderbysettingtheALERT_INFOchannelvariable
beforeyouDial:

exten=>s,1,SetVar(ALERT_INFO=something)
exten=>s,2,Dial(SIP/myphone)

InAsterisk1.0theALERT_INFOisnolongeraspecialvariablethatisinheritedbytheoutgoingchannel.
Instead,agenericmethodofhandlinginheritanceofvariablebasedonprefixingthevariableswithan
underscore"_"(ortwounderscores"__"forpermanentinheritence)hasbeenintroduced.Thefollowing
constructwouldbeusedinsteadoftheabove:

exten=>s,1,SetVar(_ALERT_INFO=something)
exten=>s,2,Dial(SIP/myphone)
AsofAsterisk1.4,settingthe_ALERT_INFOor__ALERT_INFOvariablesnolongerworks.Instead,callthe
SIPAddHeader(AlertInfo:something)AsteriskfuncSIPAddHeaderinyourextensions.confdialplan.Bythe
way,alreadyAsterisk1.2hassupportsforthisnewmethod:

exten=>s,1,SIPAddHeader(AlertInfo:something)
exten=>s,2,Dial(SIP/myphone)

TofindouthowtomakeyourspecificmodelofSIPphonedodistinctivering,trylookingforreference
informationaboutthistopicfrom:
AsteriskConfigurationNotesforSpecificPhones
Google
Yourphoneusermanual
Yourphonemanufacturer'swebsite

Seealso:MySQLcustomringtones

VXML_URL
PhonesrunningtheSCCP(skinny)firmwarehavesomesupportforpushingXMLpages.Ifyouwanttotest
it,setthevariableVXML_URLtopointtoaCiscoXMLfileonawebserver.

ThisaddsinformationtotheSIP"To:"header,anditcouldbeusedforotherpurposesifthereareother
phonesthatcantakeextrainformationinthisway.Forexample:

exten=>s,1,SetVar(VXML_URL=foobar)
exten=>s,2,Dial(SIP/john)

wouldresultinaTo:headerlookingsomethinglikethis:

To:<sip:john@192.168.1.8:5061>foobar

IncomingSIPConnections
WhenAsteriskreceivesanincomingSIPcall,theSIPChannelModule
firsttriestofinda[user]sectionmatchingthecallername(From:username),
thentriestofinda[peer]sectionmatchingthecaller'sIPaddress.
Ifnomatchinguserorpeerisfound,thecallissenttothecontextdefinedinthe[general]
sectionofsip.conf.

Readmoreaboutthison:AsteriskSIPuservspeer

CrossedIncomingSIPLines
Iwasgettingthesipcontextofline1beingplayedoverline2andviceaversa,bothlinesbeingfromthe
sameprovider/fromdomain/host.
Aquickhackistousesomethingsimilartothefollowingintheextensions.confandpointyourincomingsip
contextstoit:

[routecalls]
exten=>s,1,Answer
exten=>s,n,Set(cNum=${SIP_HEADER(TO):5:11})
exten=>s,n,GotoIf($[${cNum}=12223334444]?sipLine1,s,1)
exten=>s,n,GotoIf($[${cNum}=12223335555]?sipLine2,s,1)

[sipLine1]
...code
[sipLine2]
...code

ThisusestheTOparameterofthesipheaderfunctiontocheckthedialedinformationandreturns
somethinglike<sip:12223334444@domain.com>.Thesubstring5:11givesthecallednumbertocheck
againstandjumpcontextsifnecessary,soyourlinecontextscanremaindistinct.FYI,theFROMparameter
returnsthecallerinformation.

FreePBXusersmayalsowishtosee
http://www.aussievoip.com/wiki/How+to+get+the+DID+of+a+SIP+trunk+when+the+provider+doesn%27t+send+it+%28an
whichhassomeadditionalsuggestionsfordealingwiththisproblem,includingwhattodoiftheprovider
sendsausernameratherthananumberintheTOparameter.

NamesofEstablishedSIPConnections
WhenyouhaveanestablishedSIPconnection,itschannelnamewillbeinthisformat:

SIP/peerid

peeristheidentifiedpeerandidisarandomidentifiertobeabletouniquelyidentifymultiplecallsfroma
singlepeer.

SIP/ipphone45ed721cASIPcallfrompeer"ipphone"
SIP/192.168.1.801fb34d6ASIPcallfrom192.168.1.8

NOTE:IhadanapplicationwhereIneededtograbtheusernamefromtheCHANNELVariable.Icouldn't
grabitfromcalleridbecausetheextension(peer)wasdifferentthanthecallerid.ThiscodeworksforaSIP
clientwitha3digitextension.Forlongerextensions,justchangethesecondnumbertothecorresponding
extlength.Ifthechannellookslikethis:

SIP/50145ed721rc

Usethis:
${CHANNEL:4:3}

Andtheresultwillbe:

501Cheers!

NotethatusingtheChanIsAvailcommandwillreturnchannelnamesinthisformat.

TheCutcommandcanbeusefulforextractingthechanneltypefromafullchannelname.Let'ssaythatthe
variableFoohasthevalue"SIP/ipphone45ed721c":

Cut(ChannelType=Foo,/,1)

NowvariableChannelTypehasthevalue"SIP".YoucouldusetheGotoIfcommandtocheckthatachannel
isaSIPchannel:

GotoIf($[${ChannelType}=SIP]?10)

Ifyouwishtoextractjustthepeerfromachannelname,youmightusetwoCuts.IfvariableFoohasthe
value"SIP/ipphone45ed721c",thenafterthesesteps,variableBarwillhavethevalue"ipphone":

Cut(Bar=Foo,/,2)
Cut(Bar=Bar,,1)

Notethatthisassumesyouhavenotdefinedanypeersinyoursip.confthathaveahyphenintheirname.
OtherwiseanattempttoCutthepeerfromsomethinglike"SIP/myname83ee2891"wouldgiveyouonly
"my"!

TheAsteriskConsole
TheSIPChannelModuleaddsextracommandstotheAsteriskCLIConsole.Forexample,

checkthestatusofyourownserver'sSIPregistrationswith"sipshowregistry"
obtainalistofclientsthathaveregisteredwithyourserverwith"sipshowpeers"
afteryoumakechangestoyoursip.conffile,gettheSIPChannelModuletoreloaditwith
"sipreload"(willnotabortactivecalls).

SeeAsteriskCLIConsoleforafulllistofavailableSIPcommandsandtheirusage.

Seealso
Asterisk,SIPandNAT
AsteriskSIPcanreinvite
AsteriskSIPMediaPath
Asteriskfuncsipchaninfo
SIPChannelModuleConfiguration(sip.conf)
SIP:SessionInitiationProtocol

805720viewsstrong.

Asterisk|Channels

Createdby:oej,Lastmodification:Fri12ofAug,2011(19:23)byJustRumours

Linkstothispage...

Pleaseupdatethispagewithnewinformation,justloginandclickonthe"Edit"or"Discussion"tab.Geta
freeloginhere:RegisterThanks!FindusonGoogle+

PageChanges | Comments

Featured

BUSINESSVOIP

RESIDENTIALVOIP
LASTMODIFPAGES
1.IPPBX
2.VoIPHardware
3.HostedPBX
4.VoIPProvidersinVirginia
5.VoIPProvidersinAlaska
6.VoIPProvidersinUtah
7.voipinfo.org
8.ThirdlaneMultiTenant
PBX
9.ThirdlaneBusinessPBX
10.ThirdLane
ShowMore

VOIPSPEEDTEST

GETHELP

Askaquestion
VOIPgatewaycomparisons
byarlestercFri03ofMar,
2017

Re:WhydoeseveryonesayI
can't?
bypetikeFri24ofFeb,2017

Re:WhydoeseveryonesayI
can't?
bybutchmobileThu23of
Feb,2017

ViewMore...

TermsofService|PrivacyPolicy
20032017VOIPInfo.orgLLC

Poweredbybitweaver