[Asterisk-Users] AGI Variable problem

René Enskat [Teamware GmbH] ren at teamware-gmbh.de
Thu Oct 13 02:31:14 MST 2005


Hello all,

I try to use a agi script to get a variable from * und put them into a
script which gives me another variablke and put this in *.
My problem is now it seems the var ID is empty coz i always jump into
the result 0 loop.
The $MSN should be in the SetCIDNum.

#!/usr/bin/php -q

<?php
include("/var/lib/asterisk/agi-bin/phpagi.php");
$agi = new AGI();

$ID = $agi->get_variable("SIPUSER");

if ($ID['result'] == 0) {
        $agi->verbose("SIPUSER not set -- nothing to do");
        exit(1);
}

$agi->set_variable("MSN", exec("/var/lib/asterisk/agi-bin/msn4sip 111
222 333 " .$ID['data']));
?>

Output from asterisk:
    -- Executing SetVar("SIP/31-79e2", "SIPUSER=31") in new stack
    -- Executing AGI("SIP/31-79e2", "msn4sip.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/msn4sip.agi
  msn4sip.agi: Arrayn(n    [code] => 510n    [result] => n    [data] =>
Invalid or unknown commandn)n
  msn4sip.agi: SIPUSER not set -- nothing to do
    -- AGI Script msn4sip.agi completed, returning 0
    -- Executing SetLanguage("SIP/31-79e2", "de") in new stack
    -- Executing SetCIDNum("SIP/31-79e2", "") in new stack






More information about the asterisk-users mailing list