[asterisk-users] asterisk 1.6 agi problem with PHP
Steve Edwards
asterisk.org at sedwards.com
Sat Jul 16 12:07:06 CDT 2011
On Sat, 16 Jul 2011, Zarko Zivanovic wrote:
> I am sure that someone can help with this. We decided to do a fresh
> install of asterisk 1.6.2.19 And after we did that, the problem that we
> have is this – We cant run a single Php file!
>
> testera.agi: Failed to execute '/var/lib/asterisk/agi-bin/testera.agi':
> No such file or directory
If you try to execute the script as the user running the Asterisk binary
from the command line, what do you get?
For example:
sudo -s -u asterisk
/var/lib/asterisk/agi-bin/testera.agi </dev/null
If that executes, I'd take a peek at the environment variables of the
Asterisk process to ensure /usr/bin/ is in the PATH.
For example:
sudo cat /proc/$(pidof asterisk)/environ\
| tr '\0' '\n'\
| grep PATH
Keep in mind, an AGI interfaces with Asterisk via STDIN and STDOUT so you
can test an AGI (within obvious limitations) completely outside of
Asterisk by redirecting STDIN and STDOUT. For example, given a file
testera.stdin containing:
agi_request: testera.agi
agi_channel: DAHDI/23-1
agi_language: en
agi_type: DAHDI
agi_uniqueid: 1310825293.10
agi_version: 1.6.2.19
agi_callerid: 112686649
agi_calleridname: unknown
agi_callingpres: 3
agi_callingani2: 0
agi_callington: 33
agi_callingtns: 0
agi_dnid: 8212
agi_rdnis: unknown
agi_context: from-pstn
agi_extension: 8212
agi_priority: 2
agi_enhanced: 0.0
agi_accountcode:
agi_threadid: -1223132272
200 result=0
200 result=0
200 result=0
You can execute the AGI like:
/var/lib/asterisk/agi-bin/testera.agi <testera.stdin
and your script should display:
STREAM FILE /var/lib/asterisk/sounds/en/tt-monkeys #
which, obviously, will not succeed because your AGI is 'talking' to your
shell, not Asterisk.
--
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