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

Vincent vincent.delporte at bigfoot.com
Mon Nov 12 18:27:29 CST 2007


On Mon, 12 Nov 2007 09:58:50 +0000 (UTC), tony at softins.clara.co.uk
(Tony Mountifield) wrote:
>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}

Thanks for the tip. The reason I was looking for another solution is
that I couldn't get the value of the variable... but it's working now.
I'm not comfortable yet with functions/applications, and have no idea
what I did wrong :-/

BTW, what's the difference between functions and applications?

For those interested, here's some working code:

======
exten => 555,1,Record(/tmp/msg%d.wav,3,30)
exten => 555,n,Verbose(${RECORDED_FILE})
exten => 555,n,TrySystem(mv ${RECORDED_FILE}.wav /var/www/asterisk/)
exten => 555,n,ExecIf($[${SYSTEMSTATUS} != SUCCESS],Verbose,Failed
moving WAV file)
======

Another way to generate a filename dynamically, using the current date
+ time:
======
exten =>
_[1-4],n,Set(CALLTIME=${STRFTIME(${EPOCH},GMT+1,%d-%b-%Y-%Hh%M)})
exten => _[1-4],n,Record(/tmp/${CALLTIME}.wav,3,30)
exten => _[1-4],n,TrySystem(mv /tmp/${CALLTIME}.wav
/var/www/asterisk/)
exten => _[1-4],n,ExecIf($[ ${SYSTEMSTATUS} != SUCCESS
],Verbose,Failed moving WAV file)
======

Thanks a lot guys for the help.




More information about the asterisk-users mailing list