Asterisk 13.18.3 failing to execute my AGI script

Hello everyone, am having trouble with my asterisk for some reason asterisk is failing to execute my python script. I keep on getting this error WARNING[28506][C-00000011] res_agi.c: Failed to execute ‘/root/ivr/’: File does not exist and then the call drops. The file is within the correct directory and is executable.
These are the properties of the file -rwxr-xr-x 1 root asterisk 747 Dec 7 08:43

Any assistance is highly appreciated.

Asterisk 13 is a year beyond end of life.

What does the first line of the file contain?

What user and group is Asterisk running as?

What are the permissions on /root/ivr?

These are the folder permissions drwxr-xr-x 9 root asterisk 4096 Dec 8 19:01 ivr

This is the first line of the file #!/usr/bin/env python3

Try using the full path name for python3.

What do you mean elaborate please

The /root/ directory is normally not accessible to anybody but the root user. I wouldn’t use it for putting things like AGIs.

1 Like

david is implying that your PATH environment variable does not include the path to your Python executable. If you enter

which -a python3

that may give you a clue.

If your PATH is borked, you should find out why. It may prevent you from executing any shell commands from Asterisk (via SHELL() or agi()) without having to specify absolute paths.

You can see what Asterisk’s PATH is set to with;

-vtpv11::sedwards:~$ sudo cat /proc/$(cat /var/run/asterisk/ | tr '\0' '\n'

(I’m a very minimalist kind of guy.)

When I asked about permissions, it hadn’t clicked that they were using a user, rather than a system directory as their first level directory, otherwise I would have asked for the permissions on that, as well, and probably challenged its use.

Do you have any other scripts successfully running with the same shebang line?

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