Custom voicemail notification

I need a way to send the emailbody= and (preferably) pagerbody= differently based on the voicemail box called.

ie voicemail is left to exten 100 send
pagerbody = .New # ${VM_MSGNUM}) from ${VM_CIDNAME}

and voicemail is left for exten 200 send
pagerbody = .on ${VM_DATE} ${VM_CIDNAME} left a voicemail

Can anyone help?

I would also like to be able to call a list of numbers, play the time/date the voicemail was left and the actual voicemail to the answerer and dial back every 10 minutes for an hour until someone answers if they are not reached on the first call.

The reason being my Daughter is pregnant and I need to notify by telephone and email/SMS in the form of XXXXXXXXXX@txt.att.com a number of people when she gets to the hospital and I really don’t want to have to worry about calling them all one by one and would prefer an automated service.

Thank you

Have you thought of using a script to handle it:

mailcmd=nice -n 19 /etc/asterisk/bin/sendvoicemail.sh ${VM_MAILBOX}

then within your script you could personalize based on the parameter.

makafre,

Would you happen to have what that script would be like please sir… I have need for the same results
but I have no clue on how to write that script…

Thank you,

amphibian

Sir,

Did you get this to work?

Thanks

Here is a starter;

voicemail.conf:

mailcmd = nice -n 19 /etc/asterisk/bin/sendvoicemail.pl

sendvoicemail.pl:

#!/usr/bin/perl

use strict;
use warnings;

#--- Initialize variables

my $subject;
my $recipient;
my $name;
my $from;
my $time;
my $duration;
my $mailbox;
my $context;
my $filename;
my $file = '/tmp/astmail';

#--- Create asterisk mail file given with stdin

open ASTMAIL, ">$file" or die $!;
print ASTMAIL <STDIN>;
close ASTMAIL;

#--- Now read the file and fetch the different fields

open my $input, $file or die "Could not open $file: $!";

while(my $line = <$input>)  {
        if ($line =~ /Subject: (.*)/)   { $subject = $1; }
        if ($line =~ /Name: (.*)/)      { $name = $1; }
        if ($line =~ /From: (.*)/)      { $from = $1; }
        if ($line =~ /To: (.*)/)        { $recipient = $1; }
        if ($line =~ /Time: (.*)/)      { $time = $1; }
        if ($line =~ /Duration: (.*)/)  { $duration = $1; }
        if ($line =~ /Extension: (.*)/) { $mailbox = $1; }
        if ($line =~ /Context: (.*)/)   { $context = $1; }
        if ($line =~ /filename="(.*)"/) { $filename = $1; last; }
}

close $input;

#--- Manipulate the variables

$recipient =~ s/,/>' -t '</g;
$recipient =~ s/<//g;
$recipient =~ s/>//g;
my $pathfile = "/var/spool/asterisk/voicemail/$context/${mailbox}/INBOX/$filename";

print STDERR "Subject: $subject\n";
print STDERR "Name: $name\n";
print STDERR "From: $from\n";
print STDERR "Recipient: $recipient\n";
print STDERR "Time: $time\n";
print STDERR "Duration: $duration\n";
print STDERR "Mailbox: $mailbox\n";
print STDERR "Context: $context\n";
print STDERR "Filename: $filename\n";
print STDERR "Pathfile: $pathfile\n";

#--- further processing....(e.g. construct html email)

....

#--- E-mail sending (can use any email script)

sendEmail($recipient, $subject, $body, $pathfile);