VICIfast
Guides & tutorials

Recording IVR prompts over the phone with agi-record_prompts.agi

agi-record_prompts.agi lets you record audio prompts by dialing a phone extension, choosing the format, and saving files that IVR dialplans can play back immediately.

VICIfast Support
··3 min read
Recording IVR prompts over the phone with agi-record_prompts.agi

Recording audio files for an IVR (interactive voice response) usually means finding a quiet room, a USB microphone, and a conversion utility to get your WAV file into the right format. agi-record_prompts.agi skips all of that. It is a VICIdial AGI (Asterisk Gateway Interface) script that turns a regular phone call into a recording session — you dial the extension, follow the prompts, speak your message, and the file lands directly in Asterisk's sounds directory ready for immediate Dialplan playback.

This matters most when your team is actively iterating on Call recording prompts or when a non-technical user needs to re-record an announcement without SSH access to the server. The whole loop is self-contained: dial, record, confirm, hang up.

How the recording flow works

sequenceDiagram
  participant Caller as Phone Caller
  participant AGI as agi-record_prompts.agi
  participant FS as Asterisk Sounds Dir
  Caller->>AGI: dial extension eg 8167
  AGI-->>Caller: play vm-rec-generic prompt
  Caller->>AGI: speak the recording
  AGI-->>Caller: play vm-review options
  Caller->>AGI: press key to save or re-record
  AGI->>FS: save 8-digit filename.gsm or .wav
  AGI-->>Caller: play vm-msgsaved then vm-goodbye

The script saves files using 8-digit numeric filenames. Those filenames are then directly diallable as extensions in the 851XXXXX range — the playback extension calls Playback(${EXTEN}), so the extension number and the filename are the same string. That naming scheme is what agi-IVR_recording_verification.agi references when it lists prompt filenames like 85100001 in its argument list.

Dialplan setup and arguments

The script takes two arguments separated by five dashes: the Recording format (WAV/MP3) and the timeout in milliseconds. The format is either gsm or wav. GSM is the default format for most VICIdial IVR prompts because Asterisk plays it without conversion overhead. WAV works when you need higher fidelity or plan to edit the file offline. The default timeout is 360000 milliseconds (six minutes), which is long enough for any prompt recording you are likely to need.

; Record in WAV format, 6-minute timeout
exten => 8167,1,Answer
exten => 8167,2,AGI(agi-record_prompts.agi,wav-----360000)
exten => 8167,3,Hangup

; Record in GSM format
exten => 8168,1,Answer
exten => 8168,2,AGI(agi-record_prompts.agi,gsm-----360000)
exten => 8168,3,Hangup

; Playback a recorded prompt by its 8-digit filename
exten => _851XXXXX,1,Answer
exten => _851XXXXX,2,Playback(${EXTEN})
exten => _851XXXXX,3,Hangup

The AGI prompt ID for the recording script itself is 4321 — meaning if your system's prompt says to call a certain number for the recording tool, that is the default extension where the script is wired. You can remap it to any extension that fits your Dialplan numbering plan.

GSM sound files the script uses

The script relies on several standard Asterisk GSM sound files to guide the caller through the session: vm-rec-generic plays the record-now cue, vm-review offers a listen-back option, vm-msgsaved confirms the file was written, and vm-goodbye closes the session. If any of those files are missing from /var/lib/asterisk/sounds, the caller will hear silence at that step and may not know whether the recording was saved.

Files are saved using 8-digit numeric names. If you pass a prompt filename like 85100001 to agi-IVR_recording_verification.agi and that file does not exist in the sounds directory, the IVR step will silently skip the audio and move on without any error to the caller.

For calls where you need to capture a Lead response to a recorded prompt rather than just play one back, that workflow moves into verification IVR territory. The broader context for where these AGI tools fit is in the VICIdial API and AGI overview. If your goal is non-agent recording of live calls rather than prompt creation, the non-agent API guide covers that side of the system.

A managed VICIdial box from VICIfast is provisioned in under 40 seconds with the default dialplan already in place, so you can add your recording extensions and start capturing prompts without any server setup.

About VICIfast LLC

VICIfast LLC operates a managed VICIdial hosting + BYOI service for outbound and inbound call centers. We run the dialers, the carriers, the recordings pipeline, and the compliance plumbing so operators don’t have to.

Citing this article

VICIfast Engineering. “Recording IVR prompts over the phone with agi-record_prompts.agi”. VICIfast LLC, June 28, 2026. Retrieved from https://vicifast.com/blog/use-agi-record-prompts

Have questions?

You might be interested in

VICIfast newsletter

Liked this? Get the next one in your inbox.

We ship the kind of stuff you just read — concrete, numbers-first, no drip. One email when a new post goes live. Unsubscribe in one click.

Comments

Comments are reviewed before they appear. We never publish your email.

No comments yet — be the first.