diff options
Diffstat (limited to 'etc/isdn/isdntel.sh')
-rwxr-xr-x | etc/isdn/isdntel.sh | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/etc/isdn/isdntel.sh b/etc/isdn/isdntel.sh index d76885d..14f528a 100755 --- a/etc/isdn/isdntel.sh +++ b/etc/isdn/isdntel.sh @@ -17,9 +17,9 @@ LIBDIR=/usr/share/isdn VARDIR=/var/isdn DEVICE=/dev/i4btel0 -# sounds -MESSAGE=$LIBDIR/msg.al -BEEP=$LIBDIR/beep.al +# sounds +MESSAGE=${LIBDIR}/msg.al +BEEP=${LIBDIR}/beep.al # dd options SKIP=25 @@ -35,36 +35,32 @@ dst= DATE=`date` # check if directory exists -if [ ! -d $VARDIR ] +if [ ! -d "${VARDIR}" ] then - mkdir $VARDIR + mkdir ${VARDIR} fi # get options -set -- `/usr/bin/getopt D:d:s: $*` - -if [ $? != 0 ] -then +if ! set -- `/usr/bin/getopt D:d:s: $*`; then echo "usage2: play -D device -d <dest-telno> -s <src-telno>" exit 1 fi # process options -for i -do +for i ; do case $i in - -D) - DEVICE=$2; shift; shift; - ;; - -d) - dst=$2; shift; shift; - ;; - -s) - src=$2; shift; shift; - ;; - --) - shift; break; - ;; + -D) + DEVICE=$2; shift; shift; + ;; + -d) + dst=$2; shift; shift; + ;; + -s) + src=$2; shift; shift; + ;; + --) + shift; break; + ;; esac done @@ -73,33 +69,30 @@ done FILEDATE=`date \+%y%m%d%H%M%S` # echo message to phone -if [ -f $MESSAGE ] -then - /bin/dd of=$DEVICE if=$MESSAGE bs=2k >/dev/null 2>&1 +if [ -r "${MESSAGE}" ]; then + /bin/dd of=${DEVICE} if=${MESSAGE} bs=2k >/dev/null 2>&1 fi # echo beep to phone -if [ -f $BEEP ] -then - /bin/dd of=$DEVICE if=$BEEP bs=2k >/dev/null 2>&1 +if [ -r "${BEEP}" ]; then + /bin/dd of=${DEVICE} if=${BEEP} bs=2k >/dev/null 2>&1 fi # start time START=`date \+%s` # get message from caller -/bin/dd if=$DEVICE of=$VARDIR/$FILEDATE-$dst-$src skip=$SKIP bs=2k count=$MAXMSIZ >/dev/null 2>&1 +/bin/dd if=${DEVICE} of=${VARDIR}/${FILEDATE}-${dst}-${src} skip=${SKIP} bs=2k count=${MAXMSIZ} >/dev/null 2>&1 # end time END=`date \+%s` # duration -TIME=`expr $END - $START` +TIME=`expr ${END} - ${START}` # save recorded message -if [ -f $VARDIR/$FILEDATE-$dst-$src ] -then - mv $VARDIR/$FILEDATE-$dst-$src $VARDIR/$FILEDATE-$dst-$src-$TIME +if [ -r "${VARDIR}/${FILEDATE}-${dst}-${src}" ]; then + mv ${VARDIR}/${FILEDATE}-${dst}-${src} ${VARDIR}/${FILEDATE}-${dst}-${src}-${TIME} fi exit 0 |