Initial add of feature mobility user table:

- Add extra user fields and sccp_config entries
 - Create new buttonconfig table
 - Add PhoneCodepages like cp1251
This commit is contained in:
PhantomVl 2019-03-25 16:55:44 +03:00
parent c2b97fe3ee
commit f686274189
5 changed files with 42 additions and 22 deletions

View file

@ -514,12 +514,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
"buttons" => array( "buttons" => array(
"name" => _("Device Buttons"), "name" => _("Device Buttons"),
"page" => 'views/form.buttons.php' "page" => 'views/form.buttons.php'
), ));
"sccpcodec" => array( if ($this->sccpvalues['sccp_compatible']['data'] < '433') {
"name" => _("Device SCCP Codec"), $this->pagedata["sccpcodec"] = array(
"page" => 'views/server.codec.php' "name" => _("Device SCCP Codec"),
), "page" => 'views/server.codec.php'
); );
}
break; break;
@ -1124,6 +1125,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
}; };
$value = implode(";", $save_codec); $value = implode(";", $save_codec);
break; break;
case 'phonecodepage':
$value = 'null';
if (!empty($get_settings[$hdr_prefix . 'devlang'])) {
$lang_data = $this->extconfigs->getextConfig('sccp_lang',$get_settings[$hdr_prefix . 'devlang']);
if (!empty($lang_data)) {
$value = $lang_data['codepage'];
}
}
break;
case '_hwlang': case '_hwlang':
if (empty($get_settings[$hdr_prefix . 'netlang']) || empty($get_settings[$hdr_prefix . 'devlang'])) { if (empty($get_settings[$hdr_prefix . 'netlang']) || empty($get_settings[$hdr_prefix . 'devlang'])) {
$value = 'null'; $value = 'null';
@ -1197,7 +1207,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
if ($hw_id == 'new') { if ($hw_id == 'new') {
$this->srvinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $name_dev)); $this->srvinterface->sccp_core_commands(array('cmd' => 'reset_phone', 'name' => $name_dev));
} else { } else {
$this->srvinterface->sccp_core_commands(array('cmd' => 'reload_phone', 'name' => $name_dev)); $this->srvinterface->sccp_core_commands(array('cmd' => 'restart_phone', 'name' => $name_dev));
} }
return $save_settings; return $save_settings;
@ -1966,8 +1976,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
case "permit": case "permit":
$this->sccp_conf_init['general'][$key] = explode(';', $value['data']); $this->sccp_conf_init['general'][$key] = explode(';', $value['data']);
break; break;
case "devlang":
$lang_data = $this->extconfigs->getextConfig('sccp_lang',$value['data']);
if (!empty($lang_data)) {
$this->sccp_conf_init['general']['phonecodepage'] = $lang_data['codepage'];
}
break;
case "netlang": // Remove Key case "netlang": // Remove Key
case "devlang":
case "tftp_path": case "tftp_path":
case "sccp_compatible": case "sccp_compatible":
break; break;

View file

@ -1,9 +1,9 @@
<?php <?php
/** /**
* *
* Core Comsnd Interface * Core Comsnd Interface
* *
* https://www.voip-info.org/asterisk-manager-example-php/ * https://www.voip-info.org/asterisk-manager-example-php/
*/ */
/* !TODO!: Re-Indent this file. -TODO-: What do you mean? coreaccessinterface ?? */ /* !TODO!: Re-Indent this file. -TODO-: What do you mean? coreaccessinterface ?? */
@ -31,7 +31,7 @@ class srvinterface {
/* /*
* Replace or dublicate to AMI interface * Replace or dublicate to AMI interface
*/ */
public function sccp_core_commands($params = array()) { public function sccp_core_commands($params = array()) {
@ -42,7 +42,8 @@ class srvinterface {
'get_dev_info' => array('cmd' => "sccp show device", 'param' => 'name'), 'get_dev_info' => array('cmd' => "sccp show device", 'param' => 'name'),
'get_hints' => array('cmd' => "core show hints", 'param' => ''), 'get_hints' => array('cmd' => "core show hints", 'param' => ''),
'sccp_reload' => array('cmd' => "sccp reload force", 'param' => ''), 'sccp_reload' => array('cmd' => "sccp reload force", 'param' => ''),
'reset_phone' => array('cmd' => "sccp reset ", 'param' => 'name'), // Жесткая перезагрузка 'reset_phone' => array('cmd' => "sccp reset ", 'param' => 'name'), // Жесткая перезагрузка
'restart_phone' => array('cmd' => "sccp restart ", 'param' => 'name'),
'reload_phone' => array('cmd' => "sccp reload device ", 'param' => 'name'), 'reload_phone' => array('cmd' => "sccp reload device ", 'param' => 'name'),
'reset_token' => array('cmd' => "sccp tokenack ", 'param' => 'name'), 'reset_token' => array('cmd' => "sccp tokenack ", 'param' => 'name'),
'get_realtime_status' => array('cmd' => "realtime mysql status", 'param' => ''), 'get_realtime_status' => array('cmd' => "realtime mysql status", 'param' => ''),
@ -75,7 +76,7 @@ class srvinterface {
if (!empty($params['name'])) { if (!empty($params['name'])) {
$astman->Command('sccp device ' . $params['name'] . ' ' . $msg); $astman->Command('sccp device ' . $params['name'] . ' ' . $msg);
} else { } else {
} }
break; break;
default: default:
@ -133,7 +134,7 @@ class srvinterface {
$hint_all = $this->sccp_list_all_hints(); $hint_all = $this->sccp_list_all_hints();
foreach ($hint_all as $value) { foreach ($hint_all as $value) {
$res = $this->loc_after('@', $value); $res = $this->loc_after('@', $value);
// array_search($res, $hint_key)) != NULL) // array_search($res, $hint_key)) != NULL)
if (!isset($hint_key[$res])) { if (!isset($hint_key[$res])) {
$hint_key[$res] = '@' . $res; $hint_key[$res] = '@' . $res;
} }
@ -185,7 +186,7 @@ class srvinterface {
return $ast_res; return $ast_res;
} }
// !TODO!: -TODO-: install.php is still using the other version number. This is actually where I use another method ? // !TODO!: -TODO-: install.php is still using the other version number. This is actually where I use another method ?
public function get_compatible_sccp() { public function get_compatible_sccp() {
@ -211,7 +212,7 @@ class srvinterface {
} else { } else {
return 430; return 430;
} }
* *
*/ */
// return $res["vCode"]; // return $res["vCode"];
} }
@ -233,7 +234,7 @@ class srvinterface {
if (!empty($ast_out[1]) && $ast_out[1] == 'develop') { if (!empty($ast_out[1]) && $ast_out[1] == 'develop') {
$result["develop"] = $ast_out[1]; $result["develop"] = $ast_out[1];
$res = 10; $res = 10;
// !TODO!: This does not work as you might expect // !TODO!: This does not work as you might expect
if (base_convert($ast_out[3], 16, 10) == base_convert('702487a', 16, 10)) { if (base_convert($ast_out[3], 16, 10) == base_convert('702487a', 16, 10)) {
$result["vCode"] = 431; $result["vCode"] = 431;
} }
@ -383,7 +384,7 @@ class srvinterface {
explode(";|", implode(";|", $line_arr)); explode(";|", implode(";|", $line_arr));
list ($descr, $adress, $devname, $status, $token, $junk) = explode(";|", implode(";|", $line_arr)); list ($descr, $adress, $devname, $status, $token, $junk) = explode(";|", implode(";|", $line_arr));
// list ($descr, $adress, $devname, $status, $junk) = $line_arr; // list ($descr, $adress, $devname, $status, $junk) = $line_arr;
// if (strlen($ast_key[$devname]) < 1) { // if (strlen($ast_key[$devname]) < 1) {
if (strlen($devname) > 1) { if (strlen($devname) > 1) {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token); $ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token);
@ -396,7 +397,7 @@ class srvinterface {
} else { } else {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token); $ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token);
} }
* *
*/ */
} }
} }

View file

@ -343,6 +343,9 @@ class xmlinterface {
if (isset($lang_info[$lang])) { if (isset($lang_info[$lang])) {
$xml_node->name = $lang_info[$lang]['locale']; $xml_node->name = $lang_info[$lang]['locale'];
$xml_node->langCode = $lang_info[$lang]['code']; $xml_node->langCode = $lang_info[$lang]['code'];
if ($key == 'userLocale') {
$xml_node->winCharSet = $lang_info[$lang]['codepage'];
}
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node); $this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
} }
} }

View file

@ -159,7 +159,7 @@ function Get_DB_config($sccp_compatible) {
'hwlang' => array('rename' => "_hwlang"), 'hwlang' => array('rename' => "_hwlang"),
'_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'), '_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'),
'_loginname' => array('create' => 'varchar(20) NULL DEFAULT NULL AFTER `_hwlang`'), '_loginname' => array('create' => 'varchar(20) NULL DEFAULT NULL AFTER `_hwlang`'),
'_profileid' => array('create' => 'varchar(20) NULL DEFAULT NULL AFTER `_loginname`'), '_profileid' => array('create' => "INT(11) NOT NULL DEFAULT '0' AFTER `_loginname`"),
'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_profileid`"), 'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_profileid`"),
//'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'), //'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),
@ -241,7 +241,7 @@ function Get_DB_config($sccp_compatible) {
'hwlang' => array('rename' => "_hwlang"), 'hwlang' => array('rename' => "_hwlang"),
'_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'), '_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'),
'_loginname' => array('create' => 'varchar(20) NULL DEFAULT NULL AFTER `_hwlang`'), '_loginname' => array('create' => 'varchar(20) NULL DEFAULT NULL AFTER `_hwlang`'),
'_profileid' => array('create' => 'varchar(20) NULL DEFAULT NULL AFTER `_loginname`'), '_profileid' => array('create' => "INT(11) NOT NULL DEFAULT '0' AFTER `_loginname`"),
'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_profileid`"), 'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_profileid`"),
//'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'), //'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),

View file

@ -15,6 +15,7 @@
<changelog> <changelog>
* Version 13.0.0.1 * - Alfa Release tested on freepbx v.13.0.192.16, v.14.0.1.5 * Version 13.0.0.1 * - Alfa Release tested on freepbx v.13.0.192.16, v.14.0.1.5
* Version 13.0.0.2 * - Release tested * Version 13.0.0.2 * - Release tested
* Version 14.0.0.1 * - Alfa Release new DB structure Add User mobility
</changelog> </changelog>
<location></location> <location></location>
<supported> <supported>