VMware ESXi and vSphere Cluster Management

Record Custom Auto-Attendant Prompts with Asterisk

Learn how to create, test, store, and play back custom telephone prompts in an Asterisk dialplan using the Record application.

Asterisk is open-source telephony and PBX software whose dialplan controls how calls are handled. A dialplan is the call-processing logic that maps contexts, extensions, priorities, and applications.

This lesson shows how to create a telephone-accessible prompt recorder. An administrator or trusted internal user can dial an extension, speak a greeting, press the hash key to finish, and immediately hear the new recording played back.

Why Record Prompts in Asterisk?

An auto attendant is an automated answering system that plays greetings and gives callers routing choices. Typical prompts include a welcome message, a business-hours announcement, an after-hours notice, and menu instructions such as “Press 1 for sales.”

Asterisk can play these messages as sound files. A basic recording workflow does not require professional recording equipment: a suitable telephone handset or registered endpoint can provide the microphone, while Asterisk captures the call audio and stores it as a sound file.

The complete workflow is:

  1. A trusted user dials a dedicated recording extension, such as 700.
  2. The dialplan answers the call.
  3. Asterisk provides an audible recording cue.
  4. The user speaks the prompt.
  5. The user presses the telephone # key to end the recording.
  6. The dialplan pauses briefly and plays the newly created prompt back.
  7. The user evaluates the result and repeats the process if necessary.

This immediate playback is important. It confirms that the recording was created, that Asterisk can read it, and that the audio is clear enough for callers.

Key Asterisk Terms

TermMeaning
ContextA dialplan grouping that controls which extensions a caller may access.
ExtensionA dialable destination and the call-processing steps associated with it.
PriorityThe execution order of steps within an extension.
RecordA dialplan application that captures caller audio and writes it to a sound file.
PlaybackA dialplan application that plays a specified sound prompt to the caller.
DTMFTelephone keypad signaling used to send digits and control actions.
Hash keyThe telephone # DTMF key used here to signal the end of recording.

The Record Application

The Record() application captures audio from the caller and writes it to a file. In the basic workflow, recording starts after Asterisk presents an audible cue. The caller speaks after hearing that cue and presses # when the message is complete.

The recording target is a filename. Include the audio extension in the argument so that the intended format is explicit:

Record(our_greeting.wav)

Here, our_greeting.wav is the complete filename. The .wav extension selects WAV, an audio file format supported for this recording example.

Recording behavior can also be controlled with additional Record() arguments, such as silence detection, maximum duration, and options. The simple example intentionally uses the filename only so the core telephone workflow is easy to understand.

Create a Recording Extension

Place the recording extension in a suitable local or internal context. A context is significant for security: it determines which callers can reach the extension. The following example uses the [local] context and extension 700.

[local]
exten => 700,1,Answer()
same => n,Record(our_greeting.wav)
same => n,Wait(4)
same => n,Playback(our_greeting)
same => n,Hangup()

The example performs five operations in sequence:

  1. Answer() answers the call before media interaction begins.
  2. Record(our_greeting.wav) captures the caller's speech and saves it as a WAV recording. Pressing # ends the recording.
  3. Wait(4) pauses for four seconds after recording completes. This provides a short separation before verification playback.
  4. Playback(our_greeting) plays the newly recorded prompt back to the caller.
  5. Hangup() ends the call cleanly.

The same => n syntax means “continue in this extension at the next priority.” It avoids manually numbering every step and makes the order of a short dialplan easier to read. The first line uses priority 1; each following n advances to the next priority.

Dialplan Execution Sequence

ApplicationPurposeKey Argument or BehaviorPosition in Call Flow
Answer()Answers the call so media interaction can begin.No argument is required in this example.First
Record()Captures caller audio and writes a sound file.Uses a complete target filename such as our_greeting.wav; # ends the recording.After the answer and audible cue
Wait()Pauses call processing.Wait(4) pauses for four seconds.Immediately after recording
Playback()Plays the recorded sound to the caller.Normally uses the sound name without the extension.Verification step
Hangup()Ends the call.No argument is required in this example.Final step

Playback should follow recording as an immediate quality check. If the caller hears silence, clipping, an incomplete sentence, or excessive background noise, the prompt can be recorded again before it is used by the public auto attendant.

Filename and Playback Naming Rules

Record() and Playback() use related but different forms of the name:

ApplicationExample InputWhether Extension Is IncludedResult
RecordRecord(our_greeting.wav)YesCreates the WAV recording using the complete filename.
PlaybackPlayback(our_greeting)Normally noPlays the sound identified by the base name.

Thus, the filename supplied to Record() is our_greeting.wav, while the sound name supplied to Playback() is our_greeting. In this basic arrangement, adding .wav to the Playback() argument can prevent Asterisk from finding the prompt as expected.

Use a consistent naming scheme. Descriptive names such as company_welcome, business_hours, and after_hours make prompts easier to reference from menu logic. Keep the same base name when a prompt is intended to be replaced, or use versioned names while testing a revision.

Where Asterisk Stores the Recording

By default, Asterisk sound files are stored under:

/var/lib/asterisk/sounds/

After a test call, verify that the expected file exists in this directory or in the relevant sound-file location configured for the system. Asterisk must have permission to create the file during recording and permission to read it during playback. Check both ownership and filesystem permissions if the file is missing or playback cannot open it.

The recording target can also use an appropriate subdirectory when your installation has a structured sound-file layout. Keep the path and naming convention consistent with the way your dialplans reference custom prompts.

Test the Prompt-Recording Workflow

Test StepExpected Caller ExperienceWhat to Verify
Dial recording extensionThe call reaches extension 700.The endpoint is registered or otherwise has a working route to the local context.
Hear recording cueAsterisk signals that recording is ready.The call was answered and the caller can hear Asterisk audio.
Speak greetingThe caller speaks the complete message.Use a clear voice, suitable pace, and concise script.
Press #Recording stops.DTMF is transmitted and recognized by Asterisk.
Hear verification playbackThe recorded greeting is played after the pause.The audio is complete, audible, and stored under the expected name.

For a practical test, dial 700 from a registered telephone or another endpoint that can reach the recording context. Listen for the cue, say the greeting, press #, wait through the configured four-second pause, and listen to the returned audio. Repeat the recording if the message is incomplete, too quiet, distorted, or otherwise unsuitable.

Use the Prompt in an Auto Attendant

Once verified, the sound name can be referenced by Playback() or by other menu-related dialplan logic. For example, an auto attendant can play a welcome greeting before presenting choices, play a business-hours notice before the menu, or play an after-hours announcement before routing callers to voicemail.

same => n,Playback(company_welcome)
; Follow with menu and routing logic

Keep the greeting's base name stable when possible. A menu can continue to call Playback(company_welcome) while an administrator prepares a revised file. For safer changes, record a new versioned name, test it from a telephone, and switch the menu reference only after approval. Retain a rollback copy before replacing a production prompt.

Operational and Audio-Quality Practices

  • Record in a quiet environment with a suitable handset or endpoint.
  • Write a concise script and speak clearly at a telephone-appropriate pace.
  • Wait for the recording cue before speaking.
  • Listen to the verification playback before exposing the prompt to external callers.
  • Use descriptive, consistent names for greetings and revisions.
  • Restrict the recording extension to a trusted internal context so unauthorized callers cannot overwrite public-facing prompts.
  • Use versioned filenames or a rollback copy when changing an active greeting.

Troubleshooting

No Recording Cue or No Usable Audio

If the caller does not hear a cue or cannot record, first confirm that the extension is loaded and reachable from the caller's context. Ensure Answer() appears before Record(). Also test two-way media on the endpoint; endpoint, network, codec, or media configuration can prevent audio from reaching Asterisk.

Pressing # Does Not Stop the Recording

The hash key is a DTMF signal. Verify that the endpoint transmits DTMF correctly and that Asterisk recognizes the selected termination key. Test keypad recognition with another controlled dialplan action if necessary.

Playback Cannot Find the Prompt

Use the basename in Playback():

Playback(our_greeting)

Then confirm that the recorded file exists in /var/lib/asterisk/sounds/ or the expected custom sound directory. Check that Asterisk owns the file or otherwise has read access. Also verify that the recording name and location match the dialplan.

The Message Is Silent, Clipped, or Poor Quality

Record again after the cue and try another handset or endpoint. Microphone problems, an unstable media path, codec handling, or speaking before recording begins can produce poor audio. Always review the result through Playback() before deployment.

An Active Greeting Was Overwritten

This usually means the recording extension was available to unauthorized callers or the production filename was reused without a backup process. Limit access to trusted internal contexts, adopt versioned filenames during testing, and use an approval step before changing the live auto-attendant prompt.

Exam-Relevant Notes

  • Answer before Record: the call should be answered before media applications interact with the caller.
  • Record uses the complete filename: include .wav when creating the WAV target.
  • Playback normally uses the sound name: reference our_greeting, not our_greeting.wav.
  • # ends the example recording: this is a DTMF control action.
  • Wait separates the actions: the short pause gives a clear transition into verification playback.
  • Contexts provide access control: place recording extensions where only authorized callers can reach them.
  • Immediate playback validates the workflow: it checks both the audio content and Asterisk's ability to read the saved file.

Summary

Asterisk's Record() application lets a telephone endpoint create custom prompts without specialized recording equipment. A simple extension answers the call, records speech into a named WAV file, waits briefly, plays the prompt back using its basename, and hangs up. After verifying the result and its permissions in the Asterisk sounds directory, the sound name can be used in welcome messages, business-hours announcements, after-hours notices, and auto-attendant menu logic.

For related implementation work, see Record Custom Auto-Attendant Prompts with Asterisk.