I have asterisk fast AGI application that loops in some scenario. Difference is that local launched AGI scripts asterisk drops if channel hangup.
In case of network AGI, if channel hangs, the agi script proceeding work and channel loops in wait of finish this script.
When channel hangs, asterisk send "HANGUP" message to stdout, but I use synchronius phpagi lib, that miss it. So my question is :
How bind ready to read stdin event and call function callback ( that will detect possible hangup) ?
How return data to stdin back if no hangup detection ?
Firstly I try find some easy way to resolve this
My test code looks like this
while( 5 < 6)
{
$data = $agi->request;
$chan = $data['agi_channel'];
$agi->Verbose(print_r($chan,1));
$res = $agi->exec('Wait','5');
$agi->Verbose('res = '.print_r($res,1));
$res = $agi->exec('Playback',$path);
$agi->Verbose('res = '.print_r($res,1));
$var = 'ret.'.time();
$res = $agi-> exec('Read',$var.','.$path.','.$max);
$agi->Verbose('res = '.print_r($res,1));
unset($res);
}