Use Asterisk to record prompts

You don’t need to be a professional audio engineer to record sound prompts for your auto attendant system. Asterisk features an application called Record that enables you to record your own custom prompts. This application plays a beep, and then begins recording audio until the caller presses the hash key. The recorded sound is then saved to the specified file.

Write the following code in the dialplan:

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

When you dial the 700 extension, you should hear a beep. Record your greeting and press the hash key (#) when you are done. After 4 seconds you should hear your recorded message. Notice how the application Record takes the entire filename as its argument – the extension specifies the format of the recording (WAV in our case). The Playback application also takes the filename as the argument, but without the extension.

By default, the recorded files will be stored in the /var/lib/asterisk/sounds/ directory.
Geek University 2022