#!/bin/bash # # Script to rotate Allstar Voice IDs, by K0KN 9/2012, last updated 3-8-2013 # # Usage - Place numbered ID files in the IDBASE folder in sequential # order. For example, id1.ulaw, id2.ulaw, id3.ulaw and so forth # up to the IDMAX number specified. If 8 files are used, for # example, set IDMAX to 8. # # ID is the file specified in RPT.conf for your voice ID. # CUSTOM=/home/kyle IDBASE=/etc/asterisk/id/id # base file names ID=/etc/asterisk/voice_id.ulaw IDMAX=8 # max ID number if [ ! -f $CUSTOM/id_no ] ; then echo "1" >> $CUSTOM/id_no else echo fi # Read current ID number from file IDTOUSE=$(sed -n ""$RAN_ID"p" "$CUSTOM"/id_no) # Increment Variable IDTOUSE=$(( $IDTOUSE + 1 )) # Check for max number if [ "$IDTOUSE" -gt "$IDMAX" ] then IDTOUSE=1 fi echo "Next ID file will be" $IDTOUSE echo $IDTOUSE > "$CUSTOM"/id_no echo "Filename: $IDBASE$IDTOUSE.ulaw" # Make Symlink echo "ln -s -f $IDBASE$IDTOUSE.ulaw $ID" ln -s -f $IDBASE$IDTOUSE.ulaw $ID # done exit 0 fi