MFC r1.3:
[dragonfly.git] / etc / isdn / unknown_incoming
blob2cfe7795455bf96d292faeb0c8530b817f907ac6
1 #!/bin/sh
2 #---------------------------------------------------------------------------
4 # unknown_incoming - script for isdnd
5 # -----------------------------------
7 # $FreeBSD: src/etc/isdn/unknown_incoming,v 1.1.2.1 2001/08/01 20:34:38 obrien Exp $
8 # $DragonFly: src/etc/isdn/unknown_incoming,v 1.2 2003/06/17 04:24:47 dillon Exp $
10 # last edit-date: [Wed Jan 10 13:40:36 2001]
12 # This script may be configured to be called by isdnd when an
13 # unknown incoming call is received. In case the destination
14 # telephone number is available, it sends mail with the time,
15 # source and destination numbers to a configurable address.
17 # For this to work, and entry like this:
19 # regexpr = "<unknown> incoming call from"
20 # regprog = unknown_incoming
22 # is needed in the system section of /etc/isdn/isdnd.rc.
24 # This script has to be configured to the sites needs, look
25 # for the comment lines start with "configure:"
27 #---------------------------------------------------------------------------
29 # configure: who shall receive the mail
30 mailaddr=root
32 from=`echo $* | awk '{print $6}'`
33 to=`echo $* | awk '{print $8}'`
34 test=`echo $* | awk '{print $9}'`
35 ctrl=`echo $* | awk '{print $10}'`
36 date=`date "+%b %d"`
37 time=`date "+%H:%M"`
38 mach=`hostname`
40 # configure: list of destination numbers to ignore
41 case "$from" in
42 "NotAvailable" ) exit 0 ;;
43 "00401234567"* ) exit 0 ;;
44 "00407654321" ) exit 0 ;;
45 esac
47 # configure: how to name the line on which this was received
48 if [ $test = "ctrl" ]
49 then
50 case "$ctrl" in
51 "1")
52 line="PBX 1"
54 "2")
55 line="PBX 2"
58 line="controller is $ctrl"
60 esac
61 else
62 line="test is $test, controller is $ctrl"
65 cat << ENDOFDATA | mail -s "isdnd: unknown incoming telephone call" $mailaddr
67 Unknown incoming telephone call recognized:
69 Date: $date
70 Time: $time
71 Line: $line
72 From: $from
73 To: $to
75 Sincerly yours,
76 the isdnd on $mach
78 ENDOFDATA
80 exit 0