#!/bin/bash ######################################################################## # filename: local_echo # description: This is a hacked veriosn of the parrot script written by # VK3JKD. # history: ######################################################################## ######################################################################## # # Convenience functions # # Send message to LOGFILE function log () { MESSAGE=$@ if [ -n "$LOGFILE" ]; then echo "`date '+%b %d %Y %T %z'` ${0##*/}: $MESSAGE" >> $LOGFILE fi } ####################################################################### # # Standard Script Opening # # Make sure we are user repeater!!! if [ `/usr/bin/whoami` != "repeater" ] ; then echo This program must be run as user REPEATER! exit 1 fi # Make sure we have sourced the environment file if [ "$RUN_ENV" != "TRUE" ] ; then . /home/irlp/custom/environment fi while [ TRUE ] ; do if [ -f ${AUDIO}/custom/1beep.wav ] ; then ${BIN}/key usleep ${TXDELAY:-500000} ${BIN}/play ${AUDIO}/custom/1beep.wav usleep 500000 ${BIN}/unkey else ${CUSTOM}/confirm fi echo -n "Waiting for COS..." while $BIN/cosstate ; do usleep 20000 done echo -n "RECORDING..." ${BIN}/record ${AUDIO}/custom/echo.wav >&/dev/null & PID=$! ${BIN}/coscheck kill -INT $PID echo -n "PLAYING..." export LOCKED="YES" while [ $LOCKED = "YES" ] ; do if !( ps ax | grep wavplay | grep connected ) ; then export LOCKED="NO" ; fi usleep 20000 done $BIN/key usleep ${TXDELAY:-500000} if [ ! "$1" = "once" ] && [ -f ${AUDIO}/custom/2beeps.wav ] ; then ${BIN}/play ${AUDIO}/custom/2beeps.wav fi ${BIN}/play ${AUDIO}/custom/echo.wav usleep 500000 ${BIN}/unkey echo "DONE" if [ "$1" = "once" ] ; then end ; exit 0 ; fi done #fi