[asterisk-users] PHP/AGI/SetVar Issue

Jeff LaCoursiere jeff at jeff.net
Thu Jun 4 17:19:43 CDT 2009


On Thu, 4 Jun 2009, Peder wrote:

> Is there a limitation to the number of variables you can set from a PHP agi
> script?  I have a simple example and I can't get it to let me set more than
> 1.  I am pretty sure I am just missing something, but I've searched all over
> an can't find the answer.  Here is the extensions.conf part:
>
> exten => _XXXXXXXXXX,1,AGI,diallocal.agi exten =>
> _XXXXXXXXXX,n,NoOp(${ISLOCALCONTEXT})
> exten => _XXXXXXXXXX,n,NoOp(${ISLOCALDID})
>
>
> Here is the part from the agi that sets the variables:
>
> echo ' EXEC SetVar ISLOCALCONTEXT="'.$row['context'].'"';
> echo ' EXEC SetVar ISLOCALDID="'.$row['did'].'"';
>
>
> If I run it is as, ISLOCALCONTEXT gets set, but not ISLOCALDID:
>
> -- Executing NoOp("SIP/3333-081d2c38", "CONTEXT2") in new stack
> -- Executing NoOp("SIP/3333-081d2c38", "") in new stack
>
> If I flip their order in the agi, then ISLOCALDID gets set, but not
> ISLOCALCONTEXT:
>
> -- Executing NoOp("SIP/3333-081d8d78", "") in new stack
> -- Executing NoOp("SIP/3333-081d8d78", "4444") in new stack
>
>
> Any idea what I am missing?  Only the first "exec setvar" gets run and the
> other one appears to just be ignored.  I just want to be able to set 2-3
> variables and then return to the dialplan.  Please note that I do not want
> to use phpagi so don't tell me to use that, I want to figure out why it
> doesn't work this way.
>

Are you reading the return value from asterisk in between them?

j



More information about the asterisk-users mailing list