Of course I just figured it out. If I send a print with \n, it works now.
Not really sure why though:
echo 'SET VARIABLE ISLOCALCONTEXT CONTEXT3';
print "\n";
echo 'SET VARIABLE ISLOCALDID 4444';
print "\n";
-- Executing NoOp("SIP/3333-081777c0", "CONTEXT3") in new stack
-- Executing NoOp("SIP/3333-081777c0", "4444") in new stack
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Philipp
Kempgen
Sent: Friday, June 05, 2009 6:51 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] PHP/AGI/SetVar Issue
Peder schrieb:
> 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.
Send a newline ("\n") after each command.
Remove the blank (" ") before the commands.
And maybe use SET VARIABLE instead of EXEC SetVar.
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