Vincent
2007-Nov-10 23:34 UTC
[asterisk-users] Record() : How to get filename created with %d?
Hello About Record(), ATFT 2nd Edition says that "if the filename contains %d, these characters will be replaced with a number incremented by one each time the file is recorded." Problem is, the documentation doesn't explain how to refer to this filename later in the dialplan :-/ In this particular example, I want to move the file to the web server's /htdocs so users can listen to the file through their web browser (ie. with no need to be connected to *), and used TryExec() to do this: ==========exten => cid,1,Set(CALLERIDNAME = ${DB(cidname/${CALLERIDNUM})}) ;Is there a way to use Background() without using _[1-4] below? exten => cid,n,Background(/root/asterisk_sound_files/main_menu) exten => cid,n,Hangup() exten => _[1-4],1,Set(SOFTWARE=${IF($[${EXTEN}=1]?word)}) exten => _[1-4],n,Set(SOFTWARE=${IF($[${EXTEN}=2]?excel)}) exten => _[1-4],n,Set(SOFTWARE=${IF($[${EXTEN}=3]?powerpoint)}) exten => _[1-4],n,Set(SOFTWARE=${IF($[${EXTEN}=4]?support)}) exten => _[1-4],n,Verbose(Choice = ${SOFTWARE}) exten => _[1-4],n,Playback(/root/asterisk_sound_files/leave_msg) exten => _[1-4],n,Record(/tmp/msg%d.wav,3,30) ;move wav to lighttpd's htdocs ;How to get filename? exten => _[1-4],n,TrySystem(mv /tmp/msg%d.wav /var/www/asterisk/) ;ExecIf fails running Verbose() exten => _[1-4],n,ExecIf($[ ${SYSTEMSTATUS} != "SUCCESS" ],Verbose,Failed moving WAV file) exten => _[1-4],n,Playback(/root/asterisk_sound_files/bye_bye) exten => _[1-4],n,Hangup() ========== Any idea? Thank you.
Baji Panchumarti
2007-Nov-11 01:16 UTC
[asterisk-users] Record() : How to get filename created with %d?
On Nov 10, 2007 7:34 PM, Vincent wrote: [...]> exten => _[1-4],n,TrySystem(mv /tmp/msg%d.wav /var/www/asterisk/)[...] TrySystem is passing the cmd to (bash) shell, just give it a file match skeleton as long as you don't have other "msgNNN.wav" files that shouldn't be moved. so exten => _[1-4],n,TrySystem(mv /tmp/msg*.wav /var/www/asterisk/) should move the file(s), escape the * if needed using \* --
Tony Mountifield
2007-Nov-12 09:58 UTC
[asterisk-users] Record() : How to get filename created with %d?
In article <s9fcj31qjgame355t45jv0fdl8hkivtn0o at 4ax.com>, Vincent <vincent.delporte at bigfoot.com> wrote:> Hello > > About Record(), ATFT 2nd Edition says that "if the filename > contains %d, these characters will be replaced with a number > incremented by one each time the file is recorded." > > Problem is, the documentation doesn't explain how to refer to this > filename later in the dialplan :-/I'm a little surprised at the variety of band-aid suggestions that have been posted. All you need to do is refer to "show application record", and you uwill see that the generated filename is available by using ${RECORDED_FILE} ------------------------------------------------------------------------------- -= Info about application 'Record' =- [Synopsis] Record to a file [Description] Record(filename.format|silence[|maxduration][|options]) Records from the channel into a given filename. If the file exists it will be overwritten. - 'format' is the format of the file type to be recorded (wav, gsm, etc). - 'silence' is the number of seconds of silence to allow before returning. - 'maxduration' is the maximum recording duration in seconds. If missing or 0 there is no maximum. - 'options' may contain any of the following letters: 'a' : append to existing recording rather than replacing 'n' : do not answer, but record anyway if line not yet answered 'q' : quiet (do not play a beep tone) 's' : skip recording if the line is not yet answered 't' : use alternate '*' terminator key instead of default '#' If filename contains '%d', these characters will be replaced with a number incremented by one each time the file is recorded. A channel variable named RECORDED_FILE will also be set, which contains the final filemname. Use 'show file formats' to see the available formats on your system User can press '#' to terminate the recording and continue to the next priority. If the user should hangup during a recording, all data will be lost and the application will teminate. ------------------------------------------------------------------------------- Cheers Tony -- Tony Mountifield Work: tony at softins.co.uk - http://www.softins.co.uk Play: tony at mountifield.org - http://tony.mountifield.org