Siproxd plugin (#282)

This commit is contained in:
Michael
2017-09-24 10:54:07 +02:00
committed by Franco Fichtner
parent 24b906157a
commit 63255ef187
26 changed files with 1705 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
PLUGIN_NAME= siproxd
PLUGIN_VERSION= 0.1
PLUGIN_COMMENT= Siproxd is a proxy daemon for the SIP protocol
PLUGIN_DEPENDS= siproxd
PLUGIN_MAINTAINER= m.muenz@gmail.com
PLUGIN_DEVEL= yes
.include "../../Mk/plugins.mk"
+10
View File
@@ -0,0 +1,10 @@
Siproxd is a proxy/masquerading daemon for the SIP protocol.
It handles registrations of SIP clients on a private IP network
and performs rewriting of the SIP message bodies to make SIP
connections work via an masquerading firewall (NAT).
It allows SIP software clients (like kphone, linphone) or
SIP hardware clients (Voice over IP phones which are
SIP-compatible, such as those from Cisco, Grandstream or Snom)
to work behind an IP masquerading firewall or NAT router.
WWW: http://siproxd.sourceforge.net/
@@ -0,0 +1,49 @@
<?php
/*
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
function siproxd_services()
{
global $config;
$services = array();
if (isset($config['OPNsense']['siproxd']['general']['enabled']) && $config['OPNsense']['siproxd']['general']['enabled'] == 1) {
$services[] = array(
'description' => gettext('Siproxd Daemon'),
'configd' => array(
'restart' => array('siproxd restart'),
'start' => array('siproxd start'),
'stop' => array('siproxd stop'),
),
'name' => 'siproxd',
'pidfile' => '/var/run/siproxd/siproxd.pid'
);
}
return $services;
}
@@ -0,0 +1,205 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Michael Muenz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Siproxd\Api;
use \OPNsense\Siproxd\Domain;
use \OPNsense\Core\Config;
use \OPNsense\Base\ApiMutableModelControllerBase;
use \OPNsense\Base\UIModelGrid;
class DomainController extends ApiMutableModelControllerBase
{
static protected $internalModelName = 'Domain';
static protected $internalModelClass = '\OPNsense\Siproxd\Domain';
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->request->isGet()) {
$mdlDomain = new Domain();
$result['domain'] = $mdlDomain->getNodes();
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlDomain = new Domain();
$mdlDomain->setNodes($this->request->getPost("domain"));
// perform validation
$valMsgs = $mdlDomain->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
}
$result["validations"]["domain.".$msg->getField()] = $msg->getMessage();
}
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlDomain->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
public function searchDomainAction()
{
$this->sessionClose();
$mdlDomain = $this->getModel();
$grid = new UIModelGrid($mdlDomain->domains->domain);
return $grid->fetchBindRequest(
$this->request,
array("enabled", "name", "host", "port" )
);
}
public function getDomainAction($uuid = null)
{
$mdlDomain = $this->getModel();
if ($uuid != null) {
$node = $mdlDomain->getNodeByReference('domains.domain.' . $uuid);
if ($node != null) {
// return node
return array("domain" => $node->getNodes());
}
} else {
$node = $mdlDomain->domains->domain->add();
return array("domain" => $node->getNodes());
}
return array();
}
public function addDomainAction()
{
$result = array("result" => "failed");
if ($this->request->isPost() && $this->request->hasPost("domain")) {
$result = array("result" => "failed", "validations" => array());
$mdlDomain = $this->getModel();
$node = $mdlDomain->domains->domain->Add();
$node->setNodes($this->request->getPost("domain"));
$valMsgs = $mdlDomain->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "domain", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
unset($result['validations']);
// save config if validated correctly
$mdlDomain->serializeToConfig();
Config::getInstance()->save();
unset($result['validations']);
$result["result"] = "saved";
}
}
return $result;
}
public function delDomainAction($uuid)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlDomain = $this->getModel();
if ($uuid != null) {
if ($mdlDomain->domains->domain->del($uuid)) {
$mdlDomain->serializeToConfig();
Config::getInstance()->save();
$result['result'] = 'deleted';
} else {
$result['result'] = 'not found';
}
}
}
return $result;
}
public function setDomainAction($uuid)
{
if ($this->request->isPost() && $this->request->hasPost("domain")) {
$mdlSetting = $this->getModel();
if ($uuid != null) {
$node = $mdlSetting->getNodeByReference('domains.domain.' . $uuid);
if ($node != null) {
$result = array("result" => "failed", "validations" => array());
$domainInfo = $this->request->getPost("domain");
$node->setNodes($domainInfo);
$valMsgs = $mdlSetting->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "domain", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlSetting->serializeToConfig();
Config::getInstance()->save();
$result = array("result" => "saved");
}
return $result;
}
}
}
return array("result" => "failed");
}
public function toggle_handler($uuid, $elements, $element)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlSetting = $this->getModel();
if ($uuid != null) {
$node = $mdlSetting->getNodeByReference($elements . '.'. $element .'.' . $uuid);
if ($node != null) {
if ($node->enabled->__toString() == "1") {
$result['result'] = "Disabled";
$node->enabled = "0";
} else {
$result['result'] = "Enabled";
$node->enabled = "1";
}
// if item has toggled, serialize to config and save
$mdlSetting->serializeToConfig();
Config::getInstance()->save();
}
}
}
return $result;
}
public function toggleDomainAction($uuid)
{
return $this->toggle_handler($uuid, 'domains', 'domain');
}
}
@@ -0,0 +1,77 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Michael Muenz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Siproxd\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Siproxd\General;
use \OPNsense\Core\Config;
class GeneralController extends ApiControllerBase
{
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->request->isGet()) {
$mdlGeneral = new General();
$result['general'] = $mdlGeneral->getNodes();
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlGeneral = new General();
$mdlGeneral->setNodes($this->request->getPost("general"));
// perform validation
$valMsgs = $mdlGeneral->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
}
$result["validations"]["general.".$msg->getField()] = $msg->getMessage();
}
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlGeneral->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
}
@@ -0,0 +1,159 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Michael Muenz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Siproxd\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Core\Backend;
use \OPNsense\Siproxd\General;
/**
* Class ServiceController
* @package OPNsense\Siproxd
*/
class ServiceController extends ApiControllerBase
{
/**
* show current SIP registrations
* @return array
*/
public function showregistrationsAction()
{
$backend = new Backend();
$response = $backend->configdRun("siproxd show-registrations");
return array("response" => $response);
}
/**
* start siproxd service (in background)
* @return array
*/
public function startAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun("siproxd start", true);
return array("response" => $response);
} else {
return array("response" => array());
}
}
/**
* stop siproxd service
* @return array
*/
public function stopAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun("siproxd stop");
return array("response" => $response);
} else {
return array("response" => array());
}
}
/**
* restart siproxd service
* @return array
*/
public function restartAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun("siproxd restart");
return array("response" => $response);
} else {
return array("response" => array());
}
}
/**
* retrieve status of siproxd
* @return array
* @throws \Exception
*/
public function statusAction()
{
$backend = new Backend();
$mdlGeneral = new General();
$response = $backend->configdRun("siproxd status");
if (strpos($response, "not running") > 0) {
if ($mdlGeneral->enabled->__toString() == 1) {
$status = "stopped";
} else {
$status = "disabled";
}
} elseif (strpos($response, "is running") > 0) {
$status = "running";
} elseif ($mdlGeneral->enabled->__toString() == 0) {
$status = "disabled";
} else {
$status = "unkown";
}
return array("status" => $status);
}
/**
* reconfigure siproxd, generate config and reload
*/
public function reconfigureAction()
{
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
$mdlGeneral = new General();
$backend = new Backend();
$runStatus = $this->statusAction();
// stop siproxd if it is running or not
$this->stopAction();
// generate template
$backend->configdRun('template reload OPNsense/Siproxd');
// (re)start daemon
if ($mdlGeneral->enabled->__toString() == 1) {
$this->startAction();
}
return array("status" => "ok");
} else {
return array("status" => "failed");
}
}
}
@@ -0,0 +1,205 @@
<?php
/**
* Copyright (C) 2015 - 2017 Deciso B.V.
* Copyright (C) 2017 Michael Muenz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Siproxd\Api;
use \OPNsense\Siproxd\User;
use \OPNsense\Core\Config;
use \OPNsense\Base\ApiMutableModelControllerBase;
use \OPNsense\Base\UIModelGrid;
class UserController extends ApiMutableModelControllerBase
{
static protected $internalModelName = 'User';
static protected $internalModelClass = '\OPNsense\Siproxd\User';
public function getAction()
{
// define list of configurable settings
$result = array();
if ($this->request->isGet()) {
$mdlUser = new User();
$result['user'] = $mdlUser->getNodes();
}
return $result;
}
public function setAction()
{
$result = array("result"=>"failed");
if ($this->request->isPost()) {
// load model and update with provided data
$mdlUser = new User();
$mdlUser->setNodes($this->request->getPost("user"));
// perform validation
$valMsgs = $mdlUser->performValidation();
foreach ($valMsgs as $field => $msg) {
if (!array_key_exists("validations", $result)) {
$result["validations"] = array();
}
$result["validations"]["user.".$msg->getField()] = $msg->getMessage();
}
// serialize model to config and save
if ($valMsgs->count() == 0) {
$mdlUser->serializeToConfig();
Config::getInstance()->save();
$result["result"] = "saved";
}
}
return $result;
}
public function searchUserAction()
{
$this->sessionClose();
$mdlUser = $this->getModel();
$grid = new UIModelGrid($mdlUser->users->user);
return $grid->fetchBindRequest(
$this->request,
array("enabled", "username", "password" )
);
}
public function getUserAction($uuid = null)
{
$mdlUser = $this->getModel();
if ($uuid != null) {
$node = $mdlUser->getNodeByReference('users.user.' . $uuid);
if ($node != null) {
// return node
return array("user" => $node->getNodes());
}
} else {
$node = $mdlUser->users->user->add();
return array("user" => $node->getNodes());
}
return array();
}
public function addUserAction()
{
$result = array("result" => "failed");
if ($this->request->isPost() && $this->request->hasPost("user")) {
$result = array("result" => "failed", "validations" => array());
$mdlUser = $this->getModel();
$node = $mdlUser->users->user->Add();
$node->setNodes($this->request->getPost("user"));
$valMsgs = $mdlUser->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "user", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
unset($result['validations']);
// save config if validated correctly
$mdlUser->serializeToConfig();
Config::getInstance()->save();
unset($result['validations']);
$result["result"] = "saved";
}
}
return $result;
}
public function delUserAction($uuid)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlUser = $this->getModel();
if ($uuid != null) {
if ($mdlUser->users->user->del($uuid)) {
$mdlUser->serializeToConfig();
Config::getInstance()->save();
$result['result'] = 'deleted';
} else {
$result['result'] = 'not found';
}
}
}
return $result;
}
public function setUserAction($uuid)
{
if ($this->request->isPost() && $this->request->hasPost("user")) {
$mdlSetting = $this->getModel();
if ($uuid != null) {
$node = $mdlSetting->getNodeByReference('users.user.' . $uuid);
if ($node != null) {
$result = array("result" => "failed", "validations" => array());
$userInfo = $this->request->getPost("user");
$node->setNodes($userInfo);
$valMsgs = $mdlSetting->performValidation();
foreach ($valMsgs as $field => $msg) {
$fieldnm = str_replace($node->__reference, "user", $msg->getField());
$result["validations"][$fieldnm] = $msg->getMessage();
}
if (count($result['validations']) == 0) {
// save config if validated correctly
$mdlSetting->serializeToConfig();
Config::getInstance()->save();
$result = array("result" => "saved");
}
return $result;
}
}
}
return array("result" => "failed");
}
public function toggle_handler($uuid, $elements, $element)
{
$result = array("result" => "failed");
if ($this->request->isPost()) {
$mdlSetting = $this->getModel();
if ($uuid != null) {
$node = $mdlSetting->getNodeByReference($elements . '.'. $element .'.' . $uuid);
if ($node != null) {
if ($node->enabled->__toString() == "1") {
$result['result'] = "Disabled";
$node->enabled = "0";
} else {
$result['result'] = "Enabled";
$node->enabled = "1";
}
// if item has toggled, serialize to config and save
$mdlSetting->serializeToConfig();
Config::getInstance()->save();
}
}
}
return $result;
}
public function toggleUserAction($uuid)
{
return $this->toggle_handler($uuid, 'users', 'user');
}
}
@@ -0,0 +1,41 @@
<?php
/*
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Siproxd;
class GeneralController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
$this->view->title = gettext("Siproxd Settings");
$this->view->generalForm = $this->getForm("general");
$this->view->formDialogEditSiproxdUser = $this->getForm("dialogEditSiproxdUser");
$this->view->formDialogEditSiproxdDomain = $this->getForm("dialogEditSiproxdDomain");
$this->view->pick('OPNsense/Siproxd/general');
}
}
@@ -0,0 +1,26 @@
<form>
<field>
<id>domain.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>This will enable or disable the domain account.</help>
</field>
<field>
<id>domain.name</id>
<label>Name</label>
<type>text</type>
<help>Set a name for your outbound domain</help>
</field>
<field>
<id>domain.host</id>
<label>Host</label>
<type>text</type>
<help>Set the hostname or IP of the SIP server.</help>
</field>
<field>
<id>domain.port</id>
<label>Port</label>
<type>text</type>
<help>Set the port for this host. Default should be fine for most cases.</help>
</field>
</form>
@@ -0,0 +1,20 @@
<form>
<field>
<id>user.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>This will enable or disable the user account.</help>
</field>
<field>
<id>user.username</id>
<label>Username</label>
<type>text</type>
<help>Set the unique username for the user. Allowed characters are 0-9, a-z, A-Z, and ._-</help>
</field>
<field>
<id>user.password</id>
<label>Password</label>
<type>text</type>
<help>Set the password for the user. Allowed characters are 0-9, a-z, A-Z, and ,._-!$%/()+#= with up to 128 characters.</help>
</field>
</form>
@@ -0,0 +1,199 @@
<form>
<field>
<id>general.enabled</id>
<label>Enable siproxd service</label>
<type>checkbox</type>
<help>This will activate the siproxd service.</help>
</field>
<field>
<id>general.if_inbound</id>
<label>Inbound interface</label>
<type>dropdown</type>
<help>Select the interface where your SIP requests come from.</help>
</field>
<field>
<id>general.if_outbound</id>
<label>Outbound interface</label>
<type>dropdown</type>
<help>Select the interface where your SIP requests are going to.</help>
</field>
<field>
<id>general.host_outbound</id>
<label>Host outbound</label>
<type>text</type>
<help>Only use in a double nat scenario where SIP don't know your external public address. Format is CSV without spaces and CIDR, like 192.168.0.0/24,10.0.0.0/8.</help>
</field>
<field>
<id>general.hosts_allow_reg</id>
<label>Hosts to allow registration</label>
<type>text</type>
<help>Please specify the internal networks allowed to register here. Leave empty to allow every device. Format is CSV without spaces and CIDR, like 192.168.0.0/24,10.0.0.0/8.</help>
</field>
<field>
<id>general.hosts_allow_sip</id>
<label>Hosts to allow SIP</label>
<type>text</type>
<help>Here you specify the devices allowed to do SIP connections to siproxd (internal and external). Format is CSV without spaces and CIDR, like 192.168.0.0/24,10.0.0.0/8.</help>
</field>
<field>
<id>general.hosts_deny_sip</id>
<label>Host to deny SIP</label>
<type>text</type>
<help>Here you specify the networks disallowed to do SIP connections to siproxd. It has a higher priority than 'Hosts to allow SIP'.</help>
</field>
<field>
<id>general.sip_listen_port</id>
<label>SIP listen port</label>
<type>text</type>
<help>SIP port the service use, default of 5060 is perfectly fine.</help>
</field>
<field>
<id>general.rtp_port_low</id>
<label>RTP port low</label>
<type>text</type>
<help>Beginning of the port range RTP may use.</help>
</field>
<field>
<id>general.rtp_port_high</id>
<label>RTP port high</label>
<type>text</type>
<help>Ending of the port range RTP may use.</help>
</field>
<field>
<id>general.rtp_timeout</id>
<label>RTP timeout</label>
<type>text</type>
</field>
<field>
<id>general.rtp_dscp</id>
<label>RTP DSCP</label>
<type>text</type>
<help>DSCP value to set for RTP packets.</help>
</field>
<field>
<id>general.sip_dscp</id>
<label>SIP DSCP</label>
<type>text</type>
<help>DSCP value to set for SIP packets.</help>
</field>
<field>
<id>general.rtp_input_dejitter</id>
<label>RTP input dejitter</label>
<type>checkbox</type>
<help>De-Jitter inbound packets (defaults to 0).</help>
</field>
<field>
<id>general.rtp_output_dejitter</id>
<label>RTP output dejitter</label>
<type>checkbox</type>
<help>De-Jitter outbound packets (defaults to 0).</help>
</field>
<field>
<id>general.tcp_timeout</id>
<label>TCP timeout</label>
<type>text</type>
<help>Time in seconds when an inactive TCP session will be disconnected.</help>
</field>
<field>
<id>general.tcp_connect_timeout</id>
<label>TCP connect timeout</label>
<type>text</type>
<help>Time in milli seconds siproxd should wait until the connection is established.</help>
</field>
<field>
<id>general.tcp_keepalive</id>
<label>TCP keepalive</label>
<type>text</type>
<help>Time in seconds how often siproxd should send an empty Sip-Keep-Alive to hold the connection.</help>
</field>
<field>
<id>general.ua_string</id>
<label>Useragent string</label>
<type>text</type>
<help>Siproxd will masquerade the interal UAs to this given string (optional).</help>
</field>
<field>
<id>general.use_rport</id>
<label>Remote ports in VIA-Header</label>
<type>dropdown</type>
<help>This setting is only relevant for double nat scenarios, where default port 5060 would be replaced by a NAT device.</help>
</field>
<field>
<id>general.plugin_defaulttarget_enable</id>
<label>Enable defaulttarget plugin</label>
<type>checkbox</type>
<help>Enable or disable the defaulttarget plugin.</help>
</field>
<field>
<id>general.plugin_defaulttarget_log</id>
<label>Enable defaulttarget logging</label>
<type>checkbox</type>
<help>Enable logging of defaulttarget plugin.</help>
</field>
<field>
<id>general.plugin_defaulttarget_target</id>
<label>Default target account</label>
<type>text</type>
<help>Redirect all incoming calls to a given SIP-URI with format sip:internal@ip:port.</help>
</field>
<field>
<id>general.plugin_fix_bogus_via_enable</id>
<label>Enable fix_bogus_via plugin</label>
<type>checkbox</type>
<help>Enable or disable the fix_bogus_via plugin.</help>
</field>
<field>
<id>general.plugin_fix_bogus_via_networks</id>
<label>Networks to replace VIA-Header</label>
<type>text</type>
<help>Give here a list of networks to replace the VIA-Header. Default should fit for most situations.</help>
</field>
<field>
<id>general.plugin_fix_DTAG_enable</id>
<label>Enable fix_DTAG_networks plugin</label>
<type>checkbox</type>
<help>Enable or disable the fix_DTAG_networks plugin.</help>
</field>
<field>
<id>general.plugin_fix_DTAG_networks</id>
<label>DTAG servers</label>
<type>text</type>
<help>List of networks where to apply the DTAG fix. Default should fit for most situations.</help>
</field>
<field>
<id>general.plugin_fbox_anoncall_enable</id>
<label>Enable fbox_anoncall_networks plugin</label>
<type>checkbox</type>
<help>Enable or disable the fix_DTAG_networks plugin.</help>
</field>
<field>
<id>general.plugin_fbox_anoncall_networks</id>
<label>Network list for fbox anoncall plugin</label>
<type>text</type>
<help>List of networks where to apply the FritzBox Anoncall plugin. Default should fit for most situations.</help>
</field>
<field>
<id>general.plugin_stun_server_enable</id>
<label>Enable STUN plugin</label>
<type>checkbox</type>
<help>Enable or disable the STUN plugin.</help>
</field>
<field>
<id>general.plugin_stun_server_host</id>
<label>STUN server</label>
<type>text</type>
<help>Here you can set the FQDN of your STUN server.</help>
</field>
<field>
<id>general.plugin_stun_server_port</id>
<label>STUN port</label>
<type>text</type>
<help>Here you can set the port of your STUN server.</help>
</field>
<field>
<id>general.plugin_stun_server_period</id>
<label>STUN period</label>
<type>text</type>
<help>With STUN periond you can set the time in seconds how often to request for IP info from STUN server.</help>
</field>
</form>
@@ -0,0 +1,9 @@
<acl>
<page-services-siproxd>
<name>Services: Siproxd</name>
<patterns>
<pattern>ui/siproxd/*</pattern>
<pattern>api/siproxd/*</pattern>
</patterns>
</page-services-siproxd>
</acl>
@@ -0,0 +1,31 @@
<?php
/*
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Siproxd;
use OPNsense\Base\BaseModel;
class Domain extends BaseModel
{
}
@@ -0,0 +1,27 @@
<model>
<mount>//OPNsense/siproxd/domain</mount>
<description>Siproxd outbound domain configuration</description>
<version>1.0.0</version>
<items>
<domains>
<domain type="ArrayField">
<enabled type="BooleanField">
<default>1</default>
<Required>Y</Required>
</enabled>
<name type="TextField">
<default></default>
<Required>Y</Required>
</name>
<host type="TextField">
<default></default>
<Required>Y</Required>
</host>
<port type="IntegerField">
<default>5060</default>
<Required>Y</Required>
</port>
</domain>
</domains>
</items>
</model>
@@ -0,0 +1,35 @@
<?php
/*
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Siproxd;
use OPNsense\Base\BaseModel;
class General extends BaseModel
{
}
@@ -0,0 +1,182 @@
<model>
<mount>//OPNsense/siproxd/general</mount>
<description>Siproxd configuration</description>
<version>1.0.0</version>
<items>
<enabled type="BooleanField">
<default>0</default>
<Required>Y</Required>
</enabled>
<if_inbound type="InterfaceField">
<default></default>
<Required>Y</Required>
</if_inbound>
<if_outbound type="InterfaceField">
<default></default>
<Required>Y</Required>
</if_outbound>
<host_outbound type="TextField">
<default></default>
<Required>N</Required>
</host_outbound>
<hosts_allow_reg type="NetworkField">
<default></default>
<WildcardEnabled>N</WildcardEnabled>
<NetMaskRequired>Y</NetMaskRequired>
<FieldSeparator>,</FieldSeparator>
<Required>N</Required>
</hosts_allow_reg>
<hosts_allow_sip type="NetworkField">
<default></default>
<WildcardEnabled>N</WildcardEnabled>
<NetMaskRequired>Y</NetMaskRequired>
<FieldSeparator>,</FieldSeparator>
<Required>N</Required>
</hosts_allow_sip>
<hosts_deny_sip type="NetworkField">
<default></default>
<WildcardEnabled>N</WildcardEnabled>
<NetMaskRequired>Y</NetMaskRequired>
<FieldSeparator>,</FieldSeparator>
<Required>N</Required>
</hosts_deny_sip>
<sip_listen_port type="IntegerField">
<default>5060</default>
<Required>Y</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>65535</MaximumValue>
</sip_listen_port>
<rtp_port_low type="IntegerField">
<default>7070</default>
<Required>Y</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>65535</MaximumValue>
</rtp_port_low>
<rtp_port_high type="IntegerField">
<default>7089</default>
<Required>Y</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>65535</MaximumValue>
</rtp_port_high>
<rtp_timeout type="IntegerField">
<default>300</default>
<Required>Y</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>10000</MaximumValue>
</rtp_timeout>
<rtp_dscp type="IntegerField">
<default>46</default>
<Required>Y</Required>
<MinimumValue>0</MinimumValue>
<MaximumValue>64</MaximumValue>
</rtp_dscp>
<sip_dscp type="IntegerField">
<default>0</default>
<Required>Y</Required>
<MinimumValue>0</MinimumValue>
<MaximumValue>64</MaximumValue>
</sip_dscp>
<rtp_input_dejitter type="BooleanField">
<default>0</default>
<Required>N</Required>
</rtp_input_dejitter>
<rtp_output_dejitter type="BooleanField">
<default>0</default>
<Required>N</Required>
</rtp_output_dejitter>
<tcp_timeout type="IntegerField">
<default>600</default>
<Required>Y</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>10000</MaximumValue>
</tcp_timeout>
<tcp_connect_timeout type="IntegerField">
<default>500</default>
<Required>Y</Required>
<MinimumValue>1</MinimumValue>
<MaximumValue>10000</MaximumValue>
</tcp_connect_timeout>
<tcp_keepalive type="IntegerField">
<default>20</default>
<Required>Y</Required>
<MinimumValue>0</MinimumValue>
<MaximumValue>10000</MaximumValue>
</tcp_keepalive>
<ua_string type="TextField">
<default></default>
<Required>N</Required>
</ua_string>
<use_rport type="OptionField">
<default>Option1</default>
<multiple>N</multiple>
<Required>Y</Required>
<OptionValues>
<Option1 value="0">0 - do not add ;rport to via header</Option1>
<Option2 value="1">1 - do add ;rport to INCOMING via header only</Option2>
<Option3 value="2">2 - do add ;rport to OUTGOING via header only</Option3>
<Option4 value="3">3 - do add ;rport to OUTGOING and INCOMING via headers</Option4>
</OptionValues>
</use_rport>
<plugin_defaulttarget_enable type="BooleanField">
<default>0</default>
<Required>N</Required>
</plugin_defaulttarget_enable>
<plugin_defaulttarget_log type="BooleanField">
<default>0</default>
<Required>N</Required>
</plugin_defaulttarget_log>
<plugin_defaulttarget_target type="TextField">
<default></default>
<Required>N</Required>
</plugin_defaulttarget_target>
<plugin_fix_bogus_via_enable type="BooleanField">
<default>1</default>
<Required>N</Required>
</plugin_fix_bogus_via_enable>
<plugin_fix_bogus_via_networks type="NetworkField">
<default>10.0.0.0/8,172.16.0.0/12,192.168.0.0/16</default>
<WildcardEnabled>N</WildcardEnabled>
<NetMaskRequired>Y</NetMaskRequired>
<FieldSeparator>,</FieldSeparator>
<Required>N</Required>
</plugin_fix_bogus_via_networks>
<plugin_fix_DTAG_enable type="BooleanField">
<default>1</default>
<Required>N</Required>
</plugin_fix_DTAG_enable>
<plugin_fix_DTAG_networks type="NetworkField">
<default>217.0.23.100/32</default>
<WildcardEnabled>N</WildcardEnabled>
<NetMaskRequired>Y</NetMaskRequired>
<FieldSeparator>,</FieldSeparator>
<Required>N</Required>
</plugin_fix_DTAG_networks>
<plugin_fbox_anoncall_enable type="BooleanField">
<default>1</default>
<Required>N</Required>
</plugin_fbox_anoncall_enable>
<plugin_fbox_anoncall_networks type="NetworkField">
<default>10.0.0.0/8,172.16.0.0/12,192.168.0.0/16</default>
<WildcardEnabled>N</WildcardEnabled>
<NetMaskRequired>Y</NetMaskRequired>
<FieldSeparator>,</FieldSeparator>
<Required>N</Required>
</plugin_fbox_anoncall_networks>
<plugin_stun_server_enable type="BooleanField">
<default>0</default>
<Required>N</Required>
</plugin_stun_server_enable>
<plugin_stun_server_host type="TextField">
<default></default>
<Required>N</Required>
</plugin_stun_server_host>
<plugin_stun_server_port type="IntegerField">
<default></default>
<Required>N</Required>
</plugin_stun_server_port>
<plugin_stun_server_period type="IntegerField">
<default></default>
<Required>N</Required>
</plugin_stun_server_period>
</items>
</model>
@@ -0,0 +1,5 @@
<menu>
<Services>
<Siproxd cssClass="fa fa-phone" url="/ui/siproxd/general/index" />
</Services>
</menu>
@@ -0,0 +1,31 @@
<?php
/*
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace OPNsense\Siproxd;
use OPNsense\Base\BaseModel;
class User extends BaseModel
{
}
@@ -0,0 +1,25 @@
<model>
<mount>//OPNsense/siproxd/user</mount>
<description>Siproxd user configuration</description>
<version>1.0.0</version>
<items>
<users>
<user type="ArrayField">
<enabled type="BooleanField">
<default>1</default>
<Required>Y</Required>
</enabled>
<username type="TextField">
<default></default>
<Required>Y</Required>
<mask>/^([0-9a-zA-Z._\-]){1,128}$/u</mask>
</username>
<password type="TextField">
<default></default>
<Required>Y</Required>
<mask>/^([0-9a-zA-Z._\-\!\$\%\/\(\)\+\#\=]){1,128}$/u</mask>
</password>
</user>
</users>
</items>
</model>
@@ -0,0 +1,147 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
This file is Copyright © 2017 by Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#}
<!-- Navigation bar -->
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<li class="active"><a data-toggle="tab" href="#general">{{ lang._('General') }}</a></li>
<li><a data-toggle="tab" href="#users">{{ lang._('Users') }}</a></li>
<li><a data-toggle="tab" href="#domains">{{ lang._('Outbound Domains') }}</a></li>
<li><a data-toggle="tab" href="#showregistrations">{{ lang._('Current registrations') }}</a></li>
</ul>
<div class="tab-content content-box tab-content">
<div id="general" class="tab-pane fade in active">
<div class="content-box" style="padding-bottom: 1.5em;">
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}}
<hr />
<div class="col-md-12">
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b><i id="saveAct_progress" class=""></i></button>
</div>
</div>
</div>
<div id="users" class="tab-pane fade in">
<table id="grid-users" class="table table-responsive" data-editDialog="dialogEditSiproxdUser">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="username" data-type="string" data-visible="true">{{ lang._('Username') }}</th>
<th data-column-id="password" data-type="string" data-visible="true">{{ lang._('Password') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="5"></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
</td>
</tr>
</tfoot>
</table>
</div>
<div id="domains" class="tab-pane fade in">
<table id="grid-domains" class="table table-responsive" data-editDialog="dialogEditSiproxdDomain">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="name" data-type="string" data-visible="true">{{ lang._('Name') }}</th>
<th data-column-id="host" data-type="string" data-visible="true">{{ lang._('Host') }}</th>
<th data-column-id="port" data-type="string" data-visible="true">{{ lang._('Port') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="5"></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
</td>
</tr>
</tfoot>
</table>
</div>
<div id="showregistrations" class="tab-pane fade in">
<pre id="showregistrations-cmd"></pre>
</div>
</div>
{{ partial("layout_partials/base_dialog",['fields':formDialogEditSiproxdUser,'id':'dialogEditSiproxdUser','label':lang._('Edit User')])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogEditSiproxdDomain,'id':'dialogEditSiproxdDomain','label':lang._('Edit Outbound Domain')])}}
<script type="text/javascript">
$( document ).ready(function() {
var data_get_map = {'frm_general_settings':"/api/siproxd/general/get"};
mapDataToFormUI(data_get_map).done(function(data){
formatTokenizersUI();
$('.selectpicker').selectpicker('refresh');
});
ajaxCall(url="/api/siproxd/service/showregistrations", sendData={}, callback=function(data,status) {
$("#showregistrations-cmd").text(data['response']);
});
ajaxCall(url="/api/siproxd/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
$("#grid-users").UIBootgrid(
{ 'search':'/api/siproxd/user/searchUser',
'get':'/api/siproxd/user/getUser/',
'set':'/api/siproxd/user/setUser/',
'add':'/api/siproxd/user/addUser/',
'del':'/api/siproxd/user/delUser/',
'toggle':'/api/siproxd/user/toggleUser/'
}
);
$("#grid-domains").UIBootgrid(
{ 'search':'/api/siproxd/domain/searchDomain',
'get':'/api/siproxd/domain/getDomain/',
'set':'/api/siproxd/domain/setDomain/',
'add':'/api/siproxd/domain/addDomain/',
'del':'/api/siproxd/domain/delDomain/',
'toggle':'/api/siproxd/domain/toggleDomain/'
}
);
$("#saveAct").click(function(){
saveFormToEndpoint(url="/api/siproxd/general/set", formid='frm_general_settings',callback_ok=function(){
$("#saveAct_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall(url="/api/siproxd/service/reconfigure", sendData={}, callback=function(data,status) {
ajaxCall(url="/api/siproxd/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
$("#saveAct_progress").removeClass("fa fa-spinner fa-pulse");
});
});
});
});
</script>

Some files were not shown because too many files have changed in this diff Show More