Asterisk Dialplan Show and Tell 1

Asterisk Dialplan Show and Tell 1


NEW FEATURE ALERT!!

I hope to make this a regular feature on my blog. If you have an awesome dialplan that you would like to share, please let me know and I will analyze and feature it here!


My first share is the dialplan that I use for clients who need added features beyond basic calling. This includes call diverts as well as voicemail.


[general]

[globals]

[incoming]
exten => _X.,1,NoOp(CallerID = ${CALLERID(num)})

;;Cleanup Incoming CallerID
same => n,GotoIf($["${CALLERID(num):0:1}" != "+"]?noplusatstart)
same => n,NoOp(Changing Caller ID number from ${CALLERID(num)} to 0${CALLERID(num):3})
same => n,Set(CALLERID(num)=0${CALLERID(num):3})
same => n(noplusatstart),set(CALLERID(name)=${CALLERID(num)})
same => n,NoOp(${CALLERID(num)})

;;If CallForward entry exists, do that
same => n,GotoIf(${DB_EXISTS(CallForward/${EXTEN})}?CallForward)
same => n,Goto(NoCallForward)
same => n(CallForward),Set(ForwardDst=${DB(CallForward/${EXTEN})}) ; Get CFIM key
same => n,Answer()
same => n,Set(CALLERID(num)=${EXTEN})
same => n,Dial(IAX2/outtrunk/${ForwardDst},,t) ; Unconditional forward
same => n,HangUp()

same => n(NoCallForward),NoOp(Skipping Call Forwarding)
same => n,Goto(placecall)

same => n(novoicemail),NoOp(${EXTEN} has no mailbox retry dialling)
same => n(placecall),Dial(SIP/${EXTEN},20)
same => n,Goto(${DIALSTATUS})

same => n(NOANSWER),NoOp(No Answer, divert if set)
same => n(CHANUNAVAIL),NoOp(Call setup failed divert if set)

;;If CallForward entry exists, do that
same => n,GotoIf(${DB_EXISTS(CallForwardAway/${EXTEN})}?CallForwardAway)
same => n,Goto(voicemail)

same => n(CallForwardAway),Set(ForwardDst=${DB(CallForwardBusy/${EXTEN})}) ; Get CFIM key
same => n,Answer()
same => n,Set(CALLERID(num)=${EXTEN})
same => n,Dial(IAX2/outtrunk/${ForwardDst},,t) ; Callforward when noanswer
same => n,HangUp()

same => n(BUSY),NoOp(Busy, go to voicemail)
same => n(voicemail),GotoIf(${VM_INFO(${EXTEN},exists)}?hasvoicemail:novoicemail)
same => n(hasvoicemail),VoiceMail(${EXTEN},u); DID Specific mailbox
same => n,Hangup()


same => n(novoicemail),NoOp(No Voicemail)
same => n,hangup()

[internal]
include => callforward
include => voicemail

[outgoing]
include => internal

exten => _XXX.,1,NoOp(Going Out)
same => n,Dial(IAX2/outtrunk/${EXTEN})
same => n,HangUp()

[callforward]
;Set up always call forwarding
;Client dials *21* followed by the forward destination
exten => _*21*X.,1,Set(DB(CallForward/${CALLERID(NUM)})=${REPLACE(EXTEN:4,*#-)})
same => n,Wait(1)
same => n,Playback(beep)
same => n,Hangup

;Cancel always forward by dialling "**21"
exten => **21,1,DBdel(CallForward/${CALLERID(NUM)})
same  => n,Wait(1)
same  => n,Playback(beep)
same  => n,Playback(beep)
same  => n,Hangup

;Set up unanswered call forwarding
;Client dials *22* followed by the forward destination
exten => _*22*X.,1,Set(DB(CallForwardAway/${CALLERID(NUM)})=${REPLACE(EXTEN:4,*#-)})
same => n,Wait(1)
same => n,Playback(beep)
same => n,Hangup

;Cancel callforwarding when call is unanswered
exten => **22,1,DBdel(CallForwardAway/${CALLERID(NUM)})
same  => n,Wait(1)
same  => n,Playback(beep)
same  => n,Playback(beep)
same  => n,Hangup

[voicemail]
;Allows clients to dial 99 to access their voicemails
exten => 99,1,VoiceMailMain(s${CALLERID(NUM)})
same => n,HangUp()

;This is for SNOM compatibility
exten => asterisk,1,VoiceMailMain(s)
same => n,HangUp()

download
alternative link download

Popular posts from this blog

Assassins Creed Unity Repack V2 CorePack

Descargar Zombie battle royale battle craft survival terbaru full