Problem with "get variable dialstatus" PHPAGI

Hello !

I hope i’m posting in the correct place…

Well i am using asterisk 1.4 and PHPAGI 2.
so in my PHP script i am using all the functions of PHPAGI.
I have the same problems that described here :
forums.digium.com/viewtopic.php? … d0401a60b1

But no real solution to it.

So in my script here is my code :

[code]$agi->write(“EXEC DIAL SIP/$num_appele|5|t,r”);
$ret = $agi->evaluate(“GET VARIABLE DIALSTATUS”);

$agi->write($ret);
[/code]

evaluate will execute the command “GET VARIABLE STATUS” and will recover the answer from that command.

So in my CLI i put “AGI DEBUG” and here is the result :

AGI Rx << GET VARIABLE DIALSTATUS AGI Tx >> 200 result=1 (NOANSWER) AGI Rx << 200 result=0

The correct result is indeed 200 result=1 (NOANSWER) that is what is returned after putting the previous command.
But when i want to use the message returned and collected by the function evaluate() i get 200 result=0 !!!

Why dont i get 200 result=1 (NOANSWER)…

function evaluate short version :

[code]function evaluate($command)
{
$broken = array(‘code’=>500, ‘result’=>-1, ‘data’=>’’);

  // write command
  if(!@fwrite($this->out, trim($command) . "\n")) return $broken;
  fflush($this->out);

  // Read result.  Occasionally, a command return a string followed by an extra new line.
  // When this happens, our script will ignore the new line, but it will still be in the
  // buffer.  So, if we get a blank line, it is probably the result of a previous
  // command.  We read until we get a valid result or asterisk hangs up.  One offending
  // command is SEND TEXT.
  $count = 0;
  do
  {
    $str = trim(fgets($this->in, 4096));
  } while($str == '' && $count++ < 5);
    return $str;

}[/code]

function evaluate long version :
asterisk.itp.tsoa.nyu.edu/asteri … html#a1493

I hope you can help me understand why i am not getting what i want :wink:

thanks and have a nice day !

Sylvain

Hi,

I have very little knowledge of php bco’z i myself work with cAgi and very confortable in making the changes in the source code of asterisk.

According to my view you are not able to get the value of Dialstatus in your variable.

Thanks
sudhir_mor2000@yahoo.com

hi suhir ,

I too facing same issue . what was the solution .

Plz contact on skype

sudhirmor1

Regards

HI AUGESY,

iS IT SOLVED I TOO FACING SAME ISSUE. IF IT WAS SOLVED PLEASE LET ME KNOW THE SOLUTION