[asterisk-users] VM notification to pager and phone

BerkHolz, Steven StevenBerkHolz at TESCOGroup.com
Fri Nov 10 06:33:36 MST 2006


I looked for a reference to do this for some time to replace the callout
feature in my old AVT voicemail.
 
I never found one, so I decided to dig in.
 
Here is my first run.  It is in production, so unless I find a problem,
I am done.
 
Script set to run every 5 min. via cron.

This sets a lock file to prevent 2 scripts from running.
Check for a VM in our Emergency after hours support mailbox.
If found, it sends a numeric page to our rotating pager.
If no one has listened to the mail in 7 minutes, it calls a cell phone.
On this call, it connects directly to a prompt, then VoicemailMain with
the ext. already included.
If no one has listened to the mail in 7 minutes, it calls a second cell
phone.
On this call, it connects directly to a prompt, then VoicemailMain with
the ext. already included.
If no one has listened to the mail in 7 minutes, it calls the rotating
pager again.
This continues to loop until the VM is listened to.

 
isnotify.sh:
----------------------------------------------------------------------
LOCKFILE=/tmp/5134outdial.lock
MESSAGEFILE=/var/spool/asterisk/voicemail/default/5134/INBOX/msg0000.txt
CALLFILE1=/tmp/5134outdial1.call
CALLFILE2=/tmp/5134outdial2.call
CALLFILE3=/tmp/5134outdial3.call
CALLUSER=asterisk
OUTGOING=/var/spool/asterisk/outgoing/
 
date
# echo lock file check
[ -f $LOCKFILE ] && echo $LOCKFILE exists && exit 0
touch $LOCKFILE
 
function recip1 {
if [ -f $MESSAGEFILE ] 
then 
echo $MESSAGEFILE exists! 
echo calling IS pager
echo Channel: ZAP/g0/1XXXXXXX892 >> $CALLFILE1
echo MaxRetries: 2 >> $CALLFILE1
echo RetryTime: 60 >> $CALLFILE1
echo WaitTime: 30 >> $CALLFILE1
echo Context: ext-local >> $CALLFILE1
echo Extension: 5681 >> $CALLFILE1
echo Priority: 1 >> $CALLFILE1
echo "CallerID: IT VoiceMail <XXXXXX5682>" >> $CALLFILE1
chown $CALLUSER:$CALLUSER $CALLFILE1
chmod 664 $CALLFILE1
echo "move"
echo moving $CALLFILE1 to $OUTGOING
mv $CALLFILE1 $OUTGOING
else echo No MV
rm -f $LOCKFILE
exit
fi
sleep 10m
recip2
}
 
function recip2 {
if [ -f $MESSAGEFILE ] 
then 
echo $MESSAGEFILE exists!
echo calling BerkHolz
echo Channel: ZAP/g0/1XXXXXXX083 >> $CALLFILE2
echo MaxRetries: 2 >> $CALLFILE2
echo RetryTime: 60 >> $CALLFILE2
echo WaitTime: 30 >> $CALLFILE2
echo Context: ext-local >> $CALLFILE2
echo Extension: 5682 >> $CALLFILE2
echo Priority: 1 >> $CALLFILE2
echo "CallerID: IT VoiceMail <XXXXXX5682>" >> $CALLFILE2
chown $CALLUSER:$CALLUSER $CALLFILE2
chmod 664 $CALLFILE2
echo moving $CALLFILE2 to $OUTGOING
mv $CALLFILE2 $OUTGOING
else echo No MV
rm -f $LOCKFILE
exit
fi
sleep 10m
recip3
}
 
function recip3 {
if [ -f $MESSAGEFILE ] 
then 
echo $MESSAGEFILE exists!
echo calling Gibson
echo Channel: ZAP/g0/1XXXXXXX061 >> $CALLFILE3
echo MaxRetries: 2 >> $CALLFILE3
echo RetryTime: 60 >> $CALLFILE3
echo WaitTime: 30 >> $CALLFILE3
echo Context: ext-local >> $CALLFILE3
echo Extension: 5682 >> $CALLFILE3
echo Priority: 1 >> $CALLFILE3
echo "CallerID: IT VoiceMail <XXXXXX5682>" >> $CALLFILE3
chown $CALLUSER:$CALLUSER $CALLFILE3
chmod 664 $CALLFILE3
echo moving $CALLFILE3 to $OUTGOING
mv $CALLFILE3 $OUTGOING
else echo No MV
rm -f $LOCKFILE
exit
fi
sleep 10m
recip1
}
 
recip1
rm -f $LOCKFILE
----------------------------------------------------------------------
 
Dial Plan:
----------------------------------------------------------------------
exten => 5681,1,Answer
exten => 5681,n,Wait(3)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(X)
exten => 5681,n,SendDTMF(#)
exten => 5681,n,Macro(hangupcall)
 
exten => 5682,1,Answer
exten => 5682,n,Wait(1)
exten => 5682,n,Macro(user-callerid)
exten => 5682,n,Playback(it-services)
exten => 5682,n,Macro(get-vmcontext,5134)
exten => 5682,n,VoiceMailMain(5134@${VMCONTEXT})
exten => 5682,n,Macro(hangupcall)
----------------------------------------------------------------------
 

Thank You,

Steven BerkHolz
- MCSA - MCSE -
Board member of
www.glimasoutheast.org




More information about the asterisk-users mailing list