[arm-allstar] Randomizing Hourly ID Messages

Kevin Davis blu666z at gmail.com
Sun Apr 23 14:37:47 EDT 2023


I do something like this using a continuously running Python program which
sleeps for a set amount of time, wakes up, chooses a pre-recorded audio
file from a directory and issues the asterisk command to play it back.

With this approach, I can easily add/remove files to an "active
playbacks"directory, changing what files are available to the controller to
playback without having to modify the program itself.  For example if you
have a net on Wednesday, you might have one message that says "join our net
today" and other that says "join out net Wednesday".  End of each
Tuesday/Wednesday, you have another simple script that switches those files
in/out of your active playbacks directory.

I also have a mechanism which will pause the controller indefinitely if it
detects a /tmp file.  Here's the relevant snipper for selecting and playing
a file.  This is inside a larger While loop that does checking for current
keyups/inactivity time so a file isn't played on top of an active QSO.


playback_dir = '/var/lib/asterisk/sounds/playbacks/controller_active/'
pause_playback_file = '/tmp/pause_playback'
playback_pause_loop_sleep_seconds = 60

# Check for Playback Pause
if os.path.exists(pause_playback_file):
while os.path.exists(pause_playback_file):
sleep(playback_pause_loop_sleep_seconds)

continue


# Randomly choose from all files
os.chdir(playback_dir)
playback_files_available = glob('*.ul*')
if not playback_files_available:
break
playback_file = os.path.splitext(choice(playback_files_available))[0]
playback_path = playback_dir + playback_file

# Build comamnd and play
command = "asterisk -rx 'rpt playback 123456 " + playback_path + "'"
os.popen(command)


Hope that helps.

-Kevin (KE7K)


On Sun, Apr 23, 2023 at 10:53 AM Josh Hatton via ARM-allstar <
arm-allstar at hamvoip.org> wrote:

> Afternoon All
>
> I built a HamVoIP controller for a small group recently - They love the
> system - They had an idea to randomize the hourly IDs with several Voice
> IDs.
>
> It doesn't seem it would be too hard to cycle through IDs, but
> "randomizing" them could be the challenging part.
>
> They like the idea of hearing a random message first, then the time and
> wx/temperature (time/temp already in place via rpt.conf).
>
> What am I looking at coding-wise to randomize a few .gsm files, followed by
> the asterisk time/temp?  If randomizing would be tough, even just playing
> one file every hour, in order from a list file, each followed by the
> time/temp would be great.
>
> Your thoughts, ideas etc are appreciated.
>
> 73 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