Cmd not working in ASL3?

Before ASL3, I had the following entry in my rpt.conf

883 = cmd,/usr/bin/ssh root@10.147.156.98 "/usr/sbin/asterisk -rx 'rpt fun 1100 *8131002'"

My controller would send DTMF to ASL (on local node 1102) and the remote node 1100 would execute properly. This no longer works with ASL3

I’ve verified the ssh command itself works properly from bash from Node 1102

/usr/bin/ssh root@10.147.156.98 "/usr/sbin/asterisk -rx 'rpt fun 1100 *8131002'"

and that the DTMF I’m sending to ASL3 on Node 1102 is properly being decoded.

I’ve also verified that:

rpt fun 1102 *883

does NOT work from the asterisk CLI on Node 1102.

Node 1100 is the remote node and 1102 is the local node I’m sending DTMF to.

Obviously I’m missing a change made (the line exists under node-main stanza in rpt.conf). I am running the latest ASL3 (updated last week)

Remember, in ASL3 the asterisk process runs as the “asterisk” user (not “root”).

Have you verified that the “asterisk” user can ssh to the “root” user on the remote host?

I just double checked and the ssh binary is executable by the world on the local node and the command

"ssh root@xxx.xxx.xxx.xxx"

logs into the remote host as root

Arrrggh…

Contrary to the solution in this thread https://community.allstarlink.org/t/cmd-in-rpt-conf-to-run-a-script/22105

My ASL3 install does NOT run a script when called from rpt.conf.

Yes, the script has proper permissions set. Yes, the script runs fine when called from the shell. Yes, ASL3 is decoding the proper DTMF codes. No, ASL3 is not running the script when called.

I may just fall back to ASL2. This is a game killer for my linked system

My ASL3 runs scripts and commands just fine from in rpt.conf. Sounds like you don’t have something set up properly or are otherwise misunderstanding.

You keep saying that it will not run a script. How do you know this? Have you tried running a more basic script or command like a simple echo statement or file touch? You still have not stated whether or not you have tried manually running the script or command as the asterisk user.

Every thread that I have read so far with people complaining about how ASL3 doesn’t run their script or commands has boiled down to a simple misconfiguration or a lack of understanding of Linux permissions.

Here’s what I have just tested :

  1. In /etc/asterisk/rpt.conf I have added the following lines to the end of the [functions] stanza :
881 = cmd,touch /tmp/touch-was-executed
882 = cmd,/etc/asterisk/local/test.sh 1 2 3
  1. I created the file /etc/asterisk/local/test.sh with the following lines :
#!/bin/bash
date             >> /tmp/test.log
id               >> /tmp/test.log
echo "args = $*" >> /tmp/test.log
  1. I set the filesystem permissions on the above script :
sudo chmod 755 /etc/asterisk/local/test.sh
  1. I restarted the asterisk process with :
sudo astres.sh
  1. I made sure that the test result files were removed from the filesystem :
sudo rm -f /tmp/touch-was-executed
sudo rm -f /tmp/test.log
  1. I tested both of these functions :
sudo asterisk -x 'rpt fun <my-node> *881'
sudo asterisk -x 'rpt fun <my-node> *882'

The 1st command should create (“touch”) the /tmp/touch-was-executed file and you should note that the file owner is “asterisk”. If you exec the command again the date stamp on the file should be updated.

The 2nd command should create the /tmp/test.log file with the content showing the date the command was exec’d, the “id” of the exec’ing user (e.g. “asterisk”), and the arguments from the rpt.conf file. If you exec the command again you should see additional lines appended to the end.

As I posted, both the ssh binary and my script are both world executable (755). The asterisk process is reported running as user asterisk

root@ParrettASL:~# ps aux |grep asterisk
asterisk   31662  2.9  2.8 2175824 57484 ?       Ssl  16:10   0:08 /usr/sbin/asterisk -g -f -p -U asterisk
asterisk   31663  0.0  0.0   2328   852 ?        S    16:10   0:00 astcanary /var/run/asterisk/alt.asterisk.canary.tweet.tweet.tweet 31662
root       31772  0.0  0.1   6332  2104 pts/0    S+   16:15   0:00 grep asterisk

The script I am calling runs fine from the shell as user asterisk.

I will try your exact scripts/rpt.conf edits and report back

OK, made the edits and copied EXACTLY what you did and nothing. No touched file, no test.log created

Mason, see my post right above yours. I did indeed say it would run properly from the shell.

I also stated permissions of the script are correct (world executable, i.e. 755).

Anyway, Allan was kind enough to email me directly and offered his help. I’ll report the final outcome with this

That is not what was asked.

…does not answer the question:

Are you logged in as root and “testing” the script by running it directly as the root user? You never specified. How should we know?

Anyways, hope you get it figured out.

People are so quick to hop on here and holler “This thing I’m trying to do doesn’t work! ASL3 sucks! I’m going back to ASL2/hamvoip/whatever!” It gets kinda old.

One additional tidbit that may help folks testing out any scripts they write that will be exec’d as the “asterisk” user would be to try exec’ing their scripts with sudo -u asterisk ....

For the test script I noted above you would exec :

sudo -u asterisk /etc/asterisk/local/test.sh a b c

To see if ssh would work the following command might be informative :

sudo -u asterisk ssh root@xxx.xxx.xxx.xxx /bin/date
1 Like

We can close this thread. The issue was on the remote node 1100 in that I had not set up passwordless login to it as user asterisk (I only had done that as root). So the remote node was asking for the password but it was never sent, so the command sent failed.

The script on 1102 was running as it should. Thanks to all who offered assistance, especially Allan.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.