public static function register($driver, $hook) { $driverName = Telephony::getDriverName(); if (!$driverName or $driverName == 'none') { return true; } elseif (!class_exists($driverName)) { Kohana::log('error', 'Telephony -> Unable to register the dialplan driver \'' . $driverName . '\''); return false; } $hookClass = $driverName . '_' . $driver . '_Driver'; if (!class_exists($hookClass)) { Kohana::log('error', 'Telephony -> Unable to register the dialplan hook \'' . $driver . '\'(' . $hookClass . ')'); return false; } if (empty(self::$dialplanSections)) { kohana::log('debug', 'Telephony -> EVAL ' . $driverName . '::getDialplanSections();'); $sections = eval('return ' . $driverName . '::getDialplanSections();'); if (is_array($sections)) { self::$dialplanSections = $sections; } } if (!in_array($hook, self::$dialplanSections)) { //Logger::ExceptionByCaller(); throw new Exception('The hook ' . $hook . ' is not a recognized telephony global hook. (While trying to register callback ' . $driver . ')'); } // Register event as _telephony.action with the callback array as the callback Event::add('_telephony.' . $hook, array($hookClass, $hook)); Kohana::log('debug', 'Telephony -> Added hook for _telephony.' . $hook . ' to call ' . $hookClass . '::' . $hook); return TRUE; }