[asterisk-users] Record() : How to get filename created with %d?

Vincent vincent.delporte at bigfoot.com
Sat Nov 10 17:34:15 CST 2007


	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.

More information about the asterisk-users mailing list