[asterisk-dev] temporary file names for monitor files
Matthew J. Roth
mroth at imminc.com
Fri May 30 08:09:14 CDT 2008
Dmitry Andrianov wrote:
> As I understand Asterisk writes data to a file as soon as it receives it on the channel. And this means the file will start getting data almost immediately after creation, not when the call is complete.
>
> Writing to a .tmp file which is later renamed to a file without .tmp suffix is classic way of solving the problem. A LOT of applications do that. Checking modification time is more like a workaround to me.
I have a few other workarounds for determining when a monitor file is
complete. This has drifted into users list territory, so I'll keep it
brief.
1. Replace soxmix with a custom script and pass the 'm' option to
Monitor(). At the end of the call, Asterisk will invoke your script
with 3 arguments, the two leg files and a target mixed filename. You
could try setting the MONITOR_EXEC variable instead of replacing soxmix,
but I found that to be less reliable.
2. MixMonitor() has a 'command' option that will be executed when the
recording is over and the MIXMONITOR_FILENAME variable contains the
filename of the recording. I don't have any personal experience with
this one, but it seems workable.
3. Instead of waiting for the recording file to have no modifications
for a set amount of time, you could use the Linux command 'lsof' to
determine if Asterisk has the file open.
Regards,
Matthew Roth
InterMedia Marketing Solutions
Software Engineer and Systems Developer
More information about the asterisk-dev
mailing list