freebsd-nq/etc/isdn/unknown_incoming
1999-12-14 21:14:28 +00:00

60 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
#---------------------------------------------------------------------------
#
# unknown_incoming - script for isdnd
# -----------------------------------
#
# $Id: unknown_incoming,v 1.2 1999/12/13 21:25:24 hm Exp $
#
# $FreeBSD$
#
# last edit-date: [Mon Dec 13 21:41:51 1999]
#
# This script is called by isdnd when an unknown incoming call
# is received. In case the destination telephone number is
# available, it sends mail with the time, source and destination
# numbers to a configurable address.
#
# For this to work, and entry like this:
#
# regexpr = "<unknown> incoming call from"
# regprog = unknown_incoming
#
# is needed in the system section of /etc/isdn/isdnd.rc.
#
#---------------------------------------------------------------------------
#
# configure: who shall receive the mail
mailaddr=root
#
from=`echo $* | awk '{print $6}'`
to=`echo $* | awk '{print $8}'`
date=`date "+%b %d"`
time=`date "+%H:%M"`
mach=`hostname`
# do nothing if no number available
if [ $from = NotAvailable ]
then
exit 0
fi
# send mail
cat << ENDOFDATA | mail -s "isdnd: unknown incoming telephone call" $mailaddr
On $date at $time a telephone call from a destination
unknown to the isdn daemon came in:
From: $from
To: $to
Sincerly yours,
the isdnd on $mach
ENDOFDATA
exit 0