I had created a .pdf file which did not paste too well, so I deleted that post and now trying again⌠sorry about that.
The Playnews script and accompanying files are set up for HamVOIP and will not work with ASL3 unless certain modifications are made.
- The ASL3 image does not include Lame, which is needed to convert the .mp3 audio format from ARN and ARRL to .wav files. First the script will download the .mp3 file from either ARN or ARRL, then it will convert the .mp3 file to a .wav file. It will then divide the .wav file into 2.5 minute segments so playback will not cause your node to timeout.
Next, the script will use a utility called âsoxâ to convert the individual .wav files to ulaw, an audio format that the Raspberry Pi can use.
- The script points to the asterisk executable which is located in /usr/bin. The ASL3 asterisk executable is located in /usr/sbin.
- The playnews instructions direct you to navigate to /etc/asterisk/local. There is no /local subdirectory in /etc/asterisk.
- And finally, the playnews script includes a command to force a local ID of your node will it is preparing the files for transmission, for which the HamVOIP version uses /usr/bin/asterisk -rx ârpt fun $NODE *80â. Since the asterisk executable is located in /usr/sbin, and the status command for local ID is different, that part of the script will not work.
Here are the steps that I took to get everything to work in ASL3:
Log in to your server and use the terminal from the Web Admin Portal of the âcockpitâ page, or use the ssh program of your choice to access the command line interface.
Then type sudo -s
Install lame:
apt-get install lame
(the sox program is already present in the ASL3 image- no need to do anything with it)
cd /etc/asterisk
mkdir local
chmod 775 local
cd local
mkdir playnews
chmod 755 playnews
cd playnews
wget http://hamvoip.org/downloads/playnews-0.11.tar.gz
tar xvzf playnews-0.11.tar.gz
This will create all the files in this (playnews) directory.
chmod 750 playnews-0.11
rm playnews-0.11.tar.gz
(We no longer need the tar.gz file, so it can be deleted)
The playnews script uses /tmp to store the audio files used for transmission, but when I tested the playback, I
found that the ARN news worked fine but ARRL news did not. It would begin with, âARRL news will start nowâ, followed immediately by, âARRL news will continue in 20 secondsâ. After about 3 minutes of nothing, ARRL news would skip to the next file segment. I gave up trying to figure that problem out, but at the same time I found a way to create a ramdisk which keeps the script from placing the audio files on the microSD card anyway. The script downloads the news file, performs the conversions from mp3 to wav and then divided into 2.5 minute ulaw audio files that are played back. After the news broadcast ends the script will delete all those files. The constant writing and deleting of files will eventually take its toll on the microSD card.
To set up the ramdisk:
mkdir /etc/ramdisk
nano /etc/fstab
At the end of the file, type:
tmpfs /mnt/ramdisk tmpfs nodev,nosuid,size=200M 0 0
Save the file (ctrl-o) then exit (ctrl-x)
Reboot your node
You can check to see if the ramdisk was created by typing:
df -h |grep ramdisk
The response should look like this:
tmpfs 200M 0 200M 0% /mnt/ramdisk
The next step is to make some changes within the playnews-0.11 script in order to make this all work in ASL3.
cd /etc/asterisk/local/playnews
nano playnews-0.11
Scroll down to line #100 and change TMPDIR=â/tmpâ to:
TMPDIR=â/mnt/ramdiskâ
Change line #255 to:
/usr/sbin/asterisk -rx ârpt $MODE $NODE $TMPDIR/newsâ
Change line #262 to:
/usr/sbin/asterisk -rx ârpt $MODE $NODE $TMPDIR/newsâ
Change line #277 to:
/usr/sbin/asterisk -rx ârpt fun $NODE *711â
Change line #290 to:
/usr/sbin/asterisk -rx ârpt $MODE $NODE $TMPDIR/newsâ
Change line #301 to:
/usr/sbin/asterisk -rx ârpt $MODE $NODE $TMPDIR/newsâ
And finally, change line #308 to:
/usr/sbin/asterisk -rx ârpt $MODE $NODE $TMPDIR/newsâ
Save the file (ctrl-o) then exit (ctrl-x)
Thatâs all there is to it!
From WA3DSP:
You can run it either manually at the command line, set up a DTMF command to run it through a script or more
likely run it in a cron at a specific time.
Here are some examples -
Play Amateur Radio Newsline at 9 PM on Sunday (0 day) queue up at 8:30 PM
to node 40000 globally
30 20 * * 0 /etc/asterisk/local/playnews/playnews-0.11 ARN 21:00 40000
Play ARRL News at 9 PM on Monday (1 day) queue up at 8:30 PM
to node 40000 globally
30 20 * * 1 /etc/asterisk/local/playnews/playnews-0.11 ARRL 21:00 40000
Either of these could have an âLâ last parameter to play only locally.
To play right away, you would only do this manually.
Plays ARRL News NOW to node 40000 locally
/etc/asterisk/local/playnews/playnews-0.11 ARRL NOW 40000 L
When playing now it has a setup time to get and process the file and then you can hit any key to play.
So the basic command syntax would be -
/etc/asterisk/local/playnews/playnews-0.11 ARRL|ARN xx:xx|NOW L|G
G or global is assumed if no last parameter.
If you have any other questions let me know.
73 Doug
WA3DSP
WA3DSP Amateur Radio Resources http://www.crompton.com/hamradio
I made one change to the playnews.ini file which pulls the latest ARRL news sound file directly from ARRL HQ. This is due to the fact that sometimes holidays occur on a Friday, and ARRL does not have the latest news uploaded on that day. Sometimes they upload the Wednesday or Thursday before, and the .ini file directs the script to download the ARRL news dated with Fridayâs date in the filename. This means that on those holiday Fridays, you wonât be getting the latest news because it was uploaded a day or two before, and do not contain Friday in the filname. By changing the ARRL-URL line, the script will be directed to download the latest news sound file regardless of its date.
cd /etc/asterisk/local/playnews
nano playnews.ini
Under the # Set to ARRL URL, put a # in front of
ARRL_URL=âhttp://content.blubrry.com/arrlaudionews/AAN-$(date --date=âlast fridayâ +%Y-%m-%d).mp3â
(You could choose to delete that line entirely and simply replace it, but if for some reason ARRL changes the following URL in the future, it will cause a problem!)
And add the following line below it:
ARRL_URL=âhttps://www.arrl.org/files/file/News/Audio%20News/AudioNews-Latest.mp3â
This is what playnews.ini should look like:
#!/bin/bash
CAUTION
This file is require to provide URLâs to the main playnews script
Set these URLs carefully. If not set correctly playnews will
not work.
SET to Amateur Radio Newslines URL
ARN_URL=âhttps://www.arnewsline.org/s/news.mp3â
Set to ARRL URL
ARRL_URL=âhttps://www.arrl.org/files/file/News/Audio%20News/AudioNews-Latest.mp3â