Merge branch 'develop' into Fix-issue-#47
This commit is contained in:
commit
61beae544e
|
@ -1002,67 +1002,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDefaultSccpConfig() {
|
|
||||||
// Make sccp.conf data
|
|
||||||
// [general]
|
|
||||||
foreach ($this->sccpvalues as $key => $value) {
|
|
||||||
if ($value['seq'] == 0) {
|
|
||||||
switch ($key) {
|
|
||||||
case "allow":
|
|
||||||
case "disallow":
|
|
||||||
case "deny":
|
|
||||||
$this->sccp_conf_init['general'][$key] = explode(';', $value['data']);
|
|
||||||
break;
|
|
||||||
case "localnet":
|
|
||||||
case "permit":
|
|
||||||
$content = $value['data'];
|
|
||||||
if (strpos($content, 'internal') !== false) {
|
|
||||||
$content = str_replace(';0.0.0.0/0.0.0.0', '', $value['data']);
|
|
||||||
}
|
|
||||||
$this->sccp_conf_init['general'][$key] = explode(';', $content);
|
|
||||||
break;
|
|
||||||
case "devlang":
|
|
||||||
/*
|
|
||||||
$lang_data = $this->extconfigs->getExtConfig('sccp_lang', $value['data']);
|
|
||||||
if (!empty($lang_data)) {
|
|
||||||
// TODO: will always get here, but lang_data['codepage'] will be empty as not a valid key
|
|
||||||
$this->sccp_conf_init['general']['phonecodepage'] = $lang_data['codepage'];
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
case "netlang": // Remove Key
|
|
||||||
case "tftp_path":
|
|
||||||
case "sccp_compatible": // This is equal to SccpDBmodel
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!empty($value['data'])) {
|
|
||||||
$this->sccp_conf_init['general'][$key] = $value['data'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// [Namesoftkeyset]
|
|
||||||
// type=softkeyset
|
|
||||||
//
|
|
||||||
// ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!!
|
|
||||||
// This will add problems when solving problems caused by unexpected solutions from users.
|
|
||||||
//
|
|
||||||
if (file_exists($this->sccppath["asterisk"] . "/sccp_custom.conf")) {
|
|
||||||
$this->sccp_conf_init['HEADER'] = array(
|
|
||||||
"; ;",
|
|
||||||
"; It is a very bad idea to add an external configuration file !!!! ;",
|
|
||||||
"; This will add problems when solving problems caused by unexpected solutions ;",
|
|
||||||
"; from users. ;",
|
|
||||||
";--------------------------------------------------------------------------------;",
|
|
||||||
"#include sccp_custom.conf"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!!
|
|
||||||
// TODO: Should only rewrite the general section - if users have extensions, this may overwrite
|
|
||||||
// Should read first and then rewrite all existing sections.
|
|
||||||
$this->cnf_wr->writeConfig('sccp.conf', $this->sccp_conf_init);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSccpModelInformation($get = "all", $validate = false, $format_list = "all", $filter = array()) {
|
function getSccpModelInformation($get = "all", $validate = false, $format_list = "all", $filter = array()) {
|
||||||
$file_ext = array('.loads', '.sbn', '.bin', '.zup', '.sbin', '.SBN', '.LOADS');
|
$file_ext = array('.loads', '.sbn', '.bin', '.zup', '.sbin', '.SBN', '.LOADS');
|
||||||
$dir = $this->sccppath['tftp_firmware_path'];
|
$dir = $this->sccppath['tftp_firmware_path'];
|
||||||
|
|
|
@ -41,10 +41,3 @@ hotline_context=default
|
||||||
hotline_extension=111
|
hotline_extension=111
|
||||||
devicetable=sccpdevice
|
devicetable=sccpdevice
|
||||||
linetable=sccpline
|
linetable=sccpline
|
||||||
|
|
||||||
[KeySet1] ; Managed by sccp_manager
|
|
||||||
type=softkeyset
|
|
||||||
onhook=redial,newcall,cfwdall,dnd,pickup,gpickup,private
|
|
||||||
connected=hold,endcall,park,select,cfwdall,cfwdbusy
|
|
||||||
onhold=newcall
|
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@ global $settingsFromDb;
|
||||||
global $thisInstaller;
|
global $thisInstaller;
|
||||||
global $cnf_int;
|
global $cnf_int;
|
||||||
global $sccp_compatible;
|
global $sccp_compatible;
|
||||||
|
global $cnf_wr;
|
||||||
|
|
||||||
$mobile_hw = '0';
|
$mobile_hw = '0';
|
||||||
$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT" : "AUTO_INCREMENT";
|
$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT" : "AUTO_INCREMENT";
|
||||||
$table_req = array('sccpdevice', 'sccpline', 'sccpsettings');
|
$table_req = array('sccpdevice', 'sccpline', 'sccpsettings');
|
||||||
|
@ -1065,6 +1067,7 @@ function cleanUpSccpSettings() {
|
||||||
global $aminterface;
|
global $aminterface;
|
||||||
global $sccp_compatible;
|
global $sccp_compatible;
|
||||||
global $amp_conf;
|
global $amp_conf;
|
||||||
|
global $cnf_int;
|
||||||
|
|
||||||
// Get current default settings from db
|
// Get current default settings from db
|
||||||
$stmt = $db->prepare("SELECT keyword, sccpsettings.* FROM sccpsettings");
|
$stmt = $db->prepare("SELECT keyword, sccpsettings.* FROM sccpsettings");
|
||||||
|
@ -1220,6 +1223,10 @@ function cleanUpSccpSettings() {
|
||||||
)";
|
)";
|
||||||
$results = $db->query($sql);
|
$results = $db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now correct sccp.conf to replace any illegal settings
|
||||||
|
$thisInstaller->createDefaultSccpConfig($settingsFromDb, $cnf_int->get('ASTETCDIR'));
|
||||||
|
|
||||||
// have to correct prior verion sccpline lists for allow/disallow and deny permit. Prior
|
// have to correct prior verion sccpline lists for allow/disallow and deny permit. Prior
|
||||||
// versions used csl, but chan-sccp expects ; separated lists when returned by db.
|
// versions used csl, but chan-sccp expects ; separated lists when returned by db.
|
||||||
|
|
||||||
|
|
|
@ -247,7 +247,7 @@ trait ajaxHelper {
|
||||||
if (!empty($request['softkey'])) {
|
if (!empty($request['softkey'])) {
|
||||||
$id_name = $request['softkey'];
|
$id_name = $request['softkey'];
|
||||||
unset($this->sccp_conf_init[$id_name]);
|
unset($this->sccp_conf_init[$id_name]);
|
||||||
$this->createDefaultSccpConfig();
|
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"]);
|
||||||
$msg = print_r($this->aminterface->core_sccp_reload(), 1);
|
$msg = print_r($this->aminterface->core_sccp_reload(), 1);
|
||||||
return array('status' => true, 'table_reload' => true);
|
return array('status' => true, 'table_reload' => true);
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ trait ajaxHelper {
|
||||||
$this->sccp_conf_init[$id_name][$keyl] = $request[$keyl];
|
$this->sccp_conf_init[$id_name][$keyl] = $request[$keyl];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->createDefaultSccpConfig();
|
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"]);
|
||||||
|
|
||||||
// !TODO!: -TODO-: Check SIP Support Enabled
|
// !TODO!: -TODO-: Check SIP Support Enabled
|
||||||
$this->createSccpXmlSoftkey();
|
$this->createSccpXmlSoftkey();
|
||||||
|
@ -515,8 +515,8 @@ trait ajaxHelper {
|
||||||
foreach ($dbSaveArray as $key => $rowToSave) {
|
foreach ($dbSaveArray as $key => $rowToSave) {
|
||||||
$this->dbinterface->updateTableDefaults($rowToSave['table'], $rowToSave['field'], $rowToSave['Default']);
|
$this->dbinterface->updateTableDefaults($rowToSave['table'], $rowToSave['field'], $rowToSave['Default']);
|
||||||
}
|
}
|
||||||
|
// rewrite sccp.conf
|
||||||
$this->createDefaultSccpConfig(); // Rewrite Config.
|
$this->createDefaultSccpConfig($this->sccpvalues, $this->sccppath["asterisk"]);
|
||||||
$save_settings[] = array('status' => true, );
|
$save_settings[] = array('status' => true, );
|
||||||
$this->createDefaultSccpXml();
|
$this->createDefaultSccpXml();
|
||||||
|
|
||||||
|
|
|
@ -274,6 +274,87 @@ trait helperfunctions {
|
||||||
unset($sysConfig);
|
unset($sysConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createDefaultSccpConfig(array $sccpvalues, string $asteriskPath) {
|
||||||
|
global $cnf_wr;
|
||||||
|
// Make sccp.conf data
|
||||||
|
// [general] section
|
||||||
|
// TODO: Need to review sccpsettings seq numbering, as will speed this up, and remove the need for $permittedSettings.
|
||||||
|
$cnf_wr = \FreePBX::WriteConfig();
|
||||||
|
//clear old settings, and initiate with allow/disallow and permit/deny keys in correct order
|
||||||
|
$this->sccp_conf_init = array();
|
||||||
|
$this->sccp_conf_init['general']['disallow'] = 'all';
|
||||||
|
$this->sccp_conf_init['general']['allow'] = '';
|
||||||
|
$this->sccp_conf_init['general']['deny'] = '0.0.0.0/0.0.0.0';
|
||||||
|
$this->sccp_conf_init['general']['permit'] = '0.0.0.0/0.0.0.0';
|
||||||
|
// permitted chan-sccp settings array
|
||||||
|
$permittedSettings = array(
|
||||||
|
'debug', 'servername', 'keepalive', 'context', 'dateformat', 'bindaddr', 'port', 'secbindaddr', 'secport', 'disallow', 'allow', 'deny', 'permit',
|
||||||
|
'localnet', 'externip', 'externrefresh', 'firstdigittimeout', 'digittimeout', 'digittimeoutchar', 'recorddigittimeoutchar', 'simulate_enbloc',
|
||||||
|
'ringtype', 'autoanswer_ring_time', 'autoanswer_tone', 'remotehangup_tone', 'transfer', 'transfer_tone', 'transfer_on_hangup', 'dnd_tone',
|
||||||
|
'callwaiting_tone', 'callwaiting_interval', 'musicclass', 'language', 'callevents', 'accountcode', 'sccp_tos', 'sccp_cos', 'audio_tos',
|
||||||
|
'audio_cos', 'video_tos', 'video_cos', 'echocancel', 'silencesuppression', 'earlyrtp', 'dndFeature', 'private', 'mwilamp', 'mwioncall',
|
||||||
|
'cfwdall', 'cfwdbusy', 'cfwdnoanswer', 'cfwdnoanswer_timeout', 'nat', 'directrtp', 'allowoverlap', 'pickup_modeanswer',
|
||||||
|
'callhistory_answered_elsewhere', 'amaflags', 'callanswerorder', 'devicetable', 'linetable', 'meetmeopts', 'jbenable', 'jbforce',
|
||||||
|
'jblog', 'jbmaxsize', 'jbresyncthreshold', 'jbimpl', 'hotline_enabled', 'hotline_extension', 'hotline_context', 'hotline_label', 'fallback',
|
||||||
|
'backoff_time', 'server_priority');
|
||||||
|
|
||||||
|
foreach ($sccpvalues as $key => $value) {
|
||||||
|
if (!in_array($key, $permittedSettings, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($value['seq'] == 0) {
|
||||||
|
switch ($key) {
|
||||||
|
case "allow":
|
||||||
|
case "disallow":
|
||||||
|
case "deny":
|
||||||
|
$this->sccp_conf_init['general'][$key] = explode(';', $value['data']);
|
||||||
|
break;
|
||||||
|
case "localnet":
|
||||||
|
case "permit":
|
||||||
|
$content = $value['data'];
|
||||||
|
if (strpos($content, 'internal') !== false) {
|
||||||
|
$content = str_replace(';0.0.0.0/0.0.0.0', '', $value['data']);
|
||||||
|
}
|
||||||
|
$this->sccp_conf_init['general'][$key] = explode(';', $content);
|
||||||
|
break;
|
||||||
|
case "devlang":
|
||||||
|
/*
|
||||||
|
$lang_data = $this->extconfigs->getExtConfig('sccp_lang', $value['data']);
|
||||||
|
if (!empty($lang_data)) {
|
||||||
|
// TODO: will always get here, but lang_data['codepage'] will be empty as not a valid key
|
||||||
|
$this->sccp_conf_init['general']['phonecodepage'] = $lang_data['codepage'];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
case "netlang": // Remove Key
|
||||||
|
case "tftp_path":
|
||||||
|
case "sccp_compatible": // This is equal to SccpDBmodel
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (!empty($value['data'])) {
|
||||||
|
$this->sccp_conf_init['general'][$key] = $value['data'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// ----- It is a very bad idea to add an external configuration file "sccp_custom.conf" !!!!
|
||||||
|
// This will complicate solving problems caused by unexpected solutions from users.
|
||||||
|
//
|
||||||
|
if (file_exists($asteriskPath . "/sccp_custom.conf")) {
|
||||||
|
$this->sccp_conf_init['HEADER'] = array(
|
||||||
|
"; ;",
|
||||||
|
"; It is a very bad idea to add an external configuration file !!!! ;",
|
||||||
|
"; This will complicate solving problems caused by unexpected solutions ;",
|
||||||
|
"; from users. ;",
|
||||||
|
";--------------------------------------------------------------------------------;",
|
||||||
|
"#include sccp_custom.conf"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$cnf_wr->WriteConfig('sccp.conf', $this->sccp_conf_init);
|
||||||
|
//$this->$cnf_wr->writeConfig('sccp.conf', $this->sccp_conf_init);
|
||||||
|
}
|
||||||
|
|
||||||
public function initVarfromXml() {
|
public function initVarfromXml() {
|
||||||
if ((array) $this->xml_data) {
|
if ((array) $this->xml_data) {
|
||||||
foreach ($this->xml_data->xpath('//page_group') as $item) {
|
foreach ($this->xml_data->xpath('//page_group') as $item) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"rawname": "sccp_manager",
|
"rawname": "sccp_manager",
|
||||||
"repo": "stable",
|
"repo": "stable",
|
||||||
"name": "Sccp Manager",
|
"name": "Sccp Manager",
|
||||||
"version": "14.3.0.19",
|
"version": "14.3.0.20",
|
||||||
"publisher": "Steve Lad",
|
"publisher": "Steve Lad",
|
||||||
"license": "GPL",
|
"license": "GPL",
|
||||||
"licenselink": "http://www.gnu.org/licenses/gpl.txt",
|
"licenselink": "http://www.gnu.org/licenses/gpl.txt",
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
"supported": {
|
"supported": {
|
||||||
"version": "13.0"
|
"version": "13.0"
|
||||||
},
|
},
|
||||||
"location": "https://github.com/chan-sccp/sccp_manager/archive/refs/tags/v14.3.0.19.tar.gz",
|
"location": "https://github.com/chan-sccp/sccp_manager/archive/refs/tags/v14.3.0.20.tar.gz",
|
||||||
"md5sum": "d9d96ada20338e7e88ac8eb4681ca8b3",
|
"md5sum": "5bade17a4df09da91bc4436d8e359fc1",
|
||||||
"packaged": "1640775011"
|
"packaged": "1640854870"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue