Recording Custom Prompts

Features Asterisk 18+ -- Last reviewed 2026-03-29 recording prompts ivr record playback Found this useful? Upvote it. ×

Recording Custom Prompts

Provide a dial-in extension where administrators or users can record custom greetings and IVR prompts by speaking into the phone. The recording is saved as a sound file and played back immediately for review.

Dialplan

[features]
exten => *99,1,NoOp(Record a custom prompt)
 same => n,Answer()
 same => n,Wait(1)
 same => n,Playback(beep)
 same => n,Record(custom-greeting%d:ulaw)
 same => n,Wait(1)
 same => n,Playback(${RECORDED_FILE})
 same => n,Hangup()

Record with a Specific Filename

[features]
; Record a greeting for a specific mailbox or context
exten => *98,1,NoOp(Record named prompt)
 same => n,Answer()
 same => n,Wait(1)
 same => n,Read(PROMPT_NAME,vm-enter-num-to-call,10)
 same => n,GotoIf($["${PROMPT_NAME}" = ""]?invalid)
 same => n,Playback(beep)
 same => n,Record(custom/${PROMPT_NAME}:wav,,5)
 same => n,Wait(1)
 same => n,Playback(custom/${PROMPT_NAME})
 same => n,Hangup()
 same => n(invalid),Playback(an-error-has-occurred)
 same => n,Hangup()

How it works

  1. Record(filename:format,silence,maxduration,options): Records audio from the caller to a file. Recording stops when the caller presses #, hangs up, or when maxduration seconds elapse. A silence value (in seconds) causes recording to stop after that many seconds of silence.
  2. %d auto-numbering: The %d in the filename is replaced by an auto-incrementing number, so repeated recordings don't overwrite each other: custom-greeting0.ulaw, custom-greeting1.ulaw, etc.
  3. ${RECORDED_FILE}: After Record() completes, this channel variable contains the full path of the recorded file (without extension). Pass it directly to Playback() for immediate review.
  4. Format: :ulaw records in 8kHz G.711 mu-law, native to North American telephony. Use :wav for wideband or :gsm for compressed storage. The format determines the file extension.
  5. Wait(1) before Record: A short delay after Answer() prevents the first fraction of a second of audio from being clipped, and gives the caller time to prepare.

Tips

User Notes

No notes yet. Be the first to contribute a tip or example.

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.

Moderated before publishing. Email never shown.

Related Snippets