[arm-allstar] Audio Files - Play only when there has not been any traffic

Patrick Perdue borrisinabox at gmail.com
Fri Jan 26 21:54:12 EST 2024


This is pretty open-ended, really.

Without actually writing anything (don't have time right now), I can 
think of a few ways to do it.

One way would be to attach a script or command to an event as defined in 
the events stanza of your node, something like:

[events<yournodenumber>

touch /tmp/tx = s|t|RPT_ETXKEYED
rm /tmp/tx = s|f|RPT_ETXKEYED

In this example, a file is created in /tmp when someone is transmitting 
toward the node, and removed when the transmission stops.

Now, you could write a simple script that plays a file only if /tmp/tx 
doesn't exist, then call it with cron, drive it manually or whatever.

/etc/asterisk/local/notx-announcement.sh

#!/bin/bash
if [ -e /tmp/tx ]
then
echo "nothing to do. Exiting."
exit
else
asterisk -rx "rpt playback <yournode> /etc/asterisk/local/some_file
fi


NOTE! THIS IS UNTESTED!


You could do more sophisticated things, like using timers (sleep) such 
that a file is automatically played after <x> seconds of inactivity 
instead of using the temp file method.

Come to think of it, you could probably also do something with 
lnkacttime, lnkactmacro, and remote_inact_timeout, though I've never 
tried using it that way, either.


73

N2DYI


On 1/26/2024 8:58 PM, Josh Hatton via ARM-allstar wrote:
> Evening!
>
> Interested in what the braintrusts think on how I could code some audio to
> play (Messages, etc.) at times when there is no traffic on a node?
> Basically play only when there has been time without any key-ups or
> activity.
>
> Of course *asterisk** -rx "rpt playback nnnn /etc/asterisk/audio/audiofile"*
> from within rpt.conf or a cron job if they had some sort of awareness of
> node activity.
>
> Any ideas from the braintrust of the group?
>
> Thanks a bunch for your time!
> Josh W4ZZK
> _______________________________________________
>
> 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