- Add BackUp.

- Add Transfer in Global Config.
This commit is contained in:
PhantomVl 2019-01-10 18:50:59 +03:00
parent 239c36cbb0
commit 28a051e01a
9 changed files with 125 additions and 12 deletions

View file

@ -91,7 +91,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
// private $SCCP_LANG_DICTIONARY = 'SCCP-dictionary.xml'; // CISCO LANG file search in /tftp-path // private $SCCP_LANG_DICTIONARY = 'SCCP-dictionary.xml'; // CISCO LANG file search in /tftp-path
private $SCCP_LANG_DICTIONARY = 'be-sccp.jar'; // CISCO LANG file search in /tftp-path private $SCCP_LANG_DICTIONARY = 'be-sccp.jar'; // CISCO LANG file search in /tftp-path
private $pagedata = null; private $pagedata = null;
private $sccp_driver_ver = '11.3'; private $sccp_driver_ver = '11.3'; // Ver fore SCCP.CLASS.PHP
public $sccp_manager_ver = '13.0.0.4'; public $sccp_manager_ver = '13.0.0.4';
private $tftpLang = array(); private $tftpLang = array();
// private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!! // private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
@ -583,6 +583,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
public function ajaxRequest($req, &$setting) { public function ajaxRequest($req, &$setting) {
switch ($req) { switch ($req) {
case 'backupsettings':
case 'savesettings': case 'savesettings':
case 'save_hardware': case 'save_hardware':
case 'save_dialplan_template': case 'save_dialplan_template':
@ -896,6 +897,35 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
return $result; return $result;
break; break;
// ------------------------------- Old deviece suport - In the development--- // ------------------------------- Old deviece suport - In the development---
case 'backupsettings':
global $amp_conf;
$backup_files = array( $amp_conf['ASTETCDIR'].'/sccp.conf', $amp_conf['ASTETCDIR'].'/extensions_additional.conf', $amp_conf['ASTETCDIR'].'/extconfig.conf');
$result = $this->dbinterface->dump_sccp_tables($this->sccppath["tftp_path"],$amp_conf['AMPDBNAME'], $amp_conf['AMPDBUSER'], $amp_conf['AMPDBPASS']);
$backup_files[] = $result;
$zip = new \ZipArchive();
$filename = $result.".zip";
if ($zip->open($filename, \ZIPARCHIVE::CREATE)) {
foreach ($backup_files as $file) {
$zip->addFile($file);
}
$zip->close();
}
$file_name = basename($filename);
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=$file_name");
header("Content-Length: " . filesize($filename));
readfile($filename);
unlink($result);
unlink($filename);
// return array('status' => false, 'message' => $result);
// return $result;
break;
} }
} }

View file

@ -210,5 +210,14 @@ class dbinterface {
} }
return $result; return $result;
} }
/*
* Replace by SccpTables !!!!
*
*/
public function dump_sccp_tables($data_path, $database, $user, $pass ) {
$filename = $data_path.'/sccp_backup_'.date('G_a_m_d_y').'.sql';
$result = exec('mysqldump '.$database.' --password='.$pass.' --user='.$user.' --single-transaction >'.$filename ,$output);
return $filename;
}
} }

View file

@ -587,7 +587,7 @@ class srvinterface {
} }
} }
} else { } else {
return $result; return $result;
return array(); return array();
} }
} }

View file

@ -24,6 +24,37 @@ $(document).ready(function () {
} }
}); });
/*
$('#ajaxbackup').on('click', function (e) {
var vdata = '';
var snd_command = 'backupsettings';
$('.fpbx-submit').each(function () {
vdata = vdata + $(this).serialize() + '&';
});
$.ajax({
type: 'POST',
url: 'ajax.php?module=sccp_manager&command=' + snd_command,
data: vdata,
success: function (data) {
if (data.status === true) {
if (data.message) {
alert(data.message);
} else {
alert('Data Save');
}
} else {
if (Array.isArray(data.message)) {
data.message.forEach(function (entry) {
fpbxToast(entry, 'error', 'error');
});
}
}
}
});
});
*/
$('#ajaxsubmit2').on('click', function (e) { $('#ajaxsubmit2').on('click', function (e) {
var vdata = ''; var vdata = '';
var snd_command = 'savesettings'; var snd_command = 'savesettings';

View file

@ -419,6 +419,14 @@ and open the template in the editor. Base Version before all crash :-)
<button value="off">Off</button> <button value="off">Off</button>
<help>Do Not Disturb. Default is Off</help> <help>Do Not Disturb. Default is Off</help>
</item> </item>
<item type="IS" id="1" seq="0">
<name>transfer</name>
<label>Transfer</label>
<default>on</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Allow the use of the transfer feature</help>
</item>
</page_group> </page_group>
<page_group name="sccp_dev_ntp"> <page_group name="sccp_dev_ntp">
@ -1127,7 +1135,8 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IS" id="1" seq="99"> <item type="IS" id="1" seq="99">
<name>transfer</name> <name>transfer</name>
<label>Transfer</label> <label>Transfer</label>
<default>off</default> <default>NONE</default>
<button value="NONE">Inherit</button>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Transfer allowed</help> <help>Transfer allowed</help>

View file

@ -620,6 +620,15 @@ and open the template in the editor. Base Version before all crash :-)
<button value="off">Off</button> <button value="off">Off</button>
<help>Do Not Disturb. Default is Off</help> <help>Do Not Disturb. Default is Off</help>
</item> </item>
<item type="IS" id="1" seq="0">
<name>transfer</name>
<label>Transfer</label>
<default>on</default>
<button value="on">On</button>
<button value="off">Off</button>
<help>Allow the use of the transfer feature</help>
</item>
</page_group> </page_group>
<page_group name="sccp_dev_ntp_h"> <page_group name="sccp_dev_ntp_h">
@ -1155,7 +1164,8 @@ and open the template in the editor. Base Version before all crash :-)
<item type="IS" id="1" seq="99"> <item type="IS" id="1" seq="99">
<name>transfer</name> <name>transfer</name>
<label>Transfer</label> <label>Transfer</label>
<default>off</default> <default>NONE</default>
<button value="NONE">Inherit</button>
<button value="on">On</button> <button value="on">On</button>
<button value="off">Off</button> <button value="off">Off</button>
<help>Transfer allowed</help> <help>Transfer allowed</help>

View file

@ -1,5 +1,11 @@
<?php <?php
/*
* Hand DB Change :
ALTER TABLE `sccpline` CHANGE COLUMN `transfer` `transfer` ENUM('on','off') NULL DEFAULT NULL ;
ALTER TABLE `sccpdevice` CHANGE COLUMN `transfer` `transfer` ENUM('on','off') NULL DEFAULT NULL;
*
*
*/
if (!defined('FREEPBX_IS_AUTH')) { if (!defined('FREEPBX_IS_AUTH')) {
die_freepbx('No direct script access allowed'); die_freepbx('No direct script access allowed');
@ -235,7 +241,7 @@ function Get_DB_config($sccp_compatible) {
'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"), 'permit' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL', 'modify' => "VARCHAR(100)"),
'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"), 'backgroundImage' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"), 'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
'transfer' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"), 'transfer' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"),
'cfwdall' => array('create' => "enum('on','off') NULL default 'on'", 'modify' => "enum('on','off')"), 'cfwdall' => array('create' => "enum('on','off') NULL default 'on'", 'modify' => "enum('on','off')"),
'cfwdbusy' => array('create' => "enum('on','off') NULL default 'on'", 'modify' => "enum('on','off')"), 'cfwdbusy' => array('create' => "enum('on','off') NULL default 'on'", 'modify' => "enum('on','off')"),
'directrtp' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"), 'directrtp' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"),
@ -276,7 +282,7 @@ function Get_DB_config($sccp_compatible) {
'video_tos' => array('drop' => "yes"), 'video_tos' => array('drop' => "yes"),
'video_cos' => array('drop' => "yes"), 'video_cos' => array('drop' => "yes"),
'incominglimit' => array('create' => "INT(11) DEFAULT '6'", 'modify' => 'INT(11)', 'def_modify' => "6"), 'incominglimit' => array('create' => "INT(11) DEFAULT '6'", 'modify' => 'INT(11)', 'def_modify' => "6"),
'transfer' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"), 'transfer' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"),
'vmnum' => array('def_modify' => "*97"), 'vmnum' => array('def_modify' => "*97"),
'musicclass' => array('def_modify' => "default"), 'musicclass' => array('def_modify' => "default"),
'id' => array('create' => 'MEDIUMINT(9) NOT NULL AUTO_INCREMENT, ADD UNIQUE(id);', 'modify' => "MEDIUMINT(9)", 'index' => 'id'), 'id' => array('create' => 'MEDIUMINT(9) NOT NULL AUTO_INCREMENT, ADD UNIQUE(id);', 'modify' => "MEDIUMINT(9)", 'index' => 'id'),

View file

@ -16,8 +16,23 @@ $feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'dev
$lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); $lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
//$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); //$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension');
$hint_list = $this->get_hint_info(); $data_sort = Array();
$hint_list1 = $this->get_hint_info();
foreach ($hint_list1 as $key => $value) {
$data_sort[$value['name']] = $key;
}
ksort($data_sort);
//print_r(count($data_sort));
//print_r(count($hint_list1));
foreach ($data_sort as $key => $value) {
$hint_list[$value] = $hint_list1[$value];
}
//print_r($hint_list);
//ksort($hint_list);
//natsort($hint_list);
$line_id =0; $line_id =0;
$max_buttons =56; $max_buttons =56;
$show_buttons =1; $show_buttons =1;
@ -125,8 +140,7 @@ if (!empty($_REQUEST['new_id'])) {
} }
} else { } else {
$defaul_btn = $data_i; $defaul_btn = $data_i;
} }
} }
} }

View file

@ -71,18 +71,20 @@ if (empty($conf_realtime)) {
} }
} }
/* /*
global $amp_conf;
print_r("<br> Request:<br><pre>"); print_r("<br> Request:<br><pre>");
$json = ''; $json = '';
print_r("<br>"); print_r("<br>");
print_r("<br>"); print_r("<br>");
print_r("<br>"); print_r("<br>");
print_r($this->srvinterface->sccp_realtime_status()); print_r($amp_conf);
print_r("DIRECT START"); print_r("DIRECT START");
print_r("<br>"); print_r("<br>");
// print_r($this->srvinterface->t_get_meta_data()); // print_r($this->srvinterface->t_get_meta_data());
print_r($this->extconfigs->validate_RealTime()); //print_r($this->extconfigs->validate_RealTime());
print("</pre>"); print("</pre>");
*/ */
// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK'); // $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK');
// print_r('<br>'); // print_r('<br>');
// print_r(timezone_identifiers_list()); // print_r(timezone_identifiers_list());
@ -130,7 +132,9 @@ if (!empty($this->class_error)) {
</tbody> </tbody>
</table> </table>
</div> </div>
<a class="btn btn-default" href="ajax.php?module=sccp_manager&command=backupsettings"><i class="fa fa-plane">&nbsp;</i><?php echo _("BackUp Config") ?></a>
</div> </div>
</div> </div>
</div> </div>
<?php echo $this->ShowGroup('sccp_info',0); ?> <?php echo $this->ShowGroup('sccp_info',0); ?>