[asterisk-users] PHP/AGI/SetVar Issue

Jeff LaCoursiere jeff at jeff.net
Fri Jun 5 11:18:29 CDT 2009



On Fri, 5 Jun 2009, Peder wrote:

> I've tried all of that and it still doesn't work right.  I'm sure it's
> something dumb, but I just can't figure it out.  I've even made it simpler:
>
> echo 'SET VARIABLE ISLOCALCONTEXT CONTEXT3\n';
> echo 'SET VARIABLE ISLOCALDID 4444\n';
>
> and this produces the following:
>
>    -- Executing NoOp("SIP/3333-081cf2d8", "CONTEXT3nSET") in new stack
>    -- Executing NoOp("SIP/3333-081cf2d8", "") in new stack
>
> FYI, I am reading the environment variables when the program starts, I just
> didn't include that chunk of code as I didn't think it was relevant.  I am
> not however reading response codes from *, as I don't really care what they
> are.  If I HAVE to read them, then I will, but I am not right now.

You have to read them.  Throw the data away afterwards, but that is what 
is blocking the send of the next command.  This is why you are being 
advised to use a library.

j

>
>
> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com
> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Philipp
> Kempgen
> Sent: Friday, June 05, 2009 7:15 AM
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: Re: [asterisk-users] PHP/AGI/SetVar Issue
>
> Steve Edwards schrieb:
>> On Thu, 4 Jun 2009, Peder wrote:
>>
>>> Is there a limitation to the number of variables you can set from a PHP
>>> agi script?
>>
>> Not that I've found yet :)
>>
>> One of my AGIs sets almost 600 channel variables.
>
> Wow that's a lot. Why would you do that?
>
>>> echo ' EXEC SetVar ISLOCALCONTEXT="'.$row['context'].'"';
>>> echo ' EXEC SetVar ISLOCALDID="'.$row['did'].'"';
>>
>> You are violating the AGI protocol. First, you have to read the AGI
>> environment. Then, for every request, you must read the response.
>
> I don't think that it really matters. At least in PHP I haven't
> seen any problems even if you don't read anything (provided you
> don't care about the AGI environment and responses).
> Maybe PHP slurps the input into a buffer which will be garbage
> collected if you don't use it.
>
>
>    Philipp Kempgen
> -- 
> AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied  ->  http://www.amooma.de
> Gesch?ftsf?hrer: Stefan Wintermeyer, Handelsregister: Neuwied B14998
> Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de
> Videos of the AMOOCON VoIP conference 2009 ->  http://www.amoocon.de
> -- 
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>



More information about the asterisk-users mailing list