[App_rpt-users] Initial / Normal - Sleep/Wake ID'r Script
mike at midnighteng.com
mike at midnighteng.com
Thu Jun 4 13:04:49 UTC 2015
Well, I have a script for you to test.
This is quite a bit different than most scripts.
It is totally a Bash Script that needs to be run from start-up
or from a command line (should do for testing beforehand).
Made/Tested with ACID.
It will copy one of two voice files to your voice id file based on the
internal parameter of ider_state.
This allows for a long id when the repeater is woke-up from sleep. Most of
us that are use to these initial id's use it to state location info and id
and use a short voice id for in active use (awake).
So you need to have those recorded and ready.
I use idmsg1.wav and idmsg2.wav and my id file is idmsg.wav
I'll call the script init-id.sh
If running multi-node on a machine, you might want to make a new filename
like:
init-id-29283.sh
init-id-29284.sh
so you can have separate id's for each node
if you do this, change the /tmp/init-id.txt located in "two places" in the
file to the same unique format.
In rpt.conf
You need to give it a command:ex
909804=cmd,/etc/asterisk/myscripts/init-id-29283.sh
Use the startup macro to call it:ex
startup_macro=*9401,*9410,*909804
You need to edit before running:
Node number
files and locations of your 2 id files and the name of you voice-id file
(idrecording =/etc/asterisk/msg/idmsg) in both locations in the script.
Pay close attention to spaces when editing as it will change things in error.
make the script 775 ownership
After any error fixes i'll offer a revision with a pid that can be killed
by command.
"DO" RUN THIS FROM A COMMAND LINE FOR TEST BEFORE LOADING FROM rpt.conf
and you can use <ctrl>c to break and stop it from command line running it.
change sleep number to 20 for command line testing and 200 when auto
loading to limit file accesses. Assuming a better than 5m id interval.
FYI it takes much longer to write a "how-to" than a script
and is why many of us don't post more.
I would like to hear someone try this on a BBB or rpi2.
Let me know...
Here it is...
#!/bin/bash
# init-id.sh - mike/kb8jnm
# overwrite id files to create initial id & regular id
# based on ider_state variable.
# clean up, use your diectory,file names, node numbers etc.
#
# make a command for calling the script and put that command
# in your start-up macro in rpt.conf.
#
# make ownership of this file 775
#
# -See sleep ### at the bottom is in seconds.
# Lower the value to 20 for testing live from a command line.
# You will see the updates faster.
#
# you may remove all lines that contain echo
# after testing from command line.
#
# It is my hope that this will introduce/better you to bash programming
# and get you creating useful stuff for all.
# preset some parms
idis='wakeid'
# this is a infinate loop
while :
do
# read our parms for node - put in text file - (edit node number)
asterisk -rx "rpt xnode 29283" > /tmp/init-id-29283.txt
# evaluate our parms from that file and only rewrite id if it needs it
while read line
do
echo $line
idsleep='ider_state=2'
idwake='ider_state=1'
if [ "$line" = "$idsleep" ] && [ "$idis" = "wakeid" ]; then
# edit locations and names next line
cp /etc/asterisk/msg/idmsg1.wav /etc/asterisk/msg/idmsg.wav
echo " ** " $line $idsleep "-init ID"
idis='sleepid'
fi
if [ "$line" = "$idwake" ] && [ "$idis" = "sleepid" ]; then
# edit locations and names next line
cp /etc/asterisk/msg/idmsg2.wav /etc/asterisk/msg/idmsg.wav
echo " ** " $line $idwake "-normal ID"
idis='wakeid'
fi
done </tmp/init-id-29283.txt
# show status if running from a command line for test
echo "ID IS " $idis
# wait a bit to limit file access (in seconds)
sleep 200
done
73,
...mike/kb8jnm
More information about the App_rpt-users
mailing list