Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / etc / isdn / answer
CommitLineData
984263bc
MD
1#!/bin/sh
2#---------------------------------------------------------------------------
3#
4# answer script for i4b isdnd
5# ---------------------------
6#
7# $FreeBSD: src/etc/isdn/answer,v 1.4 1999/09/13 15:44:20 sheldonh Exp $
1de703da 8# $DragonFly: src/etc/isdn/answer,v 1.2 2003/06/17 04:24:47 dillon Exp $
984263bc
MD
9#
10# last edit-date: [Thu May 20 11:44:38 1999]
11#
12#---------------------------------------------------------------------------
13VARDIR=/var/isdn
14
15#FreeBSD < 3.1, NetBSD, OpenBSD, BSD/OS
16#LIBDIR=/usr/local/lib/isdn
17#FreeBSD 3.1 and up
18LIBDIR=/usr/share/isdn
19
20LOGFILE=/tmp/answer.log
21NCALLFILE=${VARDIR}/ncall
22DATE=`date +%d%H`
23DF=0
24dF=0
25sF=0
26
27if ! set -- `getopt D:d:s: $*`; then
28 echo 'Usage: answer -D device -d destination -s source'
29 exit 1
30fi
31
32for i ; do
33 case ${i} in
34 -D)
35 DEVICE=$2
36 DF=1
37 shift
38 shift
39 ;;
40 -d)
41 DEST=$2
42 dF=1
43 shift
44 shift
45 ;;
46 -s)
47 SRC=$2
48 sF=1
49 shift
50 shift
51 ;;
52 --)
53 shift
54 break
55 ;;
56 esac
57done
58
59echo "" >>${LOGFILE}
60
61if [ "${DF}" -eq 0 -o "${dF}" -eq 0 -o "${sF}" -eq 0 ]; then
62 echo 'Usage: answer -D device -d destination -s source'
63 exit 1
64fi
65
66echo "answer: device ${DEVICE} destination ${DEST} source ${SRC} " >>${LOGFILE}
67
68if [ -r "${NCALLFILE}" ]; then
69 NCALL=`cat ${NCALLFILE}`
70else
71 NCALL=0
72fi
73
74NCALL=`printf "%.4d" ${NCALL}`
75
76echo Date: `date` >> ${VARDIR}/I.${NCALL}.${DATE}
77
78if [ -n "${SRC}" ]; then
79 echo "From: ${SRC}" >> ${VARDIR}/I.${NCALL}.${DATE}
80fi
81
82if [ -n "${DEST}" ]; then
83 echo "To: ${DEST}" >> ${VARDIR}/I.${NCALL}.${DATE}
84fi
85
86if [ -r "${LIBDIR}/beep.al" ]; then
87 dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k # >/dev/null 2>&1
88fi
89
90if [ -r "${LIBDIR}/msg.al" ]; then
91 dd of=${DEVICE} if=${LIBDIR}/msg.al bs=2k # >/dev/null 2>&1
92 if [ -r "${LIBDIR}/beep.al" ]
93 then
94 dd of=${DEVICE} if=${LIBDIR}/beep.al bs=2k # >/dev/null 2>&1
95 fi
96fi
97
98echo `expr ${NCALL} + 1` >${NCALLFILE}