[arm-allstar] Hamvoip message scripting

Patrick Perdue borrisinabox at gmail.com
Sat Aug 8 13:19:43 EDT 2020


Here's a script I wrote for net announcements, which I call from cron. 
It plays a chime sound (a sine wave that has an envelope) before 
selecting a random file from a folder, then plays 300 ms of silence. I 
found that, on my multi-mode system, sometimes a well-edited file would 
drop out too soon without a pad. YMMV. There are other, probably cleaner 
ways to do this.


#!/bin/bash
path="/var/lib/asterisk/sounds/rpt/net1"
if [ -e "$path" ]
then
id=`find "$path" -type f|shuf -n1`
cat /var/lib/asterisk/sounds/rpt/fx/chime.ulaw $id 
/var/lib/asterisk/sounds/rpt/fx/sil300.ulaw > /tmp/announce.ulaw
asterisk -rx "rpt playback 50631 /tmp/announce"
else
echo "$path not found"
fi


Another example that doesn't concatenate anything, stripping the 
extension of the filename before passing it to Asterisk, since we don't 
want that. Admittedly, I haven't tested this.

#!/bin/bash
path="/var/lib/asterisk/sounds/rpt/net1"
if [ -e "$path" ]
then
id=`find "$path" -type f|shuf -n1`
asterisk -rx "rpt playback 50631 `echo ${id##*/}`"
else
echo "$path not found"
fi

On 8/8/2020 8:12 AM, "Louis Corradi via ARM-allstar" wrote:
> Hello all. My question for the group is; does anyone have a script that will randomize several messages and play them at random on the repeater? I am running a Pi 3B with a URIxB, Hamvoip connected to a UHF repeater. I have several messages that I want the repeater to play randomly at specified intervals. Any help would be appreciated. 73'.
>
> Lou / W2LPC
> Node # 51284
> _______________________________________________
>
> ARM-allstar mailing list
> ARM-allstar at hamvoip.org
> http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar
>
> Visit the BBB and RPi2/3/4 web page - http://hamvoip.org


More information about the ARM-allstar mailing list