当前位置: 首页>>代码示例>>PHP>>正文


PHP FreePBX::Notifications方法代码示例

本文整理汇总了PHP中FreePBX::Notifications方法的典型用法代码示例。如果您正苦于以下问题:PHP FreePBX::Notifications方法的具体用法?PHP FreePBX::Notifications怎么用?PHP FreePBX::Notifications使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FreePBX的用法示例。


在下文中一共展示了FreePBX::Notifications方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->updateVars();
     $edgemode = \FreePBX::Config()->get('MODULEADMINEDGE');
     $alerts = \FreePBX::Notifications()->get_num_active();
     $output->write(base64_decode($this->banner));
     $output->writeln("");
     $output->writeln("");
     if ($alerts != 0) {
         $output->writeln("<fg=red>" . sprintf(_("NOTICE! You have %s notifications! Please log into the UI to see them!"), $alerts) . "</fg=red>");
     }
     if ($edgemode == 1) {
         $output->writeln("<fg=red>" . sprintf(_("NOTICE! This system had EDGE mode enabled. For more information visit %s"), 'http://wiki.freepbx.org/x/boi3Aw') . "</fg=red>");
     }
     $output->writeln("");
     $output->writeln("<info>" . _("Current Network Configuration") . "</info>");
     $iflist = $this->listIFS();
     if ($iflist) {
         $rows = array();
         foreach ($iflist as $if => $info) {
             $rows[] = array($if, $info['mac'], $info['ip']);
         }
         $table = new Table($output);
         $table->setHeaders(array(_('Interface'), _('MAC Address'), _('IP Addresses')))->setRows($rows);
         $table->render();
     } else {
         $output->writeln("-------------------");
         $output->writeln(_("No interfaces found"));
         $output->writeln("-------------------");
     }
     $messages = $this->externalMessages();
     if (isset($messages['pre'])) {
         foreach ($messages['pre'] as $o) {
             $output->writeln($o);
         }
     }
     if (!$messages['cancel']) {
         $output->writeln("");
         $output->writeln(_("Please note most tasks should be handled through the GUI."));
         $output->writeln(_("You can access the GUI by typing one of the above IPs in to your web browser."));
         $output->writeln(_("For support please visit: "));
         $output->writeln("    " . $this->supporturl);
         $output->writeln("");
     }
     if (isset($messages['post'])) {
         foreach ($messages['post'] as $o) {
             $output->writeln($o);
         }
     }
 }
开发者ID:lidl,项目名称:framework,代码行数:50,代码来源:Motd.class.php

示例2: validateNoPortConflicts

 /**
  * Make sure that none of the SIP channel drivers have conflicting ports
  *
  * This will give priority to PJSIP owning the ports.
  */
 public function validateNoPortConflicts()
 {
     // Get all of our binds
     $binds = $this->getBinds(true);
     $allports = array("tcp" => array(), "udp" => array());
     foreach ($binds as $driver => $listenarr) {
         // We explicitly don't care about interfaces. Having
         // chansip on 5060 on int1 and pjsip on 5060 on int2
         // is just going to be a nightmare. We asked getBinds
         // to return a flattened array, so we just disregard
         // the interface
         foreach ($listenarr as $ports) {
             foreach ($ports as $proto => $port) {
                 // Phew. Finally.
                 // Is it a websocket port? We don't care about them
                 if ($proto == "wss" || $proto == "ws") {
                     continue;
                 }
                 // Is it a TCP port?
                 if ($proto !== "udp") {
                     $type = "tcp";
                 } else {
                     $type = "udp";
                 }
                 // Is there a conflict?
                 if (isset($allports[$type][$port])) {
                     // Yes. Poot.
                     $n = \FreePBX::Notifications();
                     // If this isn't chansip, then somehow the user has managed
                     // to do something crazy to pjsip.  We can't fix it.
                     if ($driver !== "sip") {
                         $n->add_critical("sipsettings", "unknownpjsip", _("Unknown Port Conflict"), _("An unknown port conflict has been detected in PJSIP. Please check and validate your PJSIP Ports to ensure they're not overlapping"), "", true, true);
                         continue;
                     }
                     // So, is this udp, tcp, or tls?
                     if ($proto == "udp") {
                         // Try a couple of ports until we find a spare. Default is first,
                         // just in case we have a conflict on 5061 or something.
                         $attempts = array(5060, 5062, 5161, 5199, 5260, 15060);
                         foreach ($attempts as $portattempt) {
                             if (!isset($allports['udp'][$portattempt])) {
                                 // Yes. Found a spare.
                                 $this->updateChanSipSettings("bindport", $portattempt);
                                 $allports['udp'][$portattempt] = true;
                                 $n->add_critical("sipsettings", "sipmoved", _("CHANSIP Port Moved"), sprintf(_("Chansip was assigned the same port as pjsip for UDP traffic. The Chansip port has been changed to %s"), $portattempt), "", true, true);
                                 needreload();
                                 break;
                             }
                         }
                     } elseif ($proto == "tcp") {
                         // This means pjsip is listening on TCP, and, someone's turned on tcpenable
                         // in chansip settings.  We just turn it off, as chansip can't move its tcp
                         // port.
                         $this->updateChanSipSettings("tcpenable");
                         $n->add_critical("sipsettings", "siptcpdisabled", _("CHANSIP TCP Disabled"), _("Chansip was assigned the same port as pjsip for TCP traffic. Chansip has had the tcpenable setting removed, and is no longer listening for TCP connections."), true, true);
                         needreload();
                         continue;
                     } elseif ($proto == "tls") {
                         // TLS is conflicting with PJSIP. Try to find a spare port
                         $attempts = array(5061, 5161, 5162, 5199, 5261, 15061);
                         foreach ($attempts as $portattempt) {
                             if (!isset($allports['tcp'][$portattempt])) {
                                 // Yes. Found a spare.
                                 $this->updateChanSipSettings("tlsbindport", $portattempt);
                                 $allports['tcp'][$portattempt] = true;
                                 $n->add_critical("sipsettings", "siptlsmoved", _("CHANSIP TLS Port Moved"), sprintf(_("Chansip was assigned a port that was already in use for TLS traffic. The Chansip TLS port has been changed to %s"), $portattempt), true, true);
                                 needreload();
                                 break;
                             }
                         }
                     } else {
                         throw new \Exception("Unknown protocol ({$proto}) to fix");
                     }
                 }
                 // No conflict!
                 $allports[$type][$port] = true;
                 // Debugging help
                 // $allports[$type][$port] = "$driver, $proto on port $port ($type)";
             }
         }
     }
 }
开发者ID:ringfreejohn,项目名称:pbxframework,代码行数:87,代码来源:Sipsettings.class.php

示例3: configure

 protected function configure()
 {
     $this->FreePBXConf = \FreePBX::Config();
     $this->Notifications = \FreePBX::Notifications();
     $this->setName('dbug')->setAliases(array('debug'))->setDescription(_('Stream files for debugging'))->setDefinition(array(new InputArgument('args', InputArgument::IS_ARRAY, null, null), new InputOption('skipstandard', 's', InputOption::VALUE_NONE, _('Do not tail standard freepbx.log'))));
 }
开发者ID:powerpbx,项目名称:framework,代码行数:6,代码来源:Debug.class.php


注:本文中的FreePBX::Notifications方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。