Skip to content

Commit

Permalink
Merge pull request #18 from chan-sccp/Fix-Issue-#14
Browse files Browse the repository at this point in the history
Fix issue #14
  • Loading branch information
steve-lad authored Jun 13, 2021
2 parents 3b5fb64 + 0073301 commit 3d1b801
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 183 deletions.
13 changes: 8 additions & 5 deletions Sccp_manager.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ public function __construct($freepbx = null) {
}

$this->sccpvalues = $this->dbinterface->get_db_SccpSetting(); // Overwrite Exist
// $this->getSccpSetingINI(false); // get from sccep.ini
$this->initializeSccpPath();
$this->initVarfromDefs();
$this->initTftpLang();
Expand Down Expand Up @@ -202,6 +201,10 @@ public function initVarfromDefs() {
$this->sccpvalues[$key] = array('keyword' => $key, 'data' => $value, 'type' => '0', 'seq' => '0');
}
}
// Check timezone has not been changed in FreePBX and update if has
if ($this->sccpvalues['ntp_timezone'] != \date_default_timezone_get()) {
$this->sccpvalues['ntp_timezone'] = array('keyword' => 'ntp_timezone', 'seq'=>95, 'type' => 2, 'data' => \date_default_timezone_get());
}
}

/*
Expand Down Expand Up @@ -762,9 +765,9 @@ function handleSubmit($get_settings, $validateonly = false) {

case 'sccp_ntp_timezone':
$tz_id = $value;
$TZdata = $this->extconfigs->getextConfig('sccp_timezone_offset', $tz_id);
$TZdata = $this->extconfigs->getextConfig('sccp_timezone', $tz_id);
if (!empty($TZdata)) {
$value = ($TZdata / 60);
$value = $TZdata['offset']/60;
if (!($this->sccpvalues['tzoffset']['data'] == $value)) {
$save_settings[] = array('keyword' => 'tzoffset', 'data' => $value,
'seq' => '98',
Expand All @@ -774,7 +777,6 @@ function handleSubmit($get_settings, $validateonly = false) {
break;
}
}

if (!empty($save_settings)) {
$this->saveSccpSettings($save_settings);
$this->sccpvalues = $this->dbinterface->get_db_SccpSetting();
Expand Down Expand Up @@ -1069,6 +1071,7 @@ function initializeSccpPath() {
}

$driver = $this->FreePBX->Core->getAllDriversInfo();
// Below is always set to replace; good for Develop, but needs to be updated for release
$sccp_driver_replace = '';
if (empty($driver['sccp'])) {
$sccp_driver_replace = 'yes';
Expand All @@ -1084,7 +1087,7 @@ function initializeSccpPath() {

$this->sccpvalues['sccp_compatible'] = array('keyword' => 'sccp_compatible', 'data' => $ver_id, 'type' => '1', 'seq' => '99');
$this->sccppath = $this->extconfigs->validate_init_path($confDir, $this->sccpvalues, $sccp_driver_replace);
$driver = $this->FreePBX->Core->getAllDriversInfo(); // ??????
$driver = $this->FreePBX->Core->getAllDriversInfo(); // Check that Sccp Driver has been updated by above

$read_config = $this->cnf_read->getConfig('sccp.conf');
$this->sccp_conf_init['general'] = $read_config['general'];
Expand Down
6 changes: 3 additions & 3 deletions conf/sccpgeneral.xml.v433
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>off</default>
<button value="on">Yes</button>
<button value="off">No</button>
<help>Enabling NTP settings in device configuration.</help>
<help>Enable NTP settings in device configuration.</help>
</item>
<item type="IE" id="2" seq="10">
<label>NTP Server name (ip)</label>
Expand All @@ -501,7 +501,7 @@ and open the template in the editor. Base Version before all crash :-)
<default>pool.ntp.org</default>
<value>pool.ntp.org</value>
</input>
<help>NTP Server name or IP</help>
<help>NTP Server name or IP address</help>
</item>
<item type="IS" id="3" seq="10">
<name>ntp_server_mode</name>
Expand Down Expand Up @@ -532,7 +532,7 @@ and open the template in the editor. Base Version before all crash :-)
<select>
<default>UTC</default>
</select>
<help>Date Format: Time zone</help>
<help>System Time zone - this is set by FreePBX and can be changed in Settings : Advanced Settings</help>
</item>
</page_group>

Expand Down
Loading

0 comments on commit 3d1b801

Please sign in to comment.