Some Background
I wanted to play a custom announcement on the ZS-Link Hub Node. I found an easy way to do it.
Make It and Save It
I will use Audacity to record an announcement file or to change an existing pre-recorded WAV file. To record an announcement file open Audacity and record your announcement in mono format. Export the file in WAV format to a folder of your choice. Set Encoding to: Signed 16-bit PCM. The WAVE file will be saved in the folder you choose. If you have an existing pre-recorded file, say mp3 you need to change it to a WAV file by also exporting it to the folder of your choice. We now have a WAV file and it needs to be uploaded to your node.
Upload It
To upload the file to the node, I will be using WinSCP. Open WinSCP and login to you node. Once logged in upload (copy) the WAV file to: /var/lib/asterisk/sounds
With the WAV file now uploaded we need to convert it.
Convert It
You do not need to convert a WAV file to play it from the node but you will agree that WAV files are large files that can easily fill you SD Card. We will convert the WAV file to make a smaller. I use the ulaw extension but you can also use the gsm extension. Both have great audio quality.
I use SOX for converting to ulaw. Open MobaXterm or Putty and connect to your node. Change directory (cd) to cd /var/lib/asterisk/sounds [enter]
Once in "sounds" enter this command:
sox welcome.wav -r 8000 -c 1 -t ul welcome.ul [enter]
The welcome.wav is the file we going to convert to welcome.ul
A new file with ul extension will be created. Look how much smaller this file is than the WAV file. I normally delete the WAV file after the conversion.
Once the ul file is present in "sounds" and the WAV file deleted we need to restart Asterisk by calling astres.sh script at the command promp or just restart Asterisk in the menu.
Play the Audio File over an AllStar Node
Now we can test the file using Asterisk. Go to MobaXterm or Putty. Log in and then go to Start bash shell Interface. Enter asterisk -r at the prompt. This will take you to the CLI prompt. You can also just select Run Asterisk CLI Client from the menu and you will go directly to the CLI prompt.
There is two options to play the file, playback or playlocal. Playback will play the file globally while playlocal will play the file locally.
Command: rpt playback 49355 welcome.ul [enter] or rpt localplay 49355 welcome.ul [enter]
Once you started the play back command the only way to shut it down is to Restart the Asterisk Server.. 49355 is the node number from where the audio file will play.
playback = play through all the nodes, stations, repeaters connected to your node, in other words Global Playback.
localplay = play only local on the node 49355.
Please note you do not need to add an extension after you file name when using the play back command.
Your file will play once you enter the command and press enter.
Now this is the "manual" way to play a file but there is also the "automatic" way to do it by using the CRON setup using crontab -e
The automatic way is not difficult but you must have experience in using CRON. See images of how I use the CRON method for running announcement files. I will not go into detail here how to setup CRON to play announcements at a specific time. Also note that the setup I currently use will overrun any traffic on the node at the time of playing the message. I still need to look at writing a script to prevent this from happening.And that is how I play custom announcements on my AllStar Node.