Reputation: 4440
I am working on a project that records how long a caller is on the line.
My question is, how do you add an event listener for hangup with AMI or AGI?
Currently, I am trying to use AGI's Manager class however the event is not firing when the call is terminated.
$Log_File = "/var/www/html/admin/modules/timetracker/agi-bin/Log.txt";
function CallHungUp($e,$ch=NULL,$u=NULL,$ca=NULL)
{
file_put_contents( $Log_File,"HANGUP E - " . implode(' ',$e),FILE_APPEND);
}
$asm = new AGI_AsteriskManager();
if($asm->connect("localhost","Secret","Info"))
{
$asm->add_event_handler('Hangup','CallHungUp');
}
else
{
file_put_contents( $Log_File,"UNABLE TO CONNECT TO ASM",FILE_APPEND);
}
Upvotes: 0
Views: 906
Reputation: 15247
There are 3 possible way
1) use h-extension
2) check SIGKILL event
3) check CHANNEL(status) after long action.
Upvotes: 0