[asterisk-users] AGI script

Steve Edwards asterisk.org at sedwards.com
Fri Feb 20 15:21:10 CST 2009


On Fri, 20 Feb 2009, michel freiha wrote:

> Please find below my dialplan:
> [did]
> exten=>112,1,AGI(dial.pl|${EXTEN});

You are still passing ${EXTEN} which is ignored by the script.

> [root at switch1 ~]# sudo su

This does nothing useful. Your posts demonstrate a lack of understanding 
and experience with the concepts and commands of Linux. Thus, logging in 
as root or creating a "root shell" using sudo or su is exceptionally 
dangerous.

I've been doing this cruft (Unix/Linux) for over 30 years and I rarely log 
in as root or create a "root shell" -- it's just not worth the risk. It's 
all too easy to be typing quickly and mistype a space in the wrong place 
in a command such as "rm *~" and then wonder what the hell happened.

You should use the "sudo" command to execute a single command and only 
when actually needed. For example, the typical "install from source" 
command sequence is:

 	wget ...
 	tar -xvzf ...
 	cd ...
 	make
 	make install

Only the last command needs elevated privileges.

Unless you are "playing" with Asterisk for the "learning experience," you 
are in over your head and should consider investing some time in learning 
the basics.

> [root at switch1 ~]# ps -aef | grep asterisk | grep -v grep
> root     10470     1  0 22:18 pts/0    00:00:00 /bin/sh /usr/sbin/safe_asterisk
> root     10473 10470  0 22:18 pts/0    00:00:00 /usr/sbin/asterisk -f -vvvg -c

Running Asterisk as root is a bad idea -- but most people do it.

> [root at switch1 ~]# ls -l /var/lib/asterisk/agi-bin/dial.pl
> -rwxrwxrwx 1 root root 1865 Feb 20 21:18 /var/lib/asterisk/agi-bin/dial.pl

At a minimum, please "chmod go-w /var/lib/asterisk/agi-bin/dial.pl" and 
then read the man page for chmod to understand what you just did.

> [root at switch1 ~]# head -1 /var/lib/asterisk/agi-bin/dial.pl
> #!user/bin/perl
>
> The file dial.pl is executable as you can see below:
>
> -rwxrwxrwx 1 root root   1865 Feb 20 21:18 dial.pl

The source of your problem (missing the prerequisites for the script) have 
been identified and Danny has provided the steps.

Thanks in advance,
------------------------------------------------------------------------
Steve Edwards      sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                             Fax: +1-760-731-3000



More information about the asterisk-users mailing list