[asterisk-users] AGI with PHP
Steve Edwards
asterisk.org at sedwards.com
Sun Dec 13 21:29:37 CST 2009
On Mon, 14 Dec 2009, David Klaverstyn wrote:
> I'm having problems getting results from a PHP file. This is what the
> CLI is showing.
>
> -- Executing [111 at internal:1] AGI("Console/dsp", "GoTalk.php") in new stack
> -- Launched AGI Script /var/lib/asterisk/agi-bin/GoTalk.php [Dec 14
> 11:57:25] ERROR[20260]: utils.c:1019 ast_carefulwrite: write() returned
> error: Broken pipe
>
> If I run the PHP file from Linux it returns the result I want but how do
> I get that result back into Asterisk. I'm using Asterisk 1.6.0.10.
Just because your PHP script is executed by the AGI dialplan application
does not make it an AGI.
Your script does not follow the AGI protocol. It does not read the AGI
environment, it executes no AGI requests, and it reads no AGI responses.
You should do some reading on what an AGI is.
http://www.voip-info.org/wiki/view/Asterisk+AGI would be a good start.
2 (biased) suggestions:
1) Use an established AGI library. Nobody gets it right the first time.
2) Consider using a compiled language like C. You can execute xxx's of
AGIs written in C in the time it takes to load PHP and parse your script.
--
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