[asterisk-users] Automon -> Voicemail

Steve Johnson stevej456 at gmail.com
Mon Dec 7 15:12:59 CST 2009


Thanks.  One more feature/automon question:

Is there some way to provide audible feedback (play a specific sound
file) to the initiator that a feature has been activated -- in this
case that recording has started (like "bee-yup") and stopped
("bee-dah"), when you enter in the *1?




On Mon, Dec 7, 2009 at 2:58 PM, Doug Lytle <support at drdos.info> wrote:
> Steve Johnson wrote:
>> Hi all,
>>
>> What's the best method to send automon call recordings (*1) to the
>> voicemail box of the Asterisk user?
>>
>>
>
> I've picked up the following off the list a while ago.  Works pretty
> good.  I do a mysql lookup to see if the user has the ability or not:
>
> __features.conf:__
>
>
> [applicationmap]
>
> recordtovm => *8,self,Macro,recordtovm
>
>
> __Dial plan entry:__
>
> ; ********************************
> ; Call recording, initiated by *8
> ; after hangup, send recording to
> ; callers voice mail box
> ; ********************************
>
> [macro-recordtovm]
>
> exten => s,1,MYSQL(Connect connid localhost username 'supersecret'
> call_recording)
> exten => s,n,GosubIf($["${MYSQL_STATUS}" = "-1"]?mysql_failed,s,6)
> exten => s,n,MYSQL(Query resultid ${connid} SELECT allowed FROM
> Indianapolis WHERE extension = ${CALLERID(number)})
> exten => s,n,MYSQL(Fetch fetchid ${resultid} results)
> exten => s,n,MYSQL(Disconnect ${connid})
> exten => s,n,MYSQL(Clear ${resultid})
> exten => s,n,Set(RECORDING.OK=${results})
> exten => s,n,GotoIf($["${results}" = "Y"]?9:15)
> exten =>
> s,n,Set(MONITOR_FILENAME=${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(num)})
> exten => s,n,Set(ORIG_DATE=${STRFTIME(${EPOCH},,%c)})
> exten => s,n,Set(ORIG_TIME=${STRFTIME(${EPOCH},,%s)})
> exten => s,n,Set(ORIG_CID=${ARG2})
> exten => s,n,Playback(local/stutter)
> exten =>
> s,n,MixMonitor(${MONITOR_FILENAME}.wav,b,/usr/local/bin/recordtovm.pl
> ${CALLERID(num)} ${MONITOR_FILENAME}.wav "${ORIG_DATE}" "${ORIG_TIME}"
> "${ORIG_CID}")
> exten => s,n,NoOP(User allowed to record calls? ${results})
>
>
>
> __Perl script__
>
> cd /usr/local/bin
>
> cat recordtovm.pl
>
> #!/usr/bin/perl -w
> #
> use strict;
>
> my $monitordir="/var/spool/asterisk/monitor/";
> my $vmdir="/var/spool/asterisk/voicemail/sip/";
> my $vmfolder="INBOX";
> my $vmbox=$ARGV[0];
> my $vmpath=$vmdir."$vmbox/"."$vmfolder";
> my $monitorfilename=$ARGV[1];
> my $orig_date=$ARGV[2];
> my $orig_time=$ARGV[3];
> my $orig_cid=$ARGV[4];
>
> 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=$orig_cid\n";
> print VMFILE "origdate=$orig_date\n";
> print VMFILE "origtime=$orig_time\n";
> print VMFILE "category=\n";
> print VMFILE "duration=\n";
> close VMFILE;
>
> if ($ARGV[1])
> {
>     system("mv $monitordir"."$monitorfilename $vmpath/msg$vmid.wav");
> };
>
>
> --
>
> Ben Franklin quote:
>
> "Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."
>
>
> _______________________________________________
> -- 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
>



More information about the asterisk-users mailing list