public function __construct() { $app = new App('sipgate'); $this->container = $app->getContainer(); $this->appName = $this->container->query('AppName'); $this->db = $this->container->query('OCP\\IDBConnection'); $this->config = $this->container->query('OCP\\IConfig'); $this->logger = $this->container->query('OCA\\Sipgate\\Service\\AppLogger'); $this->appSettings = $this->container->query('OCA\\Sipgate\\Service\\AppSettings'); $reflect = new \ReflectionClass($this); $logSuffix = mb_strtolower($reflect->getShortName()); $this->logger->setSuffix($logSuffix); // Run every 15 Minutes $this->setInterval(15 * 60); }
protected function normalizePhoneNumber($number, $externalId, $defaultRegion) { try { $number = $this->phoneNumberUtil->parse($number, $defaultRegion); } catch (NumberParseException $e) { $this->logger->warning("Error parsing phone number from source '%s' for entry '%s' (code %d): %s", $this->source, $externalId, $e->getCode(), $e->getMessage()); return null; } return $this->phoneNumberUtil->format($number, PhoneNumberFormat::E164); }