public function prepareUpdateView() { $this->view->behind_nat = FALSE; if (!empty($this->sipinterface['nat_type'])) { $this->view->behind_nat = TRUE; } // This is not the best way to to do this but I am mimicing the // behavior that was already here if (Router::$method == 'add') { $this->sipinterface['nat_net_list_id'] = netlists::getSystemListId('nat.auto'); } $result = Doctrine::getTable('SipInterface')->findAll(Doctrine::HYDRATE_ARRAY); $options = array(); foreach ($result as $row) { if (!$row['auth']) { $options[$row['sipinterface_id']] = $row['name']; } } foreach ($result as $row) { if ($row['auth']) { $options[$row['sipinterface_id']] = $row['name']; } } $this->view->options = $options; parent::prepareUpdateView(); }
public static function addInterface($name, $ip = '', $port = 5060, $auth = TRUE, $use_inbound_acl = TRUE, $nat = FALSE, $context = 'Inbound Routes') { Kohana::log('debug', 'Adding SIP interface for IP ' . $ip . ' on port ' . $port); $sipInterface = new SipInterface(); $sipInterface['name'] = $name; $sipInterface['ip_address'] = $ip; $sipInterface['port'] = $port; $sipInterface['auth'] = $auth; $sipInterface['nat_type'] = 1; Kohana::log('debug', 'got here2'); //$sipInterface['Context'] = Doctrine::getTable('Context')->findOneByName($context); Kohana::log('debug', 'got here'); $sipInterface['nat_net_list_id'] = netlists::getSystemListId('nat.auto'); Kohana::log('debug', 'got here'); $sipInterface['inbound_net_list_id'] = $use_inbound_acl ? netlists::getSystemListId('trunks.auto') : 0; $sipInterface['register_net_list_id'] = 0; $registry = array('options_ping' => $auth, 'force_rport' => $nat); Kohana::log('debug', 'got here3'); $location = Doctrine::getTable('Location')->findOneByName('Main Location'); if (!empty($location['location_id'])) { $registry['force_register_domain'] = $location['location_id']; } Kohana::log('debug', 'got here4'); $sipInterface['registry'] = $registry; $sipInterface->save(); return TRUE; }
public function prepareUpdateView() { $this->view->behind_nat = FALSE; if (!empty($this->sipinterface['nat_type'])) { $this->view->behind_nat = TRUE; } // This is not the best way to to do this but I am mimicing the // behavior that was already here if (Router::$method == 'add') { $this->sipinterface['nat_net_list_id'] = netlists::getSystemListId('nat.auto'); } parent::prepareUpdateView(); }