NEW FEATURE ALERT!!
I promise to brand this a regular characteristic on my blog. If y'all convey an awesome dialplan that y'all would similar to share, delight allow me know together with I volition analyze together with characteristic it here!
My starting fourth dimension portion is the dialplan that I role for clients who require added features beyond basic calling. This includes telephone telephone diverts too equally 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 publish 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, produce 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, produce 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, larn 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 upwardly ever telephone telephone forwarding
;Client dials *21* followed past times the frontwards 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 ever frontwards past times 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 upwardly unanswered telephone telephone forwarding
;Client dials *22* followed past times the frontwards 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 telephone telephone 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()