[globals] CUSTOM_RECORDINGS=/var/lib/asterisk/sounds/en/custom [subRecordPrompt] exten => _[A-Za-z0-9].,1,NoOp() ; Safely handle extension name -- this will be our filename same => n,Set(RecordedFilename=${FILTER(A-Za-z0-9,${EXTEN})}) same => n,Set(RandomNumber=${RAND()}) same => n,Answer() ; Record the prompt same => n(record),Playback(please-enter-your&vm-message&after-the-tone) same => n,Wait(1) same => n,Record(${GLOBAL(CUSTOM_RECORDINGS)}/temporaryRecording-${RandomNumber}.wav) ; Ask how we want to handle the recording same => n(handle_recording),Read(ActionItem,vm-review,1) ; Verify we got values we expect same => n,GotoIf($['${ActionItem}' = '1' | '${ActionItem}' = '2' | ${ActionItem}' = 3]?valid_action) same => n,Playback(wrong-try-again-smarty) same => n,Goto(handle_recording) same => n(valid_action),NoOp() ; Handle the recording ; 1 accept ; 2 review ; 3 re-record same => n,GotoIf($['${ActionItem}' = '1']?accept,1) ; keep this recording same => n,GotoIf($['${ActionItem}' = '3']?record) ; re-record it ; If we get here they pressed 2 same => n,Playback(${GLOBAL(CUSTOM_RECORDINGS)}/temporaryRecording-${RandomNumber}) same => n,Goto(handle_recording) exten => accept,1,Verbose(2,Recording accepted!) same => n,System(mv ${GLOBAL(CUSTOM_RECORDINGS)}/temporaryRecording-${RandomNumber}.wav ${GLOBAL(CUSTOM_RECORDINGS)}/${RecordedFilename}.wav) exten => h,1,Verbose(2,Cleanup the file) same => n,System(rm -f ${GLOBAL(CUSTOM_RECORDINGS)}/temporaryRecording-${RandomNumber}.wav)
Page Changes | Comments
Search:
Whitepaper - 10 advantages of a Windows PBX
Free VOIP Publications