Asterisk tips phrase recording menu

Simple Sound file (phrase) recording menu

The Asterisk cmd Dictate implements this feature through a dialplan application. Continue reading if you do not want to use the Dictate command.

This is useful if you want to have regular users update menus or other recorded sound files. They can dial the phrase management extention (205 in this example) and enter a phrase number, then record and review what they recorded. Example: Your main menu could use the sound file named 1000, so the user can dial the phrase number 1000 to update the main menu. Another example: You might have a movie theater that needs to update a showtimes messages. The person updating it can dial 205, then the showtimes phrase number and record the new message.

You'll need to record a few initial sound files for the menus:
  • phrase-menu Record to say "Phrase Management - Press 1 to record a phrase, press 2 to review a phrase."
  • enter-phrase-num Record to to say "Enter phrase number followed by #"
  • invalid-option Guess

If you are going to have other users accessing this tool, you can add a few other messages that advise the user of how to use the Recorder.
after-the-beep Record to say "Begin speaking after the beep, then press # to save your message" Insert this after the enter-phrase-nun (exten => 1,2)
You can use the stock file your-msg-has-been-saved that was provided by Allison Asterisk sound files requests, or record one of your own. Insert it after the new message is played back to the user and the 1 second pause (exten => 1,7).

Make the directory /var/lib/asterisk/sounds/custom and save them here.



exten => 205,1,Goto(phrase-menu,s,1)


exten => s,1,Answer                             ; Answer the line
exten => s,2,DigitTimeout,5                     ; Set Digit Timeout to 5 seconds
exten => s,3,ResponseTimeout,10                 ; Set Response Timeout to 10 seconds
exten => s,4,BackGround(custom/phrase-menu)     ; Play main menu.  

; Phrase Recording
exten => 1,1,Wait(1)
exten => 1,2,Read(PHRASEID|custom/enter-phrase-num)
exten => 1,3,Wait(2)  ; give yourself 2 secs to take a breath and wait for beep
exten => 1,4,Record(custom/${PHRASEID}:gsm)
exten => 1,5,Wait(2)
exten => 1,6,Playback(custom/${PHRASEID})
exten => 1,7,Wait(1)
exten => 1,8,Goto(s,2)
; Phrase review
exten => 2,1,Wait(1)
exten => 2,2,Read(PHRASEID|custom/enter-phrase-num)
exten => 2,3,Wait(1)
exten => 2,4,Playback(custom/${PHRASEID})
exten => 2,5,Wait(1)
exten => 2,6,Goto(s,2)

exten => t,1,Hangup

exten => i,1,Playback(custom/invalid-option)
exten => i,2,Goto(s,2)

here is another, in ael, derivated from the one in the comments :

put somewhere in your dial plan :

604 => {Goto recorder-menu-ael|s|1;};

1. Create following directories:
  • /var/lib/asterisk/sounds/recorder/
  • /var/lib/asterisk/sounds/recorder/recordings/

2. Record following prompts, name accordingly and copy into :/var/lib/asterisk/sounds/recorder/

recorder-welcome:Welcome to Asterisk Recorder.
recorder-enter-recording-number:Please enter the the recording number you wish to administer followed by #
recorder-record-after-beep:Please start recordings after the beep to finish press#
recorder-current-recording:The current recording is...
recorder-menu:Press 1 to Accept, Press 2 to review, Press 3 to re-record
recorder-autoreview:Your recording result is ...
recorder-invalid-option:I'm sorry but that is not a valid entry 


context recorder-menu-ael {

    s => {
    Set(TIMEOUT(digit)=5) ; // Set Digit Timeout to 5 seconds
    Set(TIMEOUT(response)=10);   //Set Response Timeout to 10 seconds
    Playback(recorder/recorder-welcome);// Play Asterisk Recorder Welcome.
    Read(PHRASEID|recorder/recorder-enter-recording-number); //Please enter the the prompt number you wish to admimister followed by #    
    BackGround(recorder/recorder-menu); //Press 1 to Accept, Press 2 to review, Press 3 to re-record
    Goto s|recorder-menu;
    // Recording Accept
    1 => { Goto s|enter-number;};

    // recording review
    2 => {Wait(1);Playback(recorder/recorder-current-recording);Playback(recorder/recordings/${PHRASEID});wait(1);goto s|recorder-menu;};
    // re-record
    3 => { Playback(recorder/recorder-record-after-beep);
    Wait(1); //give yourself a moment to take a breath and wait for beep
    goto s|recorder-menu;

    t => { hangup;};
    i => { Playback(recorder/recorder-invalid-option) ; goto s|1;};


See Also

Created by: ghost, Last modification: Thu 04 of Nov, 2010 (05:10 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+