Macro to play a voice recording

I have had success with creating custom node announcements. Now I would like to have a macro the plays a particular voice file on the local machine whenever executed. Seems simple enough. Help appreciated!

First you need a short script like this:

#! /bin/bash
/usr/sbin/asterisk -rx "rpt localplay 1111 CERTnetTonight"

Replace 1111 with your node number. Note the filename extension is NOT included. The file needs to be in /var/lib/asterisk/sounds or you need to specify the full path.

And then see this post to learn how to call a script:

1 Like

Tim’s suggestion is truly the “macro” way of doing it, for sure. :+1:

Another way I could see one doing this is using the [functionsxxxxx] (where xxxxx = node #) stanza in your /etc/asterisk/rpt.conf file.

I have a line in there like so:

84=localplay,/var/lib/asterisk/sounds/rpt/k4sip_uhf

This will just play the referenced wav on the node with which you’re including it into on functions stanza, short and sweet. (Notice I’ve shoved it into the ‘rpt’ subdirectory under sounds, so that’s why the path looks like that)

So on the node, anytime I dial *84, I can bore anyone with the content of that wav, on-demand. :slight_smile:

Tim’s idea is better though, because not only can you use the bash script, once written, in your macro definition(s) within rpt.conf, you can also use ‘crontab -e’ to edit your crontab into running the same bash script as a timed cron job to execute that sound-playing task daily, hourly, weekly, every 3 hours, whatever… using the ‘rpt localplay xxxxx’ function.

I’m mentioning all this in case it helps anyone else out :slight_smile: Good luck have fun

Byron

2 Likes