freebsd-skq/etc/isdn/unknown_incoming

80 lines
1.8 KiB
Plaintext
Raw Normal View History

1999-12-14 21:14:28 +00:00
#!/bin/sh
#---------------------------------------------------------------------------
#
# unknown_incoming - script for isdnd
# -----------------------------------
#
# $FreeBSD$
#
# last edit-date: [Wed Jan 10 13:40:36 2001]
1999-12-14 21:14:28 +00:00
#
# This script may be configured to be 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.
1999-12-14 21:14:28 +00:00
#
# 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.
#
# This script has to be configured to the sites needs, look
# for the comment lines start with "configure:"
#
1999-12-14 21:14:28 +00:00
#---------------------------------------------------------------------------
#
# configure: who shall receive the mail
mailaddr=root
#
from=`echo $* | awk '{print $6}'`
to=`echo $* | awk '{print $8}'`
test=`echo $* | awk '{print $9}'`
ctrl=`echo $* | awk '{print $10}'`
1999-12-14 21:14:28 +00:00
date=`date "+%b %d"`
time=`date "+%H:%M"`
mach=`hostname`
# configure: list of destination numbers to ignore
case "$from" in
"NotAvailable" ) exit 0 ;;
"00401234567"* ) exit 0 ;;
"00407654321" ) exit 0 ;;
esac
1999-12-14 21:14:28 +00:00
# configure: how to name the line on which this was received
if [ $test = "ctrl" ]
1999-12-14 21:14:28 +00:00
then
case "$ctrl" in
"1")
line="PBX 1"
;;
"2")
line="PBX 2"
;;
*)
line="controller is $ctrl"
;;
esac
else
line="test is $test, controller is $ctrl"
1999-12-14 21:14:28 +00:00
fi
cat << ENDOFDATA | mail -s "isdnd: unknown incoming telephone call" $mailaddr
Unknown incoming telephone call recognized:
1999-12-14 21:14:28 +00:00
Date: $date
Time: $time
Line: $line
1999-12-14 21:14:28 +00:00
From: $from
To: $to
Sincerly yours,
the isdnd on $mach
ENDOFDATA
exit 0