i am trying to listen some listener from java(asterisk api to listen
events) in php. i run the php program its working and catches some events
but after few minute it will exit abnormally.
*my source code<?php
ini_set("dallow_url_include","On");
require_once("http://localhost:8087/JavaBridge/java/Java.inc");
class Listener
{
function onManagerEvent($managerEvent)
{
try{
$str="HangupEvent";
$str2="DialEvent";
$str1=trim($managerEvent->getClass()->getSimpleName());
if(java_cast($str1,"string")==$str)
{
$hang_up_event= new
java("org.enjaysynapse.manager.event.HangupEvent");
$hang_up_event=$managerEvent;
$number=java_cast($hang_up_event->getCallerIdNum(),"string");
$received_date=java_cast($hang_up_event->getDateReceived(),"string");
$unique_id=java_cast($hang_up_event->getUniqueId(),"string");
echo "HangupEvent Number=".$number."\tCallReceived
Date=".$received_date."\tUniqueId=".$unique_id."\n";
}
if(java_cast($str1,"string")==$str2)
{
$Dail_event= new java("org.enjaysynapse.manager.event.DialEvent");
$Dail_event=$managerEvent;
$number=java_cast($Dail_event->getCallerIdNum(),"string");
$received_date=java_cast($Dail_event->getDateReceived(),"string");
$unique_id=java_cast($Dail_event->getUniqueId(),"string");
$scr_channel=java_cast($Dail_event->getChannel(),"string");
$destination=java_cast($Dail_event->getDestination(),"string");
echo "DialEvent
Number=".$number."\tDestination=".$destination."\tCallReceived
Date=".$received_date."\tUniqueId=".$unique_id."\tSRC=".$scr_channel."\n";
}
}
catch(JavaException $e){
echo "list.php onManagerEvent---error---->".$e;
}
}
}
function getListener()
{
try{
return java_closure(new Listener(), null, array(new
Java("org.enjaysynapse.manager.ManagerEventListener")));
}
catch(JavaException $e){
echo "list.php getListener---error---->".$e;
}
}
?>*
*Error :-*
*Fatal error:* Call to a member function getSimpleName() on a non-object in
/var/www/list.php on line 14
Notice: Uninitialized string offset: 6 in
http://localhost:8087/JavaBridge/java/Java.inc on line 786
Fatal error: An unchecked exception occured during script execution. Please
check the server log files for details. in
http://localhost:8087/JavaBridge/java/Java.inc on line 776
|