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

Baji Panchumarti baji.panchumarti at gmail.com
Sun Nov 11 11:16:35 CST 2007


  On Nov 11, 2007 12:40 AM, Vincent  wrote:

> Thanks, but it won't do, as I need to get the exact filename so
> I can send an e-mail pointing to the file later in the script :-/

 you can generate your own name using a combo of
 STRFTIME() & CALLERID() & CDR() ( and RAND() if you like )

 Set(dtime=${STRFTIME(|America/New_York|%Y%m%d%H%M%S)})

 raw unformatted CDR(start|u) will give you a epoch down to a
 microsec, that is a very fine granularity :

  Set(r_start=${CDR(start|u)})    ;  1191749828.013884

 this will give you ID unique to each call :

       CDR(uniqueid|r)      ;  1191749828.1

 Finally, if you still want to grab the name autogenerated
 by record(), capture it to a temp file and use readfile() to
 extract it :

   TrySystem(/bin/mv -v /tmp/msg%d.wav /var/www/asterisk/ >/tmp/filename)

   ReadFile(filename=/tmp/filename,80)

   Please refer to pages 424, 495 & 512 of the book.

--



More information about the asterisk-users mailing list