a = $a; } /** * To Handle the All Pami Events * @param EventMessage $event */ public function handle(EventMessage $event) { echo $strevt = $event->getKeys()['event']; // $this->var_error_log($event->getKeys()); if ($strevt == 'DialBegin') { echo "DialBegin event --- \n"; } if ($strevt == 'DialEnd') { echo "Dial end event --- \n"; } if ($strevt == 'Hangup') { echo "Hangup event --- \n"; } } public function var_error_log($object = null) { $datetime = date("Y-m-d h:i:s a"); $contents = PHP_EOL . $datetime . " :"; ob_start(); // start buffer capture var_dump($object); // dump the values $contents .= ob_get_contents(); // put the buffer into a variable ob_end_clean(); // end capture //create the log file if not exist $log_file_path = "log.txt"; if (file_exists($log_file_path) == false) { fopen($log_file_path, "w"); } error_log($contents, 3, $log_file_path); } }