Bash scrip not executed from dialplan

I have had bash scripts running from dialplan before but this time it just wont execute.

I’m not getting any errors on the console but the script is just being run

The command I am using is as follows

same => n,System(/bin/bash /var/lib/asterisk/scripts/ “${rxfile}” “${ARG5}” “${ARG6}” “${CALLERID(num)}”))

I have set file permissions on /var/lib/asterisk/scripts/ to 777 and set the ownership to asterisk and still it doesn’t run
chmod 777 /var/lib/asterisk/scripts/
chmod 777 /var/lib/asterisk/scripts/*
chown asterisk /var/lib/asterisk/scripts/*

I have also tried running the command with sudo -uasterisk but again nothing
Any ideas here?

Maybe there is a permission problem on an intermediate directory.

Even if you run Asterisk non-root, I think it normally starts as root, so your sudo may make no difference to the eventual user.

Nowadays some programs will refuse to use files with unsafe permissions, like 777, alhtough I didn’t think that included bash.

Did you try running that script from command prompt and check the output?
–Satish Barot

Yes I can run the script as expected outside of asterisk and I can see that asterisk is running as user asterisk

the scripts permissions are
-rwxrwxrwx 1 asterisk root 617 Sep 28 23:10

the scripts directory is
drwxrwxrwx 2 root root 4096 Sep 25 00:12 scripts

but the asterisk directory is
drwxr-xr-x. 14 asterisk asterisk 4096 Sep 26 15:18 asterisk

So I have change the entire structure to be drwxr-xr-x. asterisk asterisk restarted asterisk and still it doesn’t execute any of the scripts I have

Is thre a log file which will show what is going wrong here I can take a look at?

It looks like it is related to the syntax I am using to execute the script and pass variables.

If I strip the command down to just the following it runs just fine
same => n,System(/bin/bash /var/lib/asterisk/scripts/

The command I was using is
same => n,System(/bin/bash /var/lib/asterisk/scripts/ “${rxfile}” “${ARG5}” “${ARG6}” “${CALLERID(num)}”))

but if you look close I have an extra ) on the end which broke the command.

Surprised asterisk didn’t complain this was an issue but this is all fixed now