summaryrefslogtreecommitdiffstats
path: root/etc/isdn/unknown_incoming
blob: 9e26a648609d986b217a8c63b08838b17dd664ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
#---------------------------------------------------------------------------
#
#	unknown_incoming - script for isdnd
#	-----------------------------------
#
# $FreeBSD$
#
#	last edit-date: [Wed Jan 10 13:40:36 2001]
#
#	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.
#
#	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:"
#
#---------------------------------------------------------------------------
#
# 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}'`
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

# configure: how to name the line on which this was received
if [ $test = "ctrl" ]
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"
fi

cat << ENDOFDATA | mail -s "isdnd: unknown incoming telephone call" $mailaddr

Unknown incoming telephone call recognized:

             Date: $date
             Time: $time
             Line: $line
             From: $from
               To: $to

             Sincerly yours,
                   the isdnd on $mach

ENDOFDATA
 
exit 0
OpenPOWER on IntegriCloud