wtorek, 16 października 2012

Multi level IVR

Wielopoziomowe menu IVR w Asterisk




[macro-dzwon]
exten => s,1,Ringing
exten => s,n,Background(gsm/prompt 9.1)
exten => s,n,Set(DIRNAME=${STRFTIME(${EPOCH},,%Y%m/%d)}/${CALLERID(NUM)})
exten => s,n,Set(FILENAME=${DIRNAME}/${STRFTIME(${EPOCH},,%H%M%S)}-${EXTEN:2})
exten => s,n,System(/bin/mkdir -p /var/www/monitor/${DIRNAME})
exten => s,n,NoOp(${FILENAME})
exten => s,n,MixMonitor(/var/www/monitor/${FILENAME}.wav,b)
exten => s,n,Set(_doVoicemail=no)
exten => s,n,Queue(CallCenter,n) ;twh
exten => s,n,Hangup



[IVR]
exten => 48XXxxXXxxX,1,Answer
exten => 48XXxxXXxxX,2,Background(gsm/prompt 1.1)
exten => 48XXxxXXxxX,3,Background(gsm/prompt 1.2)
exten => 48XXxxXXxxX,4,Background(gsm/prompt 1.3)
exten => 48XXxxXXxxX,5,Set(TIMEOUT(digit)=20)
exten => 48XXxxXXxxX,6,Set(TIMEOUT(response)=25)
exten => 48XXxxXXxxX,7,WaitExten(5)

;1
exten => 1,1,Answer
exten => 1,n,GoTo(prompt2,200,1)

;2
exten => 2,1,Answer
exten => 2,n,GoTo(prompt3,300,1)

;3
exten => 3,1,Answer
exten => 3,n,GoTo(prompt4,400,1)

;4
exten => 4,1,Answer
exten => 4,n,GoTo(prompt5,500,1)

;5
exten => 5,1,Answer
exten => 5,n,GoTo(prompt6,600,1)

;6
exten => 6,1,Answer
exten => 6,n,GoTo(prompt7,700,1)

;7
exten => 7,1,Answer
exten => 7,n,GoTo(prompt8,800,1)


;Timeout
exten => t,1,Playback(1-4)
exten => t,2,Goto(IVR,48XXxxXXxxX,4)
exten => i,1,Goto(IVR,48XXxxXXxxX,2)


; Record - voicemail
exten => 11,1,Playback(10.2)
exten => 11,n,Wait(2)
exten => 11,n,Set(DIRNAME=${STRFTIME(${EPOCH},,%Y%m/%d)})
exten => 11,n,Set(FILENAME=${DIRNAME}/${CALLERID(NUM)})
exten => 11,n,System(/bin/mkdir -p /var/www/monitor/poczta/${DIRNAME})
exten => 11,n,Record(/var/www/monitor/poczta/${FILENAME}.wav)
exten => 11,n,Wait(2)
exten => 11,n,Playback(/var/www/monitor/poczta/${FILENAME}) ; Listen to your voice
exten => 11,n,wait(2)



[prompt2]
exten => 200,1,Background(gsm/prompt 2.1)
exten => 200,2,WaitExten(5)

exten => 1,1,Background(gsm/prompt 2.1.1)
exten => 1,2,WaitExten(5)
exten => 2,1,Background(gsm/prompt 2.1.2)
exten => 2,2,WaitExten(5)
exten => 3,1,Background(gsm/prompt 2.1.3)
exten => 3,2,WaitExten(5)
exten => 4,1,Background(gsm/prompt 2.1.4)
exten => 4,2,WaitExten(5)
exten => 5,1,Background(gsm/prompt 2.1.5)
exten => 5,2,WaitExten(5)
exten => 6,1,Background(gsm/prompt 2.1.6)
exten => 6,2,WaitExten(5)
exten => 7,1,Background(gsm/prompt 2.1.7)
exten => 7,2,WaitExten(5)
exten => 0,1,Macro(dzwon,1)
exten => t,1,Playback(gsm/prompt 2.2)
exten => t,2,Goto(prompt2,200,1)
exten => i,1,Goto(IVR,48XXxxXXxxX,2)



[prompt3]
exten => 300,1,Background(gsm/prompt 3.1)
exten => 300,2,WaitExten(5)

exten => 1,1,Background(gsm/prompt 3.1.2)
exten => 1,2,WaitExten(5)
exten => 2,1,Background(gsm/prompt 3.1.3)
exten => 2,2,WaitExten(5)
exten => 3,1,Background(gsm/prompt 3.1.4)
exten => 3,2,WaitExten(5)
exten => 4,1,Background(gsm/prompt 3.1.5)
exten => 4,2,WaitExten(5)
exten => 5,1,Background(gsm/prompt 3.1.6)
exten => 5,2,WaitExten(5)
exten => 6,1,Background(gsm/prompt 3.1.7)
exten => 6,2,WaitExten(5)
exten => 7,1,Background(gsm/prompt 3.1.8)
exten => 7,2,WaitExten(5)


exten => 0,1,Macro(dzwon,1)
exten => t,1,Playback(gsm/prompt 3.2)
exten => t,2,Goto(prompt3,300,1)
exten => i,1,Goto(IVR,48XXxxXXxxX,2)


[prompt4]
exten => 400,1,Background(gsm/prompt 4.1)
exten => 400,2,WaitExten(5)

exten => 1,1,GoTo(prompt4.1.2,412,1)
exten => 2,1,Background(gsm/prompt 4.1.3)
exten => 2,2,Macro(dzwon,1)


exten => 0,1,Macro(dzwon,1)
exten => t,1,Playback(gsm/prompt 4.2)
exten => t,2,Goto(prompt3,400,1)
exten => i,1,Goto(IVR,48XXxxXXxxX,2)


[prompt4.1.2]
exten => 412,1,Background(gsm/prompt 4.1.2)
exten => 412,2,WaitExten(5)
exten => 1,1,Macro(dzwon,1)
exten => 2,1,Macro(dzwon,1)
exten => 3,1,Macro(dzwon,1)
exten => 4,1,Macro(dzwon,1)

[prompt4.1.3]
exten => 413,1,Background(gsm/prompt 4.1.3)
exten => 413,2,WaitExten(5)
exten => 1,1,Macro(dzwon,1)
exten => 2,1,Macro(dzwon,1)
exten => 3,1,Macro(dzwon,1)
exten => 4,1,Macro(dzwon,1)
exten => 5,1,Macro(dzwon,1)
exten => 6,1,Macro(dzwon,1)


[prompt5]
exten => 500,1,Background(gsm/prompt 5.1)
exten => 500,2,WaitExten(5)

exten => 1,1,Background(gsm/prompt 5.1.1)
exten => 1,2,WaitExten(5)
exten => 2,1,Background(gsm/prompt 5.1.2)
exten => 2,2,WaitExten(5)
exten => 3,1,Background(gsm/prompt 5.1.3)
exten => 3,2,WaitExten(5)
exten => 4,1,Background(gsm/prompt 5.1.4)
exten => 4,2,WaitExten(5)
exten => 5,1,Background(gsm/prompt 5.1.5)
exten => 5,2,WaitExten(5)
exten => 6,1,Background(gsm/prompt 5.1.6)
exten => 6,2,WaitExten(5)


exten => 0,1,Macro(dzwon,1)
exten => t,1,Playback(gsm/prompt 5.2)
exten => t,2,Goto(prompt5,500,1)
exten => i,1,Goto(IVR,48XXxxXXxxX,2)

[prompt6]
exten => 600,1,Background(gsm/prompt 6.1)
exten => 600,2,WaitExten(5)

exten => 1,1,Macro(dzwon,1)
exten => 2,1,Macro(dzwon,1)

exten => 0,1,Macro(dzwon,1)
exten => t,1,Playback(gsm/prompt 6.2)
exten => t,2,Goto(prompt6,600,1)
exten => i,1,Goto(IVR,48XXxxXXxxX,2)

[prompt7]
exten => 700,1,Background(gsm/prompt 7.1)
exten => 700,2,WaitExten(5)

exten => 1,1,Macro(dzwon,1)
exten => 2,1,Macro(dzwon,1)
exten => 3,1,Macro(dzwon,1)

exten => 0,1,Macro(dzwon,1)
exten => t,1,Playback(gsm/prompt 7.2)
exten => t,2,Goto(prompt7,700,1)
exten => i,1,Goto(IVR,48XXxxXXxxX,2)



[prompt8]
exten => 800,1,Background(gsm/prompt 8.1)
exten => 800,2,WaitExten(5)

exten => 1,1,Macro(dzwon,1)
exten => 2,1,Macro(dzwon,1)
exten => 3,1,Macro(dzwon,1)

exten => 0,1,Macro(dzwon,1)
exten => t,1,Playback(gsm/prompt 8.2)
exten => t,2,Goto(prompt8,800,1)
exten => i,1,Goto(IVR,48XXxxXXxxX,2)