Record Custom IVR Prompts from a Phone
Record Custom IVR Prompts from a Phone
Sometimes you need to update an IVR greeting and the person who records it does not have SSH access. This extension lets them call in, record, listen back, and re-record until they are happy with it.
The dialplan
[internal]
; Dial *55 to record a custom prompt
exten => *55,1,Answer()
same => n,Playback(beep)
same => n(record),Record(custom-greeting:wav,3,30)
same => n,Playback(beep)
same => n,Playback(custom-greeting)
same => n,Background(vm-rerecord)
same => n,WaitExten(5)
; Press 1 to keep it, 2 to re-record
exten => 1,1,Playback(vm-saved)
same => n,Hangup()
exten => 2,1,Goto(*55,record)
exten => t,1,Playback(vm-saved)
same => n,Hangup()
exten => i,1,Goto(*55,record)
Record(custom-greeting:wav,3,30) records to /var/lib/asterisk/sounds/custom-greeting.wav. The 3 is seconds of silence before stopping, 30 is the maximum length. The caller hears their recording played back, then vm-rerecord ("press 1 to accept, 2 to re-record").
Using the recording in an IVR
Reference the file by name in any Playback() or Background() call:
[from-trunk]
exten => s,1,Answer()
same => n,Background(custom-greeting)
same => n,WaitExten(5)
Storing multiple prompts
Pass an argument to record different prompts:
exten => *551,1,Goto(recorder,s,1)
exten => *552,1,Goto(recorder,s,1)
[recorder]
exten => s,1,Answer()
same => n,Set(PROMPT=custom-prompt-${CALLERID(dnid)})
same => n,Playback(beep)
same => n(record),Record(${PROMPT}:wav,3,30)
same => n,Playback(beep)
same => n,Playback(${PROMPT})
same => n,Background(vm-rerecord)
same => n,WaitExten(5)
exten => 1,1,Playback(vm-saved)
same => n,Hangup()
exten => 2,1,Goto(s,record)
Dial *551 to record custom-prompt-*551.wav, *552 for a different one.
User Notes
Know a tip or gotcha for this topic? Share it below and help others.
Contribute a note
Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.