Hello,
I need your help to resolve one issue i.e. while calling get_variable function with DIALSTATUS, I'm not able to get the value of data. Below is the AGI debug extracts from console.
#!/usr/bin/php -q > > <?php > > include_once ("phpagi-2.14/phpagi.php"); >> include_once ("phpagi-2.14/phpagi-asmanager.php"); > > $agi = new AGI();
$dialstatus=$agi->get_variable(DIALSTATUS); print_r($dialstatus);
<SIP/10036-000000b8>AGI Rx << GET VARIABLE DIALSTATUS <SIP/10036-000000b8>AGI Tx >> 200 result=1 (CANCEL) <SIP/10036-000000b8>AGI Rx << Array <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command ERROR: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe <SIP/10036-000000b8>AGI Rx << ( <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command ERROR: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe <SIP/10036-000000b8>AGI Rx <<
=> 200 <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command [Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe <SIP/10036-000000b8>AGI Rx << [result] => 1 <SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command [Dec 3 01:18:47] ERROR[24839]: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe[u] <SIP/10036-000000b8>AGI Rx << [data] [/u]=> Thanks, Kamlesh
I'm in this problem too, invoke get_variable(….) , It prints the returned value, but I cannot get that value in the
its an issue with php5 i think not a solution but it seems making the call 3 times will always work so a simple wrapper function..
function get_var($agi_in, $value) { $temp = $agi_in->get_variable($value); $temp = $agi_in->get_variable($value); $temp = $agi_in->get_variable($value); $temp = $temp;
$agi_in->verbose($value." :".$temp); return $temp; }
this is often due to there being data in the stdin.
Here's an easy fix
add this to the beginning of the evaluate function:
around line 1496 in phpagi.php
function evaluate($command) { //clear the buffer stream_set_blocking($this->in,0); do { $line = fgets($this->in); } while ($line); stream_set_blocking($this->in,1);
HI. This is True:
$dialstatus = $agi->get_variable('DIALSTATUS'); if($dialstatus['result'] == 1) { $ds = $dialstatus['data']; $agi->verbose("DIAL STATUS is: $ds"); }
Log in to post a comment.
Hello,
I need your help to resolve one issue i.e. while calling get_variable function with DIALSTATUS, I'm not able to get the value of data. Below is the AGI debug extracts from console.
#!/usr/bin/php -q
> > <?php
> > include_once ("phpagi-2.14/phpagi.php");
>> include_once ("phpagi-2.14/phpagi-asmanager.php");
> > $agi = new AGI();
$dialstatus=$agi->get_variable(DIALSTATUS);
print_r($dialstatus);
<SIP/10036-000000b8>AGI Rx << GET VARIABLE DIALSTATUS
<SIP/10036-000000b8>AGI Tx >> 200 result=1 (CANCEL)
<SIP/10036-000000b8>AGI Rx << Array
<SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command
ERROR: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe
<SIP/10036-000000b8>AGI Rx << (
<SIP/10036-000000b8>AGI Tx >> 510 Invalid or unknown command
ERROR: utils.c:1128 ast_carefulwrite: write() returned error: Broken pipe
<SIP/10036-000000b8>AGI Rx <<
I'm in this problem too, invoke get_variable(….) , It prints the returned value, but I cannot get that value in the
its an issue with php5 i think not a solution but it seems making the call 3 times will always work so a simple wrapper function..
function get_var($agi_in, $value)
{
$temp = $agi_in->get_variable($value);
$temp = $agi_in->get_variable($value);
$temp = $agi_in->get_variable($value);
$temp = $temp;
$agi_in->verbose($value." :".$temp);
return $temp;
}
this is often due to there being data in the stdin.
Here's an easy fix
add this to the beginning of the evaluate function:
around line 1496 in phpagi.php
HI. This is True:
$dialstatus = $agi->get_variable('DIALSTATUS');
if($dialstatus['result'] == 1)
{
$ds = $dialstatus['data'];
$agi->verbose("DIAL STATUS is: $ds");
}