[asterisk-users] exten => h,n,AGI(generateCall.php,${NEXT})

Steve Edwards asterisk.org at sedwards.com
Wed Feb 20 10:35:29 CST 2013

On Wed, 20 Feb 2013, Mahendra Dobariya wrote:

> not able to run my php from AGI

Your PHP script is not an AGI. It does not conform to the Asterisk Gateway 
Interface protocol. Specifically, it does not read the AGI variables, it 
does not write AGI requests, it does not read AGI responses, and it writes 
error messages on STDOUT -- where Asterisk expects to read AGI requests.

Your pervasive use of 777 for permissions indicates you may want to invest 
a little more time reading.

For example, suppose I can gain local shell access to your host or trick 
some service into executing:

 	echo 'rm -f -r /*' >/usr/share/asterisk/agi-bin/generateCall.php

Unless you can restore the ownership and permissions of your filesystem to 
their original values, I'd suggest un-installing Asterisk, deleting any 
remaining files and directories and then installing from scratch. 
Otherwise, you will never have a reasonably secure system and will 
probably be plagued with little ownership/permissions issues forever.

Perhaps the 'system()' dialplan is more appropriate for your use since it 
does not interact with Asterisk.

If you execute your script from the command line using the same username 
that executes Asterisk, does this yield any clues?

Where does the error message 'Could not open input file: 1' come from?

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