1999-01-10 14:30:53 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# answer script for i4b isdnd
|
|
|
|
# ---------------------------
|
|
|
|
#
|
1999-08-27 23:37:10 +00:00
|
|
|
# $FreeBSD$
|
1999-01-10 14:30:53 +00:00
|
|
|
#
|
1999-05-20 10:14:57 +00:00
|
|
|
# last edit-date: [Thu May 20 11:44:38 1999]
|
1999-01-10 14:30:53 +00:00
|
|
|
#
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
VARDIR=/var/isdn
|
1999-05-20 10:14:57 +00:00
|
|
|
|
|
|
|
#FreeBSD < 3.1, NetBSD, OpenBSD, BSD/OS
|
|
|
|
#LIBDIR=/usr/local/lib/isdn
|
|
|
|
#FreeBSD 3.1 and up
|
|
|
|
LIBDIR=/usr/share/isdn
|
|
|
|
|
1999-01-10 14:30:53 +00:00
|
|
|
LOGFILE=/tmp/answer.log
|
|
|
|
NCALLFILE=$VARDIR/ncall
|
|
|
|
DATE=`date +%d%H`
|
|
|
|
DF=0
|
|
|
|
dF=0
|
|
|
|
sF=0
|
|
|
|
|
|
|
|
set -- `getopt D:d:s: $*`
|
|
|
|
|
|
|
|
if test $? != 0
|
|
|
|
then
|
|
|
|
echo 'Usage: answer -D device -d destination -s source'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i
|
|
|
|
do
|
|
|
|
case "$i"
|
|
|
|
in
|
|
|
|
-D)
|
|
|
|
DEVICE=$2
|
|
|
|
DF=1
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-d)
|
|
|
|
DEST=$2
|
|
|
|
dF=1
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-s)
|
|
|
|
SRC=$2
|
|
|
|
sF=1
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "" >>$LOGFILE
|
|
|
|
|
|
|
|
if [ $DF -eq 0 -o $dF -eq 0 -o $sF -eq 0 ]
|
|
|
|
then
|
|
|
|
echo 'Usage: answer -D device -d destination -s source'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "answer: device $DEVICE destination $DEST source $SRC " >>$LOGFILE
|
|
|
|
|
|
|
|
if [ -f $NCALLFILE ]
|
|
|
|
then
|
|
|
|
NCALL=`cat $NCALLFILE`
|
|
|
|
else
|
|
|
|
NCALL=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
NCALL=`printf "%.4d" $NCALL`
|
|
|
|
|
|
|
|
echo Date: `date` >> $VARDIR/I.$NCALL.$DATE
|
|
|
|
|
|
|
|
if [ "$SRC" != "" ]
|
|
|
|
then
|
|
|
|
echo "From: $SRC" >> $VARDIR/I.$NCALL.$DATE
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$DEST" != "" ]
|
|
|
|
then
|
|
|
|
echo "To: $DEST" >> $VARDIR/I.$NCALL.$DATE
|
|
|
|
fi
|
|
|
|
|
1999-05-20 10:14:57 +00:00
|
|
|
if [ -f $LIBDIR/beep.al ]
|
1999-01-10 14:30:53 +00:00
|
|
|
then
|
1999-05-20 10:14:57 +00:00
|
|
|
dd of=$DEVICE if=$LIBDIR/beep.al bs=2k # >/dev/null 2>&1
|
1999-01-10 14:30:53 +00:00
|
|
|
fi
|
|
|
|
|
1999-05-20 10:14:57 +00:00
|
|
|
if [ -f $LIBDIR/msg.al ]
|
1999-01-10 14:30:53 +00:00
|
|
|
then
|
1999-05-20 10:14:57 +00:00
|
|
|
dd of=$DEVICE if=$LIBDIR/msg.al bs=2k # >/dev/null 2>&1
|
|
|
|
if [ -f $LIBDIR/beep.al ]
|
1999-01-10 14:30:53 +00:00
|
|
|
then
|
1999-05-20 10:14:57 +00:00
|
|
|
dd of=$DEVICE if=$LIBDIR/beep.al bs=2k # >/dev/null 2>&1
|
1999-01-10 14:30:53 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo `expr $NCALL + 1` >$NCALLFILE
|