Asterisk IVR

From Teknologisk videncenter
Jump to: navigation, search

Leg med extension.conf

; Record voice file to /tmp directory
exten => 1991,1,Wait(1) ; Call 205 to Record new Sound Files
;exten => 1991,2,Playback(/tmp/MitFilNavn) ; Listen to your voice
exten => 1991,2,Record(/tmp/MitFilNavn:gsm) ; Press # to stop recording
exten => 1991,3,Wait(2)
exten => 1991,4,Playback(/tmp/MitFilNavn) ; Listen to your voice
exten => 1991,5,wait(2)
exten => 1991,6,Hangup

Kompliceret eksempel

Example of IVR - Interactce Voice Response - menu in extensions.conf

[mainmenu]
  exten => s,1,Answer
  exten => s,2,SetMusicOnHold(default)
  exten => s,3,DigitTimeout,5
  exten => s,4,ResponseTimeout,10
  ;SAI menu - 1 for tech support, 2 for voicemail, 3 for echo test
  exten => s,5,Background(sai-welcome)
  exten => s,6,Background(sai-choose)

  ; Tech Support
  exten => 1,1,AGI(dima-test.agi)
  exten => 1,2,SetGlobalVar(ACCOUNTCODE=${callerid})
  exten => 1,3,SetVar(testcallerid=${callerid})
  exten => 1,4,Background(sai-reptech-welcome)
  exten => 1,5,Queue(rep-tech)

  ; Leave Voicemail
  exten => 2,1,VoicemailMain()
  exten => 2,2,Hangup

  ; Echo Test
  exten => 3,1,Playback(demo-echotest)
  exten => 3,2,Echo
  exten => 3,3,Playback(demo-echodone)
  exten => 3,4,Goto(mainmenu,s,6)

  ; EAGI Test
  exten => 4,1,Answer()
  exten => 4,2,Wait(1)
  exten => 4,3,AGI(sai-repid.agi)
  exten => 4,4,Wait(1)
  exten => 4,5,Hangup

  ; Play Music-on-Hold
  exten => 5,1,MusicOnHold(default)
  exten => 5,2,Goto(mainmenu,s,6)
  ; #=hangup
  exten => #,1,Playback(sai-thanks)
  exten => #,2,Hangup

  exten => t,1,Goto(#,1)         ; If they take too long, give up
  exten => i,1,Playback(invalid) ; "That's not valid, try again"

 [default]
  include => mainmenu
  include => local
  include => longdistance
  include => joe-iax
  include => npi-iax

  ; Record voice file to /tmp directory
  exten => 205,1,Wait(2) ; Call 205 to Record new Sound Files
  exten => 205,2,Record(/tmp/asterisk-recording:gsm) ; Press # to stop recording
  exten => 205,3,Wait(2)
  exten => 205,4,Playback(/tmp/asterisk-recording) ; Listen to your voice
  exten => 205,5,wait(2)
  exten => 205,6,Hangup

Links