Silence UP warning.
[dragonfly.git] / etc / isdn / isdntel.sh
blobaca451d13bec3a840d4958f838550fba2583187d
1 #!/bin/sh
2 #---------------------------------------------------------------------------
4 # isdn telephone answering
5 # -------------------------
7 # $FreeBSD: src/etc/isdn/isdntel.sh,v 1.4 1999/09/13 15:44:20 sheldonh Exp $
8 # $DragonFly: src/etc/isdn/isdntel.sh,v 1.2 2003/06/17 04:24:47 dillon Exp $
10 # last edit-date: [Thu May 20 11:45:04 1999]
12 #---------------------------------------------------------------------------
13 #FreeBSD < 3.1, NetBSD, OpenBSD, BSD/OS
14 #LIBDIR=/usr/local/lib/isdn
15 #FreeBSD 3.1 and up
16 LIBDIR=/usr/share/isdn
18 VARDIR=/var/isdn
19 DEVICE=/dev/i4btel0
21 # sounds
22 MESSAGE=${LIBDIR}/msg.al
23 BEEP=${LIBDIR}/beep.al
25 # dd options
26 SKIP=25
28 # max message size
29 MAXMSIZ=100
31 # src and dst telephone numbers
32 src=
33 dst=
35 # current date
36 DATE=`date`
38 # check if directory exists
39 if [ ! -d "${VARDIR}" ]
40 then
41 mkdir ${VARDIR}
44 # get options
45 if ! set -- `/usr/bin/getopt D:d:s: $*`; then
46 echo "usage2: play -D device -d <dest-telno> -s <src-telno>"
47 exit 1
50 # process options
51 for i ; do
52 case $i in
53 -D)
54 DEVICE=$2; shift; shift;
56 -d)
57 dst=$2; shift; shift;
59 -s)
60 src=$2; shift; shift;
62 --)
63 shift; break;
65 esac
66 done
68 # this is a __MUST__ in order to use the fullscreen inteface !!!
70 FILEDATE=`date \+%y%m%d%H%M%S`
72 # echo message to phone
73 if [ -r "${MESSAGE}" ]; then
74 /bin/dd of=${DEVICE} if=${MESSAGE} bs=2k >/dev/null 2>&1
77 # echo beep to phone
78 if [ -r "${BEEP}" ]; then
79 /bin/dd of=${DEVICE} if=${BEEP} bs=2k >/dev/null 2>&1
82 # start time
83 START=`date \+%s`
85 # get message from caller
86 /bin/dd if=${DEVICE} of=${VARDIR}/${FILEDATE}-${dst}-${src} skip=${SKIP} bs=2k count=${MAXMSIZ} >/dev/null 2>&1
88 # end time
89 END=`date \+%s`
91 # duration
92 TIME=`expr ${END} - ${START}`
94 # save recorded message
95 if [ -r "${VARDIR}/${FILEDATE}-${dst}-${src}" ]; then
96 mv ${VARDIR}/${FILEDATE}-${dst}-${src} ${VARDIR}/${FILEDATE}-${dst}-${src}-${TIME}
99 exit 0