#!/bin/sh # # nopttimeout script for IRLP v0.2 - Robert Pectol (kk7av) # Overcomes the PTT lockout timer by momentarily interrupting # the incoming audio data stream whhile connected to a node # or reflector that has long periods of TX activity with no # breaks. Useful for monitoring Space Shuttle audio, etc. # # # * NOTE * # If the method, as specified below, is set to, 'packet', # then this script requires that your /etc/sudoers file # contains the following line: # # repeater ALL= NOPASSWD: /sbin/iptables # # This MUST be accomplished by editing /etc/sudoers with # the, 'visudo' command as user, root. ################################################################# ################################ # USER CONFIGURABLE SETTINGS # ################################ # How often to interrupt the incoming audio stream. This # is in seconds (ex: 180 is 3 minutes) interrupt_interval="180" # How long to interrupt the incoming audio stream. This is # in micro-seconds (ex: 1000000 is one second) interrupt_time="1000000" # Method used to interrupt the audio stream. Use, 'packet' # to interrupt incoming packets that cary the audio payload. # Use, 'other' to interrupt ispeaker. Either method works # but the packet method is preferred since it's a cleaner # way of accomplishing the interruption. method="packet" # If the method above is specified as, 'packet', then this # specifies the port range to interrupt # (set this to '2074:2093' for IRLP) port="2074:2093" # Feedback during script execution (set to either, 'yes' or, 'no') verbose="no" # Lockfile location (the default is usually fine) lockfile="/tmp/nopttimeout.lock" ############################## # END USER CONFIG SETTINGS # ############################## # test for/create lockfile if [ -e $lockfile ]; then echo "lockfile exists! exiting..." exit 1 else touch $lockfile fi # ensure script is run as repeater user if [ `/usr/bin/whoami` != "repeater" ] ; then exit 1 fi # ensure the environment file has been sourced if [ "$RUN_ENV" != "TRUE" ] ; then . /home/irlp/custom/environment fi # exit cleanly when interrupted trap stop INT TERM EXIT # show user settings (if verbose is set to, 'yes') if [ "$verbose" == "yes" ]; then clear echo "Currently running script in verbose mode. Although" echo "it's a handy way to see what the script is doing," echo "especially for debug purposes, it's not meant to" echo "be left that way. Under, 'normal' circumstances," echo "it's best to set the verbose option to, 'no' in" echo "the USER CONFIGURABLE SETTINGS at the top of the" echo "script. Resuming momentarily..." echo "" sleep 10 echo "Interrupt interval: $interrupt_interval (seconds)" echo "Interrupt time: $interrupt_time (micro-seconds)" if [ "$method" == "packet" ]; then echo "Method: block packets" echo "Port(s) to interrupt: $port" else echo "Method: manipulate ispeaker" fi echo "######################################" echo "" sleep 3 fi interrupt_interval=$(($interrupt_interval + 1)) mainloop() { while true; do count=0 while [ $count -lt $interrupt_interval ]; do sleep 1 if [ -f $LOCAL/.nopttimeout ]; then if [ "$verbose" == "yes" ]; then echo "$0 disabled by $LOCAL/.nopttimeout, exiting..." fi stop fi count=$(($count + 1)) remaining=$(($interrupt_interval - $count)) if [ "$verbose" == "yes" ]; then clear echo "$remaining seconds until interruption..." fi done if [ "$verbose" == "yes" ]; then echo "breaking connection for $interrupt_time uSec..." fi if [ "$method" == "packet" ]; then sudo /sbin/iptables -I INPUT -p udp --dport $port -j DROP else killall ispeaker > /dev/null 2>&1 fi usleep $interrupt_time if [ "$verbose" == "yes" ]; then echo "enabling connection..." fi if [ "$method" == "packet" ]; then sudo /sbin/iptables -D INPUT -p udp --dport $port -j DROP else $SCRIPT/sfswrapper fi done } stop () { if [ "$verbose" == "yes" ]; then echo "$0 - exiting..." fi if [ "$method" == "packet" ]; then sudo /sbin/iptables -D INPUT -p udp --dport $port -j DROP > /dev/null 2>&1 else $SCRIPT/sfswrapper fi rm -f $LOCAL/.nopttimeout > /dev/null 2>&1 rm -f $lockfile > /dev/null 2>&1 exit 0 } mainloop exit 1