k6irk
October 8, 2024, 1:28am
1
I am running ASL3 -
Asterisk : 20.9.3+asl3-3.0.6.1.deb12
ASL [app_rpt] : 3.0.6
Running on a Pi4
The command I used was:
/usr/bin/asl-play-arn --node 620301
Nothing showed as happening, so I did the debug mode and this is what I got:
root@node620301:/home/Trebor57# /usr/bin/asl-play-arn --node 620301 --debug
play-arn: main : DEBUG: MP3_OUT: /tmp/tmpn3osslpq.mp3
play-arn: main : DEBUG: WAV_OUT: /tmp/tmpew3uvk7m.wav
play-arn: main : DEBUG: UL_OUT: /tmp/tmp2jtziimj.ul
play-arn: main : DEBUG: Convert MP3 to WAV: lame -h -S --decode /tmp/tmpn3osslpq.mp3 /tmp/tmpew3uvk7m.wav
play-arn: main : DEBUG: Convert WAV to ULAW: sox -v 0.7 /tmp/tmpew3uvk7m.wav -r 8k -c 1 -t ul /tmp/tmp2jtziimj.ul
play-arn: main : DEBUG: Play Asterisk: [‘asterisk’, ‘-rx’, ‘rpt playback 620301 /tmp/tmp2jtziimj’]
play-arn: main : DEBUG: sleeping for 15 seconds for playback to start
root@node620301:/home/Trebor57#
But nothing happens at all, no audio or anything.
What do I have wrong here?
73
Rob
This seems to be a file permissions issue with the temporary ulaw file created. Apparently the asterisk service cannot access the file.
I was able to get it working on my node by adding a few lines to /usr/bin/asl-play-arn
to give read permissions on the temporary file to all users.
Near the top of the file, I added two imports to the end of the import section:
import os
import stat
Further down, I added the line:
os.chmod(UL_OUT.name, stat.S_IROTH)
Here is a screencap of where I added it:
Note: Be sure you use the same indent character(s) already in the file. I initially used four spaces on the chmod
line which resulted in an error. I changed it to two tabs and the error went away.
I suspect if I was running the script via cron
this may not be a problem, but I have not tried that, yet.
1 Like
N8EI
October 8, 2024, 2:05pm
3
The correct solution is to run asl-play-arn
as the asterisk
user. That’s how it’s intended to work, usually out of a crontab.
1 Like
k6irk
October 8, 2024, 3:08pm
4
What would be the correct crontab entry then for it? I have not found any docs on the best way to add it.
N8EI
October 8, 2024, 3:17pm
5
The simpliest way is to create a file /etc/cron.d/asl
with something like the following contents:
30 19 * * 3 asterisk /usr/bin/asl-play-arn --node 620301
In this case, it’ll play at 1930 local time every Wednesday. Cron is extensively documented in man crontab
and man 5 crontab
.
1 Like
k6irk
October 11, 2024, 1:42am
6
I tried exactly as you suggested and did a different schedule, but when the time came, nothing happened.
N8EI
October 11, 2024, 12:17pm
7
Does it play if you do sudo -u asterisk asl-play-arn --debug --node 620301
? Does the --debug
flag show any errors?
k6irk
October 11, 2024, 6:13pm
8
that worked.
So, is there something with this that is a possible issue?
30 19 * * 3 asterisk /usr/bin/asl-play-arn --node 620301
is it possible to play it on multiple nodes at the same time as well?
Thank you
N8EI
October 11, 2024, 9:51pm
9
This should be equivalent except that one is timed and the other is immediate. Not sure why one works and one does not. Are there any errors in the CRON log?
You could fire multiple commands at the same time. But app_rpt doesn’t support playback on multiple nodes with one command.