[asterisk-users] System Command not executing php

J Gao jgao at veecall.com
Wed Aug 24 14:41:49 CDT 2011


On 11-08-24 12:26 PM, Steve Edwards wrote:
> Un-top-posting again...
>
>> On 11-08-24 10:21 AM, Tim King wrote:
>
>> I have been testing this for a week now, and I am still struggling to 
>> make it work. Here is the output from extension 11 just to show that 
>> permissions are correct and asterisk can access faxnotify.php
>
>> On Wed, 24 Aug 2011, J Gao wrote:
>
>> Try put the php in the AGI directory and call it via AGI() in Asterisk.
>
>> On Wed, Aug 24, 2011, Steve Edwards wrote:
>
>> If the script does not conform to the AGI protocol, do not call it 
>> with agi().
>
> On Wed, 24 Aug 2011, Tim King wrote:
>
>> What does this mean? The suggestion from Jian did resolve the issue.
>
> It may 'work' but it did not resolve the issue and may introduce 
> unpredictable behavior in the future.
>
> When Asterisk executes an AGI, it creates an environment that is fed 
> to your program's STDIN. Asterisk expects that your program will read it.
>
> Asterisk then expects to receive requests from your program via your 
> program writing to it's STDOUT and expects your program will read the 
> response via it's STDIN. This request/response cycle continues until 
> your program exits.
>
> If your program violates this protocol it is not an AGI and you should 
> not expect stable behavior.
>
> You have not resolved the issue that you cannot execute your program 
> via system().
>
I admit that using AGI() may not correct here. This is a work around 
about passing multiple args to php script. (I had this trouble before.) 
I would like to know what is the correct way to call the php script 
through SYSTEM().

Jian

-- 




More information about the asterisk-users mailing list