mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-28 12:07:10 +01:00
104 lines
1.6 KiB
Bash
Executable File
104 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
#---------------------------------------------------------------------------
|
|
#
|
|
# answer script for i4b isdnd
|
|
# ---------------------------
|
|
#
|
|
# $Id: answer,v 1.3 1998/12/18 17:17:57 hm Exp $
|
|
#
|
|
# last edit-date: [Fri Dec 18 18:05:20 1998]
|
|
#
|
|
#---------------------------------------------------------------------------
|
|
VARDIR=/var/isdn
|
|
LIBDIR=/usr/local/lib/isdn
|
|
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
|
|
|
|
if [ -f $LIBDIR/beep.g711a ]
|
|
then
|
|
dd of=$DEVICE if=$LIBDIR/beep.g711a bs=2k # >/dev/null 2>&1
|
|
fi
|
|
|
|
if [ -f $LIBDIR/msg.g711a ]
|
|
then
|
|
dd of=$DEVICE if=$LIBDIR/msg.g711a bs=2k # >/dev/null 2>&1
|
|
if [ -f $LIBDIR/beep.g711a ]
|
|
then
|
|
dd of=$DEVICE if=$LIBDIR/beep.g711a bs=2k # >/dev/null 2>&1
|
|
fi
|
|
fi
|
|
|
|
echo `expr $NCALL + 1` >$NCALLFILE
|