Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / etc / isdn / unknown_incoming
CommitLineData
984263bc
MD
1#!/bin/sh
2#---------------------------------------------------------------------------
3#
4# unknown_incoming - script for isdnd
5# -----------------------------------
6#
7# $FreeBSD: src/etc/isdn/unknown_incoming,v 1.1.2.1 2001/08/01 20:34:38 obrien Exp $
1de703da 8# $DragonFly: src/etc/isdn/unknown_incoming,v 1.2 2003/06/17 04:24:47 dillon Exp $
984263bc
MD
9#
10# last edit-date: [Wed Jan 10 13:40:36 2001]
11#
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.
16#
17# For this to work, and entry like this:
18#
19# regexpr = "<unknown> incoming call from"
20# regprog = unknown_incoming
21#
22# is needed in the system section of /etc/isdn/isdnd.rc.
23#
24# This script has to be configured to the sites needs, look
25# for the comment lines start with "configure:"
26#
27#---------------------------------------------------------------------------
28#
29# configure: who shall receive the mail
30mailaddr=root
31#
32from=`echo $* | awk '{print $6}'`
33to=`echo $* | awk '{print $8}'`
34test=`echo $* | awk '{print $9}'`
35ctrl=`echo $* | awk '{print $10}'`
36date=`date "+%b %d"`
37time=`date "+%H:%M"`
38mach=`hostname`
39
40# configure: list of destination numbers to ignore
41case "$from" in
42 "NotAvailable" ) exit 0 ;;
43 "00401234567"* ) exit 0 ;;
44 "00407654321" ) exit 0 ;;
45esac
46
47# configure: how to name the line on which this was received
48if [ $test = "ctrl" ]
49then
50 case "$ctrl" in
51 "1")
52 line="PBX 1"
53 ;;
54 "2")
55 line="PBX 2"
56 ;;
57 *)
58 line="controller is $ctrl"
59 ;;
60 esac
61else
62 line="test is $test, controller is $ctrl"
63fi
64
65cat << ENDOFDATA | mail -s "isdnd: unknown incoming telephone call" $mailaddr
66
67Unknown incoming telephone call recognized:
68
69 Date: $date
70 Time: $time
71 Line: $line
72 From: $from
73 To: $to
74
75 Sincerly yours,
76 the isdnd on $mach
77
78ENDOFDATA
79
80exit 0