[RESOLVED]Request to AMI don't send Variable

Hi all,
It’s my first time with AMI and i’m facing some problems.
I use the Originate action to do outbound call and everything is allright except that my variables passed using “Variable” is empty in my context.

manager.conf

[admin]
secret = admin
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
permit=192.168.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user,originate
write = system,call,log,verbose,command,agent,user,originate

PHP code that send the request to the AMI

#!/usr/bin/php -q
    <?php

    $sys_ip = "127.0.0.1";
    $User_str = "admin";
    $Secret_str = "admin";
    $wrets = "";
    $langue = "English";    
    if($oSocket = fsockopen($sys_ip, 5038, $errnum, $errdesc) or die("Connection to host failed"))
    {
        fputs($oSocket, "Action: login\r\n");
        fputs($oSocket, "Username: $User_str\r\n");
        fputs($oSocket, "Secret: $Secret_str\r\n\r\n");
        
        fputs($oSocket, "Action: Originate\r\n");
        fputs($oSocket, "Channel: SIP/999\r\n");
        fputs($oSocket, "Context: Test\r\n");
        fputs($oSocket, "Exten: 100\r\n");
        fputs($oSocket, "Priority: 1\r\n\r\n");
        fputs($oSocket, "Variable: LANGUE=$langue\r\n");
        fputs($oSocket, "Timeout: 10000\r\n");
        fputs($oSocket, "Async: true\r\n\r\n");
        
        fputs($oSocket, "Action: Logoff\r\n\r\n");
        
        while (!feof($oSocket)) {
            $wrets .= fread($oSocket, 4096);
        }
        //fclose($oSocket);
        echo "ASTERISK MANAGER OUTPUT:$wrets";
    }
    else
        echo "connexion failed";
?>

Context in extension.conf

[Test]
exten => 100,1,Background(custom/${LANGUE}/welcome)

In “Test” context, ${LANGUE} is empty.

Can someone hept me?
Thanks

Try

    fputs($oSocket, "Variable: LANGUE=$langue,\r\n");

instead of
fputs($oSocket, “Variable: LANGUE=$langue\r\n”);

also maybe add some echo’s in the php so you can see if its set there and some Noops’s in teh dialplan

Hi,
Problem solved

Write this:

Instead of this fputs($oSocket, "Priority: 1\r\n\r\n");

Thans you