In the install script, added the mysql parameter search.
Added the ability to read the configuration of the "tftp-rewrite" from external config file
This commit is contained in:
parent
d6f4599849
commit
5d725b4e13
|
@ -32,6 +32,8 @@ This module will suit you if you are planing the to migrate from CallManager to
|
|||
You can control phone buttons (depending on the phone model) assigning multiple lines, speeddials and BLF’s.
|
||||
And you can use the driver functions "sccp_chain" from the GUI module.
|
||||
|
||||
### Wiki
|
||||
You can find more information and documentation on our [](https://github.com/PhantomVl/sccp_manager/wiki)
|
||||
|
||||
### Prerequisites
|
||||
Make sure you have the following installed on your system:
|
||||
|
@ -77,6 +79,12 @@ Make sure you have the following installed on your system:
|
|||
8. Close Status window.
|
||||
9. Apply Config to FreePBX.
|
||||
|
||||
### Module update to latest state
|
||||
1. Goto to module into your local system. (/var/www/html/admin/module/sccp_manager/)
|
||||
cd /var/www/html/admin/module/sccp_manager/
|
||||
git fetch
|
||||
git pull
|
||||
|
||||
### IMPORTANT NOTES:
|
||||
- This system assumes/requires that you are using the Asterisk realtime database. If you are not yet using the realtime database,
|
||||
you will have to set it up for this module to work ([See](https://github.com/chan-sccp/chan-sccp/wiki/Realtime-Configuration)).
|
||||
|
|
|
@ -1534,6 +1534,52 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
|
||||
$driver = $this->FreePBX->Core->getAllDriversInfo();
|
||||
$sccp_driver_replace= '';
|
||||
if (empty($driver['sccp'])) {
|
||||
$sccp_driver_replace = 'yes';
|
||||
} else {
|
||||
if (empty($driver['sccp']['Version'])) {
|
||||
$sccp_driver_replace = 'yes';
|
||||
} else {
|
||||
if ($driver['sccp']['Version'] != $this->sccp_driver_ver) {
|
||||
$sccp_driver_replace = 'yes';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->sccpvalues['sccp_compatible'] = array('keyword' => 'compatible', 'data' => $this->srvinterface->get_compatible_sccp(), 'type' => '1', 'seq' => '99');
|
||||
// $this->sccpvalues['sccp_compatible'] = '11';
|
||||
|
||||
$this->sccppath = $this->extconfigs->validate_init_path($confDir, $this->sccpvalues, $sccp_driver_replace);
|
||||
|
||||
$driver = $this->FreePBX->Core->getAllDriversInfo(); // ??????
|
||||
|
||||
$read_config = $this->cnf_read->getConfig('sccp.conf');
|
||||
$this->sccp_conf_init['general'] = $read_config['general'];
|
||||
foreach ($read_config as $key => $value) {
|
||||
if (isset($read_config[$key]['type'])) { // copy soft key
|
||||
if ($read_config[$key]['type'] == 'softkeyset') {
|
||||
$this->sccp_conf_init[$key] = $read_config[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* OLD INI
|
||||
function init_sccp_path1() {
|
||||
global $db;
|
||||
global $amp_conf;
|
||||
|
||||
$confDir = $amp_conf["ASTETCDIR"];
|
||||
if (empty($this->sccppath["asterisk"])) {
|
||||
if (strlen($confDir) < 1) {
|
||||
$this->sccppath["asterisk"] = "/etc/asterisk";
|
||||
} else {
|
||||
$this->sccppath["asterisk"] = $confDir;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($this->sccppath["sccp_conf"])) {
|
||||
$this->sccppath["sccp_conf"] = $this->sccppath["asterisk"] . "/sccp.conf";
|
||||
}
|
||||
|
@ -1599,7 +1645,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
|
||||
/* if (!empty($this->sccppath["tftp_path"])) {
|
||||
if (!empty($this->sccppath["tftp_path"])) {
|
||||
$this->sccppath["tftp_DP"] = $this->sccppath["tftp_path"] . '/Dialplan';
|
||||
if (!file_exists($this->sccppath["tftp_DP"])) {
|
||||
if (!mkdir($this->sccppath["tftp_DP"], 0777, true)) {
|
||||
|
@ -1607,7 +1653,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (empty($_SERVER['DOCUMENT_ROOT'])) {
|
||||
return;
|
||||
}
|
||||
|
@ -1669,7 +1716,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
// $this->sccp_conf_init = @parse_ini_file($this->sccppath["sccp_conf"], true);
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
* DialPlan
|
||||
*
|
||||
|
|
|
@ -211,4 +211,123 @@ class extconfigs {
|
|||
'New Zealand' => array('offset' => '720', 'daylight' => 'Daylight')
|
||||
);
|
||||
|
||||
|
||||
public function validate_init_path($confDir = '', $db_vars, $sccp_driver_replace='') {
|
||||
// global $db;
|
||||
// global $amp_conf;
|
||||
// *** Setings for Provision Sccp
|
||||
$adv_config = Array('tftproot' => '', 'firmware' => 'firmware', 'settings' => 'settings',
|
||||
'locales' => 'locales', 'languages' => 'languages', 'templates' => 'templates');
|
||||
$adv_tree['pro'] = Array('templates' => 'tftproot', 'settings' => 'tftproot', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'locales');
|
||||
$adv_tree['def'] = Array('templates' => 'tftproot', 'settings' => 'tftproot', 'locales' => 'tftproot', 'firmware' => 'tftproot', 'languages' => 'tftproot');
|
||||
//* **************------ ****
|
||||
$base_tree = Array('tftp_templates' => 'templates', 'tftp_path_store' => 'settings', 'tftp_lang_path' => 'languages', 'tftp_firmware_path'=>'firmware');
|
||||
|
||||
|
||||
if (empty($confDir)) {
|
||||
return array('error' => 'empty СonfDir' );
|
||||
}
|
||||
|
||||
$base_config = Array( 'asterisk' => $confDir, 'sccp_conf' => $confDir . '/sccp.conf', 'tftp_path' => '');
|
||||
|
||||
|
||||
if (!empty($db_vars["tftp_path"])) {
|
||||
if (file_exists($db_vars["tftp_path"]["data"])) {
|
||||
$base_config["tftp_path"] = $db_vars["tftp_path"]["data"];
|
||||
}
|
||||
}
|
||||
if (empty($base_config["tftp_path"])) {
|
||||
if (file_exists($this->getextConfig('sccpDefaults', "tftp_path"))) {
|
||||
$base_config["tftp_path"] = $this->getextConfig('sccpDefaults', "tftp_path");
|
||||
}
|
||||
}
|
||||
if (empty($base_config["tftp_path"])) {
|
||||
return array('error' => 'empty tftp_path' );
|
||||
}
|
||||
if (!empty($db_vars['tftp_rewrite_path'])) {
|
||||
$adv_ini = $db_vars['tftp_rewrite_path']["data"];
|
||||
}
|
||||
|
||||
$adv_tree_mode = 'def';
|
||||
if (empty($db_vars["tftp_rewrite"])) {
|
||||
$db_vars["tftp_rewrite"]["data"] = "off";
|
||||
}
|
||||
|
||||
$adv_config['tftproot'] = $base_config["tftp_path"];
|
||||
if ($db_vars["tftp_rewrite"]["data"] == 'pro') {
|
||||
$adv_tree_mode = 'pro';
|
||||
if (!empty($adv_ini)) { // something found in external conflicts
|
||||
$adv_ini .= 'index.cnf';
|
||||
if (file_exists($adv_ini)) {
|
||||
$adv_ini_array = parse_ini_file($adv_ini);
|
||||
$adv_config = array_merge($adv_config, $adv_ini_array);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($db_vars["tftp_rewrite"]["data"] == 'on') {
|
||||
$adv_tree_mode = 'pro';
|
||||
}
|
||||
foreach ($adv_tree[$adv_tree_mode] as $key => $value) {
|
||||
if (!empty($adv_config[$key])) {
|
||||
if (substr($adv_config[$key],0,1) != "/") {
|
||||
$adv_config[$key] = $adv_config[$value].'/'.$adv_config[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($base_tree as $key => $value) {
|
||||
$base_config[$key] = $adv_config[$value];
|
||||
if (!file_exists($base_config[$key])) {
|
||||
if (!mkdir($base_config[$key], 0777, true)) {
|
||||
die('Error creating dir : '. $base_config[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// $base_config['External_ini'] = $adv_config;
|
||||
// $base_config['External_mode'] = $adv_tree_mode;
|
||||
|
||||
/*
|
||||
if (!empty($this->sccppath["tftp_path"])) {
|
||||
$this->sccppath["tftp_DP"] = $this->sccppath["tftp_path"] . '/Dialplan';
|
||||
if (!file_exists($this->sccppath["tftp_DP"])) {
|
||||
if (!mkdir($this->sccppath["tftp_DP"], 0777, true)) {
|
||||
die('Error creating DialPlan template dir');
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// TFTP -REWrite double model
|
||||
if (empty($_SERVER['DOCUMENT_ROOT'])) {
|
||||
$base_config['error'] = 'Empty DOCUMENT_ROOT';
|
||||
return $base_config;
|
||||
}
|
||||
|
||||
if (!file_exists($base_config["tftp_templates"] . '/XMLDefault.cnf.xml_template')) {
|
||||
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/';
|
||||
$dst_path = $base_config["tftp_templates"] . '/';
|
||||
foreach (glob($src_path . '*.*_template') as $filename) {
|
||||
copy($filename, $dst_path . basename($filename));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/core/functions.inc/drivers/Sccp.class.php';
|
||||
if (!file_exists($dst) || $sccp_driver_replace == 'yes') {
|
||||
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst) . '.v' . $this->sccpvalues['sccp_compatible']['data'];
|
||||
if (file_exists($src_path)) {
|
||||
copy($src_path, $dst);
|
||||
} else {
|
||||
$src_path = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/' . basename($dst);
|
||||
copy($src_path, $dst);
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists($base_config["sccp_conf"])) { // System re Config
|
||||
$sccpfile = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/conf/sccp.conf');
|
||||
file_put_contents($base_config["sccp_conf"], $sccpfile);
|
||||
}
|
||||
|
||||
return $base_config;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -323,6 +323,19 @@ $(document).ready(function () {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
dev_id = $(this).data('vshow');
|
||||
if (dev_state == 'checked'){
|
||||
dev_class = $(this).data('clshow');
|
||||
$(dev_class).each(function () {
|
||||
if (dev_val == dev_id) {
|
||||
$(this).removeClass('hidden');
|
||||
$(this).removeAttr('hidden')
|
||||
} else {
|
||||
$(this).addClass('hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
$('.sccp_button_hide').on('click', function (e) {
|
||||
var dev_id = $(this).data('vhide');
|
||||
|
@ -339,6 +352,20 @@ $(document).ready(function () {
|
|||
$(this).addClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
dev_id = $(this).data('vshow');
|
||||
if (dev_id !== ''){
|
||||
dev_class = $(this).data('clshow');
|
||||
$(dev_class).each(function () {
|
||||
if (dev_val == dev_id) {
|
||||
$(this).removeClass('hidden');
|
||||
$(this).removeAttr('hidden')
|
||||
} else {
|
||||
$(this).addClass('hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('.sccp_button_disabled').each(function () { // On page create !!
|
||||
|
|
|
@ -3,6 +3,23 @@
|
|||
To change this license header, choose License Headers in Project Properties.
|
||||
To change this template file, choose Tools | Templates
|
||||
and open the template in the editor. Base Version before all crash :-)
|
||||
* IE - Text Input
|
||||
* IED - Text Input Dynamic
|
||||
* ITED- Input Dynamic Table
|
||||
* IS - Radio box
|
||||
* SL - Select element
|
||||
* SLA - Select element (from - data )
|
||||
* Input element Select SLD - Date format
|
||||
* SLZ - Time Zone
|
||||
* SLZN - Time Zone List
|
||||
* SLT - TFTP Lang
|
||||
* SLM - Music on hold
|
||||
* SLK - System KeySet
|
||||
* * Input element Select SLS - System Language
|
||||
* Input element Select SDM - Model List
|
||||
* SDE - Extension List
|
||||
* Help elemen HLP - Help Element
|
||||
|
||||
-->
|
||||
<root>
|
||||
<page_group name="sccp_info">
|
||||
|
@ -817,6 +834,7 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
<label>SCCP Server Path config</label>
|
||||
<item type="IE" id="1" seq="2">
|
||||
<label>SCCP TFTP SERVER Path</label>
|
||||
<class>provision_hide</class>
|
||||
<input>
|
||||
<name>tftp_path</name>
|
||||
<default>/tftpboot</default>
|
||||
|
@ -824,12 +842,26 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
</input>
|
||||
<help>Path to tftp home directory</help>
|
||||
</item>
|
||||
<item type="IE" id="1" seq="20">
|
||||
<label>Provision SERVER Path</label>
|
||||
<class>provision_show</class>
|
||||
<input>
|
||||
<name>tftp_rewrite_path</name>
|
||||
<default>/tftpboot</default>
|
||||
<class>sccp-custom</class>
|
||||
</input>
|
||||
<help>Use path from provision index.cnf file. You must first make sure that you have properly configured the "Provision"</help>
|
||||
</item>
|
||||
|
||||
<item type="IS" id="2" seq="20">
|
||||
<name>tftp_rewrite</name>
|
||||
<label>TFTP SERVER remapping support</label>
|
||||
<default>off</default>
|
||||
<button value="on">Enabled</button>
|
||||
<option_hide class=".provision_hide">pro</option_hide>
|
||||
<option_show class=".provision_show">pro</option_show>
|
||||
<button value="off">Disabled</button>
|
||||
<button value="on">Custom</button>
|
||||
<button value="pro">Provision</button>
|
||||
<help>Support the use of regular-expression-based filename remapping</help>
|
||||
</item>
|
||||
|
||||
|
|
|
@ -547,13 +547,18 @@ function Setup_RealTime() {
|
|||
$def_bd_sec = 'sccp';
|
||||
|
||||
$dir = $cnf_int->get('ASTETCDIR');
|
||||
|
||||
$res_conf_sql = ini_get('pdo_mysql.default_socket');
|
||||
$res_conf_old = '';
|
||||
$res_conf = '';
|
||||
$ext_conf = '';
|
||||
if (file_exists($dir . '/extconfig.conf')) {
|
||||
$ext_conf = $cnf_read->getConfig('extconfig.conf');
|
||||
}
|
||||
if (!empty($res_conf_sql)) {
|
||||
if (!file_exists($res_conf_sql)) {
|
||||
$def_bd_config['dbsock'] = $res_conf_sql;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($ext_conf)) {
|
||||
$tmp = array();
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
<type>setup</type>
|
||||
<category>SCCP Connectivity</category>
|
||||
<publisher>Alex GP</publisher>
|
||||
<repo>extended</repo>
|
||||
<description>SCCP Phone and Extension Manager</description>
|
||||
<menuitems>
|
||||
<sccpsettings sort="1">Server Config</sccpsettings>
|
||||
|
@ -19,5 +20,7 @@
|
|||
<supported>
|
||||
<version>13.0.0.1</version>
|
||||
</supported>
|
||||
<info>https://github.com/PhantomVl/sccp_manager</info>
|
||||
<license>GPL</license>
|
||||
<md5sum></md5sum>
|
||||
</module>
|
||||
|
|
|
@ -83,6 +83,12 @@ foreach ($items as $child) {
|
|||
$res_input = '';
|
||||
$res_name = '';
|
||||
$res_id = $npref.$child->input[0]->name;
|
||||
// --- Add Hiden option
|
||||
$res_sec_class ='';
|
||||
if (!empty($child ->class)){
|
||||
$res_sec_class = (string)$child ->class;
|
||||
}
|
||||
|
||||
if (empty($child->nameseparator)) {
|
||||
$child->nameseparator = ' / ';
|
||||
}
|
||||
|
@ -92,7 +98,7 @@ foreach ($items as $child) {
|
|||
|
||||
?>
|
||||
<div class="element-container">
|
||||
<div class="row"> <div class="form-group">
|
||||
<div class="row"> <div class="form-group <?php echo $res_sec_class; ?>">
|
||||
<div class="col-md-3">
|
||||
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
|
||||
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
|
||||
|
@ -207,6 +213,13 @@ foreach ($items as $child) {
|
|||
$opt_class .= " sccp_button_hide";
|
||||
$opt_hide = ' data-vhide="'.$value->option_hide.'" data-btn="checkbox" data-clhide="'.$value->option_hide['class'].'" ';
|
||||
}
|
||||
if (!empty($child->option_show)) {
|
||||
if (empty($opt_hide)) {
|
||||
$opt_hide =' class="sccp_button_hide" ';
|
||||
}
|
||||
$opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" ';
|
||||
}
|
||||
|
||||
if (!empty($value->option_disabled)) {
|
||||
$opt_class .= " sccp_button_disabled";
|
||||
$opt_hide = ' data-vhide="'.$value->option_disabled.'" data-btn="checkbox" data-clhide="'.$value->option_disabled['class'].'" ';
|
||||
|
@ -287,11 +300,16 @@ foreach ($items as $child) {
|
|||
if ($child['type'] == 'IS') {
|
||||
$res_n = (string)$child->name;
|
||||
$res_id = $npref.$child->name;
|
||||
// --- Add Hiden option
|
||||
$res_sec_class ='';
|
||||
if (!empty($child ->class)){
|
||||
$res_sec_class = (string)$child ->class;
|
||||
}
|
||||
|
||||
echo '<!-- Begin '.$child->label.' -->';
|
||||
?>
|
||||
<div class="element-container">
|
||||
<div class="row"><div class="form-group">
|
||||
<div class="row"><div class="form-group <?php echo $res_sec_class;?>">
|
||||
<div class="col-md-3 radioset">
|
||||
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
|
||||
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
|
||||
|
@ -317,6 +335,12 @@ foreach ($items as $child) {
|
|||
if (!empty($child->option_hide)) {
|
||||
$opt_hide = ' class="sccp_button_hide" data-vhide="'.$child->option_hide.'" data-clhide="'.$child->option_hide['class'].'" ';
|
||||
}
|
||||
if (!empty($child->option_show)) {
|
||||
if (empty($opt_hide)) {
|
||||
$opt_hide =' class="sccp_button_hide" ';
|
||||
}
|
||||
$opt_hide .= ' data-vshow="'.$child->option_show.'" data-clshow="'.$child->option_show['class'].'" ';
|
||||
}
|
||||
foreach ($child->xpath('button') as $value) {
|
||||
$val_check = (string)$value[@value];
|
||||
if ($val_check == '' || $val_check == 'NONE' || $val_check == 'none' ) {
|
||||
|
|
|
@ -19,9 +19,21 @@ $info['XML'] = $this->xmlinterface->info();
|
|||
$info['sccp_class'] = $driver['sccp'];
|
||||
$info['Core_sccp'] = array('Version' => $core['Version'], 'about'=> 'Sccp ver.'. $core['Version'].' r'.$core['vCode']. ' Revision :'. $core['RevisionNum']. ' Hash :'. $core['RevisionHash']);
|
||||
$info['Asterisk'] = array('Version' => FreePBX::Config()->get('ASTVERSION'), 'about'=> 'Asterisk.');
|
||||
if (!empty($this->sccpvalues['tftp_rewrite'])) {
|
||||
if ($this->sccpvalues['tftp_rewrite']['data'] == 'pro') {
|
||||
$info['Provision_SCCP'] = array('Version' => 'base', 'about'=> 'Provision Sccp enabled');
|
||||
} else {
|
||||
$info['TFTP_Rewrite'] = array('Version' => 'base', 'about'=> 'Rewrite Supported');
|
||||
}
|
||||
}
|
||||
$info['Сompatible'] = array('Version' => $this->srvinterface->get_compatible_sccp(), 'about'=> '');
|
||||
|
||||
//print_r($this->dbinterface->info());
|
||||
//print("</pre>");
|
||||
//print_r("<br> Request:<br><pre>");
|
||||
//$asss = $this->extconfigs->validate_init_path($this->sccppath["asterisk"],$this->sccpvalues,$driver_ver);
|
||||
//print_r($asss);
|
||||
//print("</pre>");
|
||||
|
||||
// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK');
|
||||
// print_r('<br>');
|
||||
|
|
Loading…
Reference in a new issue