Update Create_SEP_XML and defaults
Merge data_values and dev_config so that device specific settings are written to the SEP file Add sccp general device defaults Allow saving empty sccpvalues Add new fields to sccpdevice move phonepersonalization to sccpdevice from sccpline Change advanced display block for personalisation to correctly pickup defaults
This commit is contained in:
parent
e841c7cb40
commit
9be50bab5c
|
@ -1102,7 +1102,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->sccpvalues as $key => $value) {
|
||||
$data_value[$key] = $value['data'];
|
||||
}
|
||||
|
@ -1126,7 +1125,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
if (!$sccp_native) {
|
||||
return $this->xmlinterface->create_SEP_SIP_XML($this->sccppath["tftp_path_store"], $data_value, $dev_config, $dev_id, $lang_data);
|
||||
}
|
||||
return $this->xmlinterface->create_SEP_XML($this->sccppath["tftp_path_store"], $data_value, $dev_config, $dev_id, $lang_data);
|
||||
return $this->xmlinterface->create_SEP_XML($this->sccppath["tftp_templates"], $data_value, $dev_config, $dev_id, $lang_data);
|
||||
}
|
||||
|
||||
function deleteSccpDeviceXML($dev_id = '') {
|
||||
|
|
|
@ -433,6 +433,14 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
<button value="off">Off</button>
|
||||
<help>Use simulated enbloc dialing to speedup connection when dialing while onhook (older phones)</help>
|
||||
</item>
|
||||
<item type="IS" id="11" seq="98">
|
||||
<name>phonepersonalization</name>
|
||||
<label>Allow push background from server </label>
|
||||
<default>0</default>
|
||||
<button value="on">Enabled</button>
|
||||
<button value="off">Disabled</button>
|
||||
<help>This needs to be enabled to allow the server to push background or ringtones to the phone in the SEPXXXXXXXXXX.cnf.xml of each phone:</help>
|
||||
</item>
|
||||
</page_group>
|
||||
|
||||
<page_group name="sccp_dev_softkey">
|
||||
|
@ -1128,14 +1136,6 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
<button value="off">Disabled</button>
|
||||
<help>I'm guessing on this one, but on some devices, the background image on the display can be modified at the device. I think this is the thing that allows that to happen.</help>
|
||||
</item>
|
||||
<item type="IS" id="11" seq="98">
|
||||
<name>phonePersonalization</name>
|
||||
<label>Allow push background from server </label>
|
||||
<default>0</default>
|
||||
<button value="on">Enabled</button>
|
||||
<button value="off">Disabled</button>
|
||||
<help>This needs to be enabled to allow the server to push background or ringtones to the phone in the SEPXXXXXXXXXX.cnf.xml of each phone:</help>
|
||||
</item>
|
||||
<item type="IS" id="11" seq="98">
|
||||
<name>callLogBlfEnabled</name>
|
||||
<label>Allow BLF in Phone Directory</label>
|
||||
|
|
|
@ -281,7 +281,10 @@ function Get_DB_config($sccp_compatible)
|
|||
'_echocancel' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
|
||||
'_silencesuppression' => array('create' => "VARCHAR(20) NULL default null", 'modify' => "VARCHAR(20)"),
|
||||
'_sccp_tos' => array('create' => "VARCHAR(11) NOT NULL default '0x68'", 'modify' => "VARCHAR(11)"),
|
||||
'_sccp_cos' => array('create' => "VARCHAR(11) NOT NULL default '0x4'", 'modify' => "VARCHAR(11)")
|
||||
'_sccp_cos' => array('create' => "VARCHAR(11) NOT NULL default '0x4'", 'modify' => "VARCHAR(11)"),
|
||||
'_dev_sshPassword' => array('create' => "VARCHAR(25) NOT NULL default 'cisco'"),
|
||||
'_dev_sshUserId' => array('create' => "VARCHAR(25) NOT NULL default 'cisco'"),
|
||||
'_phonepersonalization' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')")
|
||||
),
|
||||
'sccpline' => array (
|
||||
'_regcontext' => array('create' => "VARCHAR(20) NULL default 'sccpregistration'", 'modify' => "VARCHAR(20)"),
|
||||
|
@ -289,7 +292,6 @@ function Get_DB_config($sccp_compatible)
|
|||
'_autoselectline_enabled' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
|
||||
'_autocall_select' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
|
||||
'_backgroundImageAccess' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
|
||||
'_phonePersonalization' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
|
||||
'_callLogBlfEnabled' => array('create' => "enum('3','2') NOT NULL default '2'", 'modify' => "enum('3','2')")
|
||||
)
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<module>
|
||||
<rawname>sccp_manager</rawname>
|
||||
<name>SCCP Manager</name>
|
||||
<version>14.3.0.1</version>
|
||||
<version>14.3.0.0</version>
|
||||
<type>setup</type>
|
||||
<category>SCCP Connectivity</category>
|
||||
<publisher>Steve Lad, Alex GP</publisher>
|
||||
|
|
|
@ -163,7 +163,7 @@ class dbinterface
|
|||
$dbh = \FreePBX::Database();
|
||||
$stmt = $dbh->prepare('SELECT keyword, data, type, seq FROM sccpsettings ORDER BY type, seq');
|
||||
$stmt->execute();
|
||||
foreach ($stmt->fetchAll() as $key => $rowArray) {
|
||||
foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $key => $rowArray) {
|
||||
$settingsFromDb[$rowArray['keyword']] = $rowArray;
|
||||
unset($settingsFromDb[$key]);
|
||||
}
|
||||
|
@ -254,10 +254,8 @@ class dbinterface
|
|||
$stmt = $dbh->prepare('REPLACE INTO sccpsettings (keyword, data, seq, type) VALUES (:keyword,:data,:seq,:type)');
|
||||
}
|
||||
foreach ($save_value as $key => $dataArr) {
|
||||
if (!empty($dataArr) && isset($dataArr['data'])) {
|
||||
if (empty($dataArr['data'])) {
|
||||
if (empty($dataArr)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$stmt->bindParam(':keyword',$dataArr['keyword'],\PDO::PARAM_STR);
|
||||
$stmt->bindParam(':data',$dataArr['data'],\PDO::PARAM_STR);
|
||||
|
|
|
@ -113,7 +113,28 @@ class extconfigs
|
|||
'hotline_label' => 'hotline',
|
||||
'devicetable' => 'sccpdevice',
|
||||
'linetable' => 'sccpline',
|
||||
'displayconfig' => 'sccpgeneral'
|
||||
'displayconfig' => 'sccpgeneral',
|
||||
'_dev_sshPassword' => 'cisco',
|
||||
'_dev_sshUserId' => 'cisco',
|
||||
'dev_deviceProtocol' => 'SCCP',
|
||||
'dev_idleTimeout' => '60',
|
||||
'ntp_config_enabled' => 'off',
|
||||
'ntp_server' => 'pool.ntp.org',
|
||||
'ntp_server_mode' => 'unicast',
|
||||
'devlang' => 'English_United_States',
|
||||
'dev_authenticationURL' => '',
|
||||
'dev_informationURL' => '',
|
||||
'dev_messagesURL' => '',
|
||||
'dev_servicesURL' => '',
|
||||
'dev_directoryURL' => '',
|
||||
'dev_idleURL' => '',
|
||||
'dev_secureauthenticationURL' => '',
|
||||
'dev_secureinformationURL' => '',
|
||||
'dev_securemessagesURL' => '',
|
||||
'dev_secureservicesURL' => '',
|
||||
'dev_securedirectoryURL' => '',
|
||||
'dev_secureidleURL' => '',
|
||||
'dev_proxyServerURL' => ''
|
||||
);
|
||||
private $keysetdefault = array('onhook' => 'redial,newcall,cfwdall,cfwdbusy,cfwdnoanswer,pickup,gpickup,dnd,private',
|
||||
'connected' => 'hold,endcall,park,vidmode,select,cfwdall,cfwdbusy,idivert,monitor',
|
||||
|
|
|
@ -116,235 +116,234 @@ class xmlinterface
|
|||
}
|
||||
}
|
||||
|
||||
function create_SEP_XML($store_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array())
|
||||
function create_SEP_XML($store_path, $data_values, $dev_config, $dev_id, $lang_info = array())
|
||||
{
|
||||
// TODO: $data_values are system wide defaults, $dev_config are specific defice values.
|
||||
// Need to merge the two arrays so that device specific values override system values
|
||||
// Values that cannot be sent to the device by chan-sccp are prefixed by an underscore
|
||||
// so need to be sure that we apply the same convention to system wide defaults.
|
||||
$data_values = array_merge($data_values, $dev_config);
|
||||
$var_xml_general_fields = array('authenticationurl' => 'dev_authenticationURL', 'informationurl' => 'dev_informationURL', 'messagesurl' => 'dev_messagesURL',
|
||||
'servicesurl' => 'dev_servicesURL', 'directoryurl' => 'dev_directoryURL', 'idleurl' => 'dev_idleURL',
|
||||
'secureauthenticationurl' => 'dev_secureauthenticationURL',
|
||||
'secureinformationurl' => 'dev_secureinformationURL', 'securemessagesurl'=>'dev_securemessagesURL',
|
||||
'secureservicesurl'=>'dev_secureservicesURL', 'securedirectoryurl'=>'dev_securedirectoryURL', 'secureidleurl' => 'dev_secureidleURL',
|
||||
'proxyserverurl' => 'dev_proxyServerURL', 'idletimeout' => 'dev_idleTimeout',
|
||||
'sshuserid' => 'dev_sshUserId', 'sshpassword' => 'dev_sshPassword', 'deviceprotocol' => 'dev_deviceProtocol',
|
||||
'phonepersonalization' => 'phonePersonalization'
|
||||
'sshuserid' => '_dev_sshUserId', 'sshpassword' => '_dev_sshPassword', 'deviceprotocol' => 'dev_deviceProtocol',
|
||||
'phonepersonalization' => '_phonepersonalization'
|
||||
);
|
||||
$var_xml_general_vars = array('capfAuthMode' => 'null', 'capfList' => 'null', 'mobility' => 'null',
|
||||
'phoneServices' => 'null', 'certHash' => 'null',
|
||||
'deviceSecurityMode' => '1');
|
||||
|
||||
if (empty($dev_config)) {
|
||||
return false;
|
||||
$data_path = $dev_config['tftp_templates'];
|
||||
if (empty($data_path)) {
|
||||
die('Create_SEP_XML data_path not defined');
|
||||
}
|
||||
$data_path = $dev_config['tftp_path'];
|
||||
|
||||
if (empty($store_path) || empty($data_path) || empty($data_values) || empty($dev_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($dev_config['nametemplate'])) {
|
||||
$xml_template = $data_path . '/templates/' . $dev_config['nametemplate'];
|
||||
$xml_template = "{$data_path}/{$dev_config['nametemplate']}";
|
||||
} else {
|
||||
$xml_template = $data_path . '/templates/SEP0000000000.cnf.xml_79df_template';
|
||||
$xml_template = "{$data_path}/templates/SEP0000000000.cnf.xml_79df_template";
|
||||
}
|
||||
$xml_name = $store_path . '/' . $dev_id . '.cnf.xml';
|
||||
if (file_exists($xml_template)) {
|
||||
$xml_work = simplexml_load_file($xml_template);
|
||||
|
||||
foreach ($var_xml_general_vars as $key => $data) {
|
||||
if (isset($xml_work->$key)) {
|
||||
if ($data != 'null') {
|
||||
$xml_work->$key = $data;
|
||||
} else {
|
||||
$node = $xml_work->$key;
|
||||
unset($node[0][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($xml_work as $key => $data) {
|
||||
// Set System global Values
|
||||
$key_l = strtolower($key);
|
||||
if (!empty($var_xml_general_fields[$key_l])) {
|
||||
$xml_work->$key = $data_values[$var_xml_general_fields[$key_l]];
|
||||
}
|
||||
// Set section Values
|
||||
$xml_node = $xml_work->$key;
|
||||
switch ($key_l) {
|
||||
case 'devicepool':
|
||||
$xml_node = $xml_work->$key;
|
||||
foreach ($xml_work->$key->children() as $dkey => $ddata) {
|
||||
switch (strtolower($dkey)) {
|
||||
case 'datetimesetting':
|
||||
$xnode = &$xml_node->$dkey;
|
||||
$tz_id = $data_values['ntp_timezone'];
|
||||
$TZdata = $data_values['ntp_timezone_id'];
|
||||
if (empty($TZdata)) {
|
||||
$TZdata = array('offset' => '0', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
|
||||
}
|
||||
$xnode->name = $tz_id;
|
||||
$xnode->dateTemplate = $data_values['dateformat'];
|
||||
$xnode->timeZone = $TZdata['cisco_code'];
|
||||
// $xnode->timeZone = $tz_id.' Standard'.((empty($TZdata['daylight']))? '': '/'.$TZdata['daylight']).' Time';
|
||||
|
||||
if ($data_values['ntp_config_enabled'] == 'on') {
|
||||
$xnode->ntps->ntp->name = $data_values['ntp_server'];
|
||||
$xnode->ntps->ntp->ntpMode = $data_values['ntp_server_mode'];
|
||||
} else {
|
||||
$xnode->ntps = null;
|
||||
}
|
||||
// Ntp Config
|
||||
break;
|
||||
case 'srstinfo':
|
||||
if ($data_values['srst_Option'] == 'user') {
|
||||
break;
|
||||
}
|
||||
$xnode = &$xml_node->$dkey;
|
||||
$xnode->name = $data_values['srst_Name'];
|
||||
$xnode->srstOption = $data_values['srst_Option'];
|
||||
$xnode->userModifiable = $data_values['srst_userModifiable'];
|
||||
$xnode->isSecure = $data_values['srst_isSecure'];
|
||||
|
||||
$srst_fld = array('srst_ip' => array('ipAddr', 'port'));
|
||||
foreach ($srst_fld as $srst_pro => $srs_put) {
|
||||
if (empty($data_values[$srst_pro]) || ($data_values['srst_Option'] == 'disable') ) {
|
||||
$srst_data =array();
|
||||
} else {
|
||||
$srst_data = explode(';', $data_values[$srst_pro]);
|
||||
}
|
||||
$si = 1;
|
||||
foreach ($srst_data as $value) {
|
||||
$srs_val = explode('/', $value);
|
||||
$nod = $srs_put[0] . $si;
|
||||
$xnode->$nod = $srs_val[0];
|
||||
$nod = $srs_put[1] . $si;
|
||||
$xnode->$nod = ((empty($srs_val[1])) ? "2000": $srs_val[1]);
|
||||
$si++;
|
||||
}
|
||||
while ($si < 4) {
|
||||
$nod = $srs_put[0] . $si;
|
||||
$xnode->$nod = '';
|
||||
$nod = $srs_put[1] . $si;
|
||||
$xnode->$nod = '';
|
||||
$si++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'connectionmonitorduration':
|
||||
$xml_node->$dkey = strval(intval(intval($data_values['keepalive']) * 0.75));
|
||||
break;
|
||||
case 'callmanagergroup':
|
||||
$xnode = &$xml_node->$dkey->members;
|
||||
$bind_tmp = $this->get_server_sccp_bind($data_values);
|
||||
$ifc = 0;
|
||||
foreach ($bind_tmp as $bind_value) {
|
||||
$xnode_obj = clone $xnode->member;
|
||||
$xnode_obj['priority'] = $ifc;
|
||||
$xnode_obj->callManager->name = $data_values['servername'];
|
||||
if (!is_null($xnode_obj->callManager->description)) {
|
||||
$xnode_obj->callManager->description = $data_values['servername'];
|
||||
}
|
||||
$xnode_obj->callManager->ports->ethernetPhonePort = $bind_value['port'];
|
||||
$xnode_obj->callManager->processNodeName = $bind_value['ip'];
|
||||
if (!empty($xnode_obj->callManager->ports->mgcpPorts)) {
|
||||
unset($xnode_obj->callManager->ports->mgcpPorts);
|
||||
}
|
||||
|
||||
if ($ifc === 0) {
|
||||
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
|
||||
} else {
|
||||
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
|
||||
}
|
||||
$ifc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
|
||||
break;
|
||||
case 'vendorconfig':
|
||||
$xml_node = $xml_work->$key;
|
||||
foreach ($xml_work->$key->children() as $dkey => $ddata) {
|
||||
$dkey_l = strtolower($dkey);
|
||||
$vtmp_key = $key_l.'_'.$dkey_l;
|
||||
if (isset($data_values[$vtmp_key])) {
|
||||
$vtmp_data = $data_values[$vtmp_key];
|
||||
if ((!empty($vtmp_data)) || ($vtmp_data == "0")) {
|
||||
$xml_node->$dkey = $vtmp_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
|
||||
break;
|
||||
|
||||
case 'versionstamp':
|
||||
$xml_work->$key = time();
|
||||
break;
|
||||
case 'loadinformation':
|
||||
// Set Path Image ????
|
||||
if (isset($dev_config["tftp_firmware"])) {
|
||||
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["tftp_firmware"] . $dev_config["loadimage"] : '';
|
||||
} else {
|
||||
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["loadimage"] : '';
|
||||
}
|
||||
if (!empty($dev_config['addon'])) {
|
||||
$xnode = $xml_work->addChild('addOnModules');
|
||||
$ti = 1;
|
||||
$hw_addon = explode(',', $dev_config['addon']);
|
||||
foreach ($hw_addon as $add_key) {
|
||||
if (!empty($dev_config['addon_info'][$add_key])) {
|
||||
$add_val = $dev_config['addon_info'][$add_key];
|
||||
$xnode_obj = $xnode->addChild('addOnModule');
|
||||
$xnode_obj->addAttribute('idx', $ti);
|
||||
$xnode_obj->addChild('loadInformation', $add_val);
|
||||
$ti++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'commonprofile':
|
||||
$xml_node->phonePassword = $data_values['dev_sshPassword'];
|
||||
$xml_node->backgroundImageAccess = (($data_values['backgroundImageAccess'] == 'on') || ($data_values['backgroundImageAccess'] == 'true') ) ? 'true' : 'false';
|
||||
$xml_node->callLogBlfEnabled = $data_values['callLogBlfEnabled'];
|
||||
break;
|
||||
|
||||
case 'userlocale':
|
||||
case 'networklocaleinfo':
|
||||
case 'networklocale':
|
||||
$hwlang = '';
|
||||
$lang = '';
|
||||
if (!empty($dev_config["_hwlang"])) {
|
||||
$hwlang = explode(':', $dev_config["_hwlang"]);
|
||||
}
|
||||
if (($key_l == 'networklocaleinfo') || ($key_l == 'networklocale')) {
|
||||
$lang = (empty($hwlang[0])) ? $data_values['netlang'] : $hwlang[0];
|
||||
} else {
|
||||
$lang = (empty($hwlang[1])) ? $data_values['devlang'] : $hwlang[1];
|
||||
}
|
||||
if (($lang != 'null') && (!empty($lang))) {
|
||||
if ($key_l == 'networklocale') {
|
||||
$xml_work->$key = $lang;
|
||||
} else {
|
||||
if (isset($lang_info[$lang])) {
|
||||
$xml_node->name = $lang_info[$lang]['locale'];
|
||||
$xml_node->langCode = $lang_info[$lang]['code'];
|
||||
if ($key_l == 'userlocale') {
|
||||
$xml_node->winCharSet = $lang_info[$lang]['codepage'];
|
||||
}
|
||||
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$xml_work->$key = '';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($xml_work);
|
||||
$xml_work->asXml($xml_name); // Save
|
||||
} else {
|
||||
$xml_name = "{$store_path}/{$dev_id}.cnf.xml";
|
||||
if (!file_exists($xml_template)) {
|
||||
die('Error Hardware template :' . $xml_template . ' not found');
|
||||
}
|
||||
$xml_work = simplexml_load_file($xml_template);
|
||||
|
||||
foreach ($var_xml_general_vars as $key => $data) {
|
||||
if (isset($xml_work->$key)) {
|
||||
if ($data != 'null') {
|
||||
$xml_work->$key = $data;
|
||||
} else {
|
||||
$node = $xml_work->$key;
|
||||
unset($node[0][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($xml_work as $key => $data) {
|
||||
// Set System global Values
|
||||
$key_l = strtolower($key);
|
||||
if (!empty($var_xml_general_fields[$key_l])) {
|
||||
$xml_work->$key = $data_values[$var_xml_general_fields[$key_l]];
|
||||
}
|
||||
// Set section Values
|
||||
$xml_node = $xml_work->$key;
|
||||
switch ($key_l) {
|
||||
case 'devicepool':
|
||||
$xml_node = $xml_work->$key;
|
||||
foreach ($xml_work->$key->children() as $dkey => $ddata) {
|
||||
switch (strtolower($dkey)) {
|
||||
case 'datetimesetting':
|
||||
$xnode = &$xml_node->$dkey;
|
||||
$tz_id = $data_values['ntp_timezone'];
|
||||
$TZdata = $data_values['ntp_timezone_id'];
|
||||
if (empty($TZdata)) {
|
||||
$TZdata = array('offset' => '0', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
|
||||
}
|
||||
$xnode->name = $tz_id;
|
||||
$xnode->dateTemplate = $data_values['dateformat'];
|
||||
$xnode->timeZone = $TZdata['cisco_code'];
|
||||
// $xnode->timeZone = $tz_id.' Standard'.((empty($TZdata['daylight']))? '': '/'.$TZdata['daylight']).' Time';
|
||||
|
||||
if ($data_values['ntp_config_enabled'] == 'on') {
|
||||
$xnode->ntps->ntp->name = $data_values['ntp_server'];
|
||||
$xnode->ntps->ntp->ntpMode = $data_values['ntp_server_mode'];
|
||||
} else {
|
||||
$xnode->ntps = null;
|
||||
}
|
||||
// Ntp Config
|
||||
break;
|
||||
case 'srstinfo':
|
||||
if ($data_values['srst_Option'] == 'user') {
|
||||
break;
|
||||
}
|
||||
$xnode = &$xml_node->$dkey;
|
||||
$xnode->name = $data_values['srst_Name'];
|
||||
$xnode->srstOption = $data_values['srst_Option'];
|
||||
$xnode->userModifiable = $data_values['srst_userModifiable'];
|
||||
$xnode->isSecure = $data_values['srst_isSecure'];
|
||||
|
||||
$srst_fld = array('srst_ip' => array('ipAddr', 'port'));
|
||||
foreach ($srst_fld as $srst_pro => $srs_put) {
|
||||
if (empty($data_values[$srst_pro]) || ($data_values['srst_Option'] == 'disable') ) {
|
||||
$srst_data =array();
|
||||
} else {
|
||||
$srst_data = explode(';', $data_values[$srst_pro]);
|
||||
}
|
||||
$si = 1;
|
||||
foreach ($srst_data as $value) {
|
||||
$srs_val = explode('/', $value);
|
||||
$nod = $srs_put[0] . $si;
|
||||
$xnode->$nod = $srs_val[0];
|
||||
$nod = $srs_put[1] . $si;
|
||||
$xnode->$nod = ((empty($srs_val[1])) ? "2000": $srs_val[1]);
|
||||
$si++;
|
||||
}
|
||||
while ($si < 4) {
|
||||
$nod = $srs_put[0] . $si;
|
||||
$xnode->$nod = '';
|
||||
$nod = $srs_put[1] . $si;
|
||||
$xnode->$nod = '';
|
||||
$si++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'connectionmonitorduration':
|
||||
$xml_node->$dkey = strval(intval(intval($data_values['keepalive']) * 0.75));
|
||||
break;
|
||||
case 'callmanagergroup':
|
||||
$xnode = &$xml_node->$dkey->members;
|
||||
$bind_tmp = $this->get_server_sccp_bind($data_values);
|
||||
$ifc = 0;
|
||||
foreach ($bind_tmp as $bind_value) {
|
||||
$xnode_obj = clone $xnode->member;
|
||||
$xnode_obj['priority'] = $ifc;
|
||||
$xnode_obj->callManager->name = $data_values['servername'];
|
||||
if (!is_null($xnode_obj->callManager->description)) {
|
||||
$xnode_obj->callManager->description = $data_values['servername'];
|
||||
}
|
||||
$xnode_obj->callManager->ports->ethernetPhonePort = $bind_value['port'];
|
||||
$xnode_obj->callManager->processNodeName = $bind_value['ip'];
|
||||
if (!empty($xnode_obj->callManager->ports->mgcpPorts)) {
|
||||
unset($xnode_obj->callManager->ports->mgcpPorts);
|
||||
}
|
||||
|
||||
if ($ifc === 0) {
|
||||
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
|
||||
} else {
|
||||
$this->appendSimpleXmlNode($xnode->member, $xnode_obj);
|
||||
}
|
||||
$ifc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
|
||||
break;
|
||||
case 'vendorconfig':
|
||||
$xml_node = $xml_work->$key;
|
||||
foreach ($xml_work->$key->children() as $dkey => $ddata) {
|
||||
$dkey_l = strtolower($dkey);
|
||||
$vtmp_key = $key_l.'_'.$dkey_l;
|
||||
if (isset($data_values[$vtmp_key])) {
|
||||
$vtmp_data = $data_values[$vtmp_key];
|
||||
if ((!empty($vtmp_data)) || ($vtmp_data == "0")) {
|
||||
$xml_node->$dkey = $vtmp_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
|
||||
break;
|
||||
|
||||
case 'versionstamp':
|
||||
$xml_work->$key = time();
|
||||
break;
|
||||
case 'loadinformation':
|
||||
// Set Path Image ????
|
||||
if (isset($dev_config["tftp_firmware"])) {
|
||||
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["tftp_firmware"] . $dev_config["loadimage"] : '';
|
||||
} else {
|
||||
$xml_work->$key = (isset($dev_config["loadimage"])) ? $dev_config["loadimage"] : '';
|
||||
}
|
||||
if (!empty($dev_config['addon'])) {
|
||||
$xnode = $xml_work->addChild('addOnModules');
|
||||
$ti = 1;
|
||||
$hw_addon = explode(',', $dev_config['addon']);
|
||||
foreach ($hw_addon as $add_key) {
|
||||
if (!empty($dev_config['addon_info'][$add_key])) {
|
||||
$add_val = $dev_config['addon_info'][$add_key];
|
||||
$xnode_obj = $xnode->addChild('addOnModule');
|
||||
$xnode_obj->addAttribute('idx', $ti);
|
||||
$xnode_obj->addChild('loadInformation', $add_val);
|
||||
$ti++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'commonprofile':
|
||||
$xml_node->phonePassword = $data_values['dev_sshPassword'];
|
||||
$xml_node->backgroundImageAccess = (($data_values['backgroundImageAccess'] == 'on') || ($data_values['backgroundImageAccess'] == 'true') ) ? 'true' : 'false';
|
||||
$xml_node->callLogBlfEnabled = $data_values['callLogBlfEnabled'];
|
||||
break;
|
||||
|
||||
case 'userlocale':
|
||||
case 'networklocaleinfo':
|
||||
case 'networklocale':
|
||||
$hwlang = '';
|
||||
$lang = '';
|
||||
if (!empty($dev_config["_hwlang"])) {
|
||||
$hwlang = explode(':', $dev_config["_hwlang"]);
|
||||
}
|
||||
if (($key_l == 'networklocaleinfo') || ($key_l == 'networklocale')) {
|
||||
$lang = (empty($hwlang[0])) ? $data_values['netlang'] : $hwlang[0];
|
||||
} else {
|
||||
$lang = (empty($hwlang[1])) ? $data_values['devlang'] : $hwlang[1];
|
||||
}
|
||||
if (($lang != 'null') && (!empty($lang))) {
|
||||
if ($key_l == 'networklocale') {
|
||||
$xml_work->$key = $lang;
|
||||
} else {
|
||||
if (isset($lang_info[$lang])) {
|
||||
$xml_node->name = $lang_info[$lang]['locale'];
|
||||
$xml_node->langCode = $lang_info[$lang]['code'];
|
||||
if ($key_l == 'userlocale') {
|
||||
$xml_node->winCharSet = $lang_info[$lang]['codepage'];
|
||||
}
|
||||
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$xml_work->$key = '';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$xml_work->asXml($xml_name); // Save
|
||||
|
||||
return time();
|
||||
}
|
||||
|
||||
|
|
|
@ -512,14 +512,12 @@ trait ajaxHelper {
|
|||
$TZdata = $this->extconfigs->getExtConfig('sccp_timezone', $tz_id);
|
||||
if (!empty($TZdata)) {
|
||||
$value = $TZdata['offset']/60;
|
||||
if (!($this->sccpvalues['tzoffset']['data'] == $value)) {
|
||||
$save_settings[] = array(
|
||||
'keyword' => 'tzoffset',
|
||||
'data' => $value,
|
||||
'seq' => '98',
|
||||
'type' => '2'
|
||||
);
|
||||
}
|
||||
$save_settings[] = array(
|
||||
'keyword' => 'tzoffset',
|
||||
'data' => $value,
|
||||
'seq' => '98',
|
||||
'type' => '2'
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue