I used kd5fmu script to install the time and weather for ASL3 but encountering a problem when executing DTMF manually. I have changed the 81 = cmd, perl /usr/local/sbin/saytime.pl zzzzz nnnnn.
the hourly works fine from crontab but when i execute manually, it plays the time from when the last crontab played and not the current time.
You may need to grant the asterisk user rights to the tmp directory. Start a couple of SSH sessions and in one have the Asterisk CLI running. In the other run the commands. Note any erros in the CLI.
I am using an HT so I opened the cli and dtmf *81 and the cli played the file but wrong time. Did not see any errors.
– Remote UNIX connection
– Remote UNIX connection disconnected
– Hungup ‘DAHDI/pseudo-1976644963’
– <DAHDI/pseudo-187479560> Playing ‘/tmp/current-time.gsm’ (language ‘en’)
– Hungup ‘DAHDI/pseudo-187479560’
didn’t run from cli as I’m not that experienced with cli commands.
I suspect it is a permission problem. The user trying to create the current-time.gsm doesn’t have permssions to /tmp. You could try running the following;
sudo chmod -R a+rwx /tmp
Then try the command again.
after running the command the cli was continously scrolling and I had to pull the power on the Pi and reboot. When it rebooted, this is the error message I received when dtmf w HT then at 9am received the same message when played from cron. Both no audio the cron keyed up with no audio. I tried DTMF w HT again it says just mostly cloudy. I will try running the installation of script again and report back. Thank you for your help
– Hungup ‘DAHDI/pseudo-1304732984’
[2025-03-08 08:56:22.927] WARNING[1497]: file.c:611 filehelper: File /tmp/current-time.gsm detected to have zero size.
– Hungup ‘DAHDI/pseudo-33076475’
– Remote UNIX connection
– Remote UNIX connection disconnected
[2025-03-08 09:00:03.442] WARNING[1691]: file.c:611 filehelper: File /tmp/current-time.gsm detected to have zero size.
– Hungup ‘DAHDI/pseudo-2124711709’
There is a problem with how the scripts are setup and ownership.
Running the script as root prevents asterisk from accessing the files.
Run these commands: sudo chown asterisk:asterisk -R /usr/local/share/asterisk sudo rm /tmp/condition.gsm sudo rm /tmp/temperature
Then make sure to only run the script as asterisk or with sudo -u asterisk saytime.pl xxx xx
aka if your using a cron, make sure it’s in the asterisk user.
I just ran this from k1if@node27915:~ $ sudo -u asterisk saytime.pl 44512 27915
48°F, 9°C / Sunny
rm: cannot remove ‘/tmp/temperature’: Operation not permitted
rm: cannot remove ‘/tmp/condition.gsm’: Operation not permitted
/usr/local/sbin/weather.sh: line 150: /tmp/temperature: Permission denied
/usr/local/sbin/weather.sh: line 189: /tmp/condition.gsm: Permission denied
sh: 1: cannot create /tmp/current-time.gsm: Permission denied
Unable to access the running directory (Permission denied). Changing to ‘/’ for compatibility.
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
Are the files owned by asterisk ?
OR
not sure how that might work since you are executing python scripts.
Something to look at. Ownership of files and under what user is the python executing.
The script is automatically setting up a cronjob under the root user.
Once the cronjob runs, it creates (and leaves) temporary files that belong to root. When you try to run the command from inside asterisk it can not over write the root owned temp files and it plays the old stuff.
You need to remove the cronjob using sudo crontab -e, then delete any of the files in the /tmp/ dir that root owns.
After that, as long as you only run the script as the asterisk user (either from asterisk with the commands, or sudo -u asterisk at the command line) you should be fine.