Background:
I wanted to play a
custom message on my Allstar Node, not just the pre recorded files. I
found an easy way to do it.
Create it:
Create and audio
file using Audacity or an audio editor of your choice. It you
already have and audio file that you would like to play on AllStar
then Import the file using Audacity. Find your audio file and open
it or if you use Import the file will be opened in the Audacity as an
audio track.
The file should be
Mono, 8000 Hz 16-bit PCM with Project Rate set at 8000 Hz. Export as
WAV. Give the file a name (short as possible) Save as type must be
WAV. Encoding can either be Unsigned 8-bit PCM or Signed 16-bit PCM.
Go ahead save it /
export it. In Audacity we use Export
Upload it:
Open WinSCP
(Windows Program) or any other software and connect to your Raspberry
Pi. Upload your WAV file to /var/lib/asterisk/sounds
Convert it:
We will use sox for
converting. Open PuTTY (Windows Program) and connect to the Raspberry
Pi, Change directory to “/var/lib/asterisk/sounds” and enter the
following.
For a GSM File:
sox YOURFILENAME.wav
-r 8000 -c 1 YOURFILENAME.gsm
Note sox and
YOURFILENAME in small letters.
For a U-Law File:
sox YOURFILENAME.wav
-r 8000 -c 1 -t ul YOURFILENAME.ul
Note: sox and YOURFILENAME in small letters.
Now we should have a
new file with either a GSM or U-Law Codec extension. Your choice!!
Please note you cannot have the same file name for gsm
or u-law. Choose a different YOURFILENAME for each Codec.
All we have to do
now is to restart Asterisk Server by using the AllStar dashboard or
calling astres.sh script at the command prompt. After Restart we can
test the file.
Test the File:
Now we can test it
on Asterisk by entering to the CLI:
In PUTTY you should
be in the following directory “/var/lib/asterisk/sounds”. At the
command prompt type :
asterisk -r
enter
PUTTY will now be in
the CLI mode.
In MobaXterm log
into your node and the AllStar dashboard will appear. Select 11 –
Run Asterisk CLI Client. Once enter is pressed you should be at the
CLI prompt.
For World Wide play type:
rpt playback 49355
YOURFILENAME
enter
This will play the
file to all the nodes that you are connected and also on RF Links /
Repeaters
49355 is your node
number.
Please note that you
don’t need to add the extension after your file’s name.
For Local play
type:
rpt localplay 49355
YOURFILENAME
enter
This will play the
file to only your node and your RF Links / Repeaters
49355 is your node
number.
Please note that you
don’t need to add the extension after your file’s name.
I prefer to play the
File while using MobiXterm in Windows.
Playing the file via
CRON:
If you want to play
it via CRON on scheduled time or just play it outside of the CLI just
use:
asterisk -r -x "rpt
playback 12345 YOURFILENAME"
Hope this short
script will be of benefit to you on how to play custom or already
created audio files on your AllStar Node.
Compiled by:
Johan ZS1I
Mossel Bay
27 December 2022