Jared Smith wrote:
> No, unfortunately this was done under NDA, but the general gist goes like
> this:
As it happens, I deployed my solution to this on our live PBX today, which I
wrote with some help from another asterisk-users user. Here is what I
came up with:
Firstly, in features.conf I don't use the normal automon function in the
featuremap, but an applicationmap:
[applicationmap]
recordtovm =>*1,self,Macro,recordtovm
Then in extensions.conf we have the following additions:
[globals]
DYNAMIC_FEATURES=>recordtovm
[macro-recordtovm]
exten =>
s,1,Set(MONITOR_FILENAME=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)})
exten => s,n,Set(DYNAMIC_FEATURES=recordtovm)
exten => s,n,MixMonitor(${MONITOR_FILENAME}.wav,b,/etc/asterisk/recordtovm.pl
${CALLERID(num)} ${MONITOR_FILENAME}.wav)
And finally the perl script recordtovm.pl in /etc/asterisk/ is as follows:
#!/usr/bin/perl -w
#
use strict;
my $monitordir="/var/spool/asterisk/monitor/";
my $vmdir="/var/spool/asterisk/voicemail/default/";
my $vmfolder="INBOX";
my $vmbox=$ARGV[0];
my $vmpath=$vmdir."$vmbox/"."$vmfolder";
my $monitorfilename=$ARGV[1];
opendir (DIR, $vmpath);
my @files = grep(/\.txt$/,readdir(DIR));
closedir(DIR);
my @sortedfiles = sort {$b cmp $a} @files;
my $vmid;
if ($sortedfiles[0] =~ /^(msg)(\d\d\d\d)(.txt)/)
{
$vmid=$2;
$vmid++;
}
else
{
$vmid="0000";
};
open VMFILE,"> $vmpath/msg$vmid.txt";
print VMFILE ";\n";
print VMFILE "; Message Information file\n";
print VMFILE ";\n";
print VMFILE "[message]\n";
print VMFILE "origmailbox=$vmbox\n";
print VMFILE "context=\n";
print VMFILE "macrocontext=\n";
print VMFILE "exten=s\n";
print VMFILE "priority=\n";
print VMFILE "callerchan=\n";
print VMFILE "callerid=\n";
print VMFILE "origdate=\n";
print VMFILE "origtime=\n";
print VMFILE "category=\n";
print VMFILE "duration=\n";
close VMFILE;
if ($ARGV[1])
{
system("mv $monitordir"."$monitorfilename $vmpath/msg$vmid.wav");
};
Seems to work pretty well, we have the Record button on our SNOM phones mapped
to DTMF *1,
so its a single press to start recording. The perl script doesn't populate the
origdate and
origtime fields at the moment so you'll need to add this if you want the time
and date saving
with the message.
Hope this helps,
Ben
_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users