Sample Code for asterisk Dailplan

  Asterisk

;This context is used to handle all outbound calls.
[test-outbound]

exten => 56782,1,Answer()
exten => 56782,n,Playback(hello-world)
exten => 56782,n,Goto(outbound-allroutes,${EXTEN},1)

;This context is used to handle all inbound calls.
[test-inbound]

exten => 56782,1,Answer()
exten => 56782,n,Playback(hello-world)
exten => 56782,n,Goto(ext-did,${EXTEN},1)

 

============== IVR Script =====================

 

;This context is used to handle all outbound calls.
[test-outbound]

exten => _.,1,GotoIfTime(9:00-17:00,Mon-Fri,*,*?lbl_vdp-outbound_0)
exten => _.,n,Goto(self-service-ivr,s,1)
exten => _.,n(lbl_vdp-outbound_0),Goto(ext-did,${EXTEN},1)

;This context is used to handle all inbound calls.
[test-inbound]

exten => _.,1,GotoIfTime(9:00-17:00,Mon-Fri,*,*?lbl_vdp-inbound_0)
exten => _.,n,Goto(self-service-ivr,s,1)
exten => _.,n(lbl_vdp-inbound_0),Goto(ext-did,${EXTEN},1)

;IVR playyed to the callers after the business hours
[self-service-ivr]

exten => s,1(lbl_self-service-ivr_0),Set(TIMEOUT(response)=5)
exten => s,n,Set(TIMEOUT(digit)=2)
exten => s,n,Background(self-service-menu,m)
exten => s,n,WaitExten(7)
exten => s,n,Hangup()
exten => 1,1,Playback(latest_news)
exten => 1,n,GotoIf($[“${PLAYBACKSTATUS}” = “SUCCESS”]?:lbl_self-service-ivr_1)
exten => 1,n(lbl_self-service-ivr_1),Hangup()
exten => 0,1,Playback(working_time)
exten => 0,n,GotoIf($[“${PLAYBACKSTATUS}” = “SUCCESS”]?:lbl_self-service-ivr_2)
exten => 0,n(lbl_self-service-ivr_2),Hangup()
exten => i,1,Goto(s,lbl_self-service-ivr_0)
exten => t,1,Goto(s,lbl_self-service-ivr_0)

LEAVE A COMMENT