login | register
Mon 13 of Oct, 2008 [05:02 UTC]

voip-info.org

Discuss [4] History

Asterisk tips phrase recording menu

Created by: ghost,Last modification on Wed 09 of Apr, 2008 [12:39 UTC] by dean.l

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.

extensions.conf


[default]


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


[phrase-menu]

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

extensions.ael

context recorder-menu-ael {

   s => {
   Answer;
   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.
enter-number:
   Read(PHRASEID|recorder/recorder-enter-recording-number); //Please enter the the prompt number you wish to admimister followed by #    
   Wait(1);
   Playback(recorder/recorder-current-recording);
   Wait(1);
   Playback(recorder/recordings/${PHRASEID});
   Wait(1);
   recorder-menu:
   BackGround(recorder/recorder-menu); //Press 1 to Accept, Press 2 to review, Press 3 to re-record
   //ResponseTimeout(3)
   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
   Record(recorder/recordings/${PHRASEID}:wav);
   Wait(1);
   Playback(recorder/recorder-autoreview);
   Wait(1);                                                                                          
   Playback(recorder/recordings/${PHRASEID});                                                        
   Wait(1);                                                                                                      
   goto s|recorder-menu;
   };

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

};



See Also




Comments

Comments Filter
222

333format_wav.c:147 check_header: Not in mono

by nduchass, Thursday 01 of June, 2006 [16:32:55 UTC]
Problem :
Jun 1 18:36:20 WARNING5761: format_wav.c:147 check_header: Not in mono 2
Jun 1 18:36:20 WARNING5761: file.c:408 ast_filehelper: Unable to open fd on /var/lib/asterisk/sounds/recorder/recorder-current-recording.wav
Jun 1 18:36:20 WARNING5761: file.c:779 ast_streamfile: Unable to open /var/lib/asterisk/sounds/recorder/recorder-current-recording (format ulaw): No such file or directory
Jun 1 18:36:20 WARNING5761: app_playback.c:83 playback_exec: ast_streamfile failed on MGCP/aaln/1@000590134988-1 for /var/lib/asterisk/sounds/recorder/recorder-current-recording
   — Executing Wait("MGCP/aaln/1@000590134988-1", "1") in new stack
   — Executing Playback("MGCP/aaln/1@000590134988-1", "/var/lib/asterisk/sounds/recorder/recordings/1") in new stack

Solution:
Encoding voice in 8KHZ 16 bits MONO 15Kbits/s
222

333Asterisk Recorder

by jbrings, Monday 21 of November, 2005 [12:58:36 UTC]
Based on the above phrase manager example I created a more complete recorder..

First steps:

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

3. Add following code to your extensions,conf or extensions_custom.conf replacing the example extension "604" with your own if desired.

4. This example records files in wav format. if you wish to record in gsm then just change:

exten => 3,3,Record(/var/lib/asterisk/sounds/recorder/recordings/${PHRASEID}:wav)

to

exten => 3,3,Record(/var/lib/asterisk/sounds/recorder/recordings/${PHRASEID}:gsm)

5. Hope this post is sueful to someone out there.


;###################################
;### Asterisk Recorder ###
;###################################

exten => 604,1,Goto(recorder-menu,s,1)

recorder-menu
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,Playback(/var/lib/asterisk/sounds/recorder/recorder-welcome); Play Asterisk Recorder Welcome.
exten => s,5,Read(PHRASEID|/var/lib/asterisk/sounds/recorder/recorder-enter-recording-number); Please enter the the prompt number you wish to admimister followed by #
exten => s,6,Wait(1)
exten => s,7,Playback(/var/lib/asterisk/sounds/recorder/recorder-current-recording)
exten => s,8,Wait(1)
exten => s,9,Playback(/var/lib/asterisk/sounds/recorder/recordings/${PHRASEID})
exten => s,10,Wait(1)
exten => s,11,BackGround(/var/lib/asterisk/sounds/recorder/recorder-menu); Press 1 to Accept, Press 2 to review, Press 3 to re-record

;### Recording Accept ###

exten => 1,1,Goto(s,5)

;### Recording review ###
exten => 2,1,Wait(1)
exten => 2,2,Playback(/var/lib/asterisk/sounds/recorder/recorder-current-recording)
exten => 2,3,Playback(/var/lib/asterisk/sounds/recorder/recordings/${PHRASEID})
exten => 2,4,Wait(1)
exten => 2,5,Goto(s,11)

;### To re-record recording press 3 ###

exten => 3,1,Playback(/var/lib/asterisk/sounds/recorder/recorder-record-after-beep); Please start recordings after the beep to finish press#
exten => 3,2,Wait(1); give yourself a moment to take a breath and wait for beep
exten => 3,3,Record(/var/lib/asterisk/sounds/recorder/recordings/${PHRASEID}:wav)
exten => 3,4,Wait(1)
exten => 3,5,Playback(/var/lib/asterisk/sounds/recorder/recorder-autoreview)
exten => 3,6,Wait(1)
exten => 3,7,Playback(/var/lib/asterisk/sounds/recorder/recordings/${PHRASEID})
exten => 3,8,Wait(1)
exten => 3,9,Goto(s,11)

exten => t,1,Hangup
exten => i,1,Playback(/var/lib/asterisk/sounds/recorder/recorder-invalid-option)
exten => i,2,Goto(s,2)

222

333recording menu

by , Wednesday 13 of October, 2004 [14:30:28 UTC]
(:biggrin:)

Hi i got it working at last just ot mention is that i hade to change the properties for
the directory where the files suppose to be located and whoom it works.

Sincerely a newbie in asterisk but like it a lot.
222

333recording menu

by , Tuesday 12 of October, 2004 [18:54:36 UTC]
(:neutral:)

this page do not include everythog to get started and record a phrase as i understand it.

the directory to custom/phrase-menu suppose to contain a couple of files i believe other wise i do not undrertand how to get this thing working.

I might be right i might be wrong, but explain this a bit better becasue for me it do not get it work at this moment.

Sincerely a newbie in asterisk but like it a lot.