- Bug fix.
This commit is contained in:
parent
f457ce8259
commit
c06e9a5ba9
|
@ -98,6 +98,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
private $hint_context = array('default' => '@ext-local'); /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
|
||||
private $val_null = 'NONE'; /// REPLACE to null Field
|
||||
public $sccp_model_list = array();
|
||||
public $sccp_metainfo = array();
|
||||
private $cnf_wr = null;
|
||||
public $sccppath = array();
|
||||
public $sccpvalues = array();
|
||||
|
@ -175,7 +176,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$htmlret .= load_view(__DIR__ . '/views/formShow.php', array(
|
||||
'itm' => $item, 'h_show' => $heder_show,
|
||||
'form_prefix' => $form_prefix, 'fvalues' => $form_values,
|
||||
'tftp_lang' => $this->getTftpLang())
|
||||
'tftp_lang' => $this->getTftpLang(), 'metainfo' => $this->sccp_metainfo)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
@ -364,6 +365,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
public function myShowPage() {
|
||||
$request = $_REQUEST;
|
||||
$action = !empty($request['action']) ? $request['action'] : '';
|
||||
if ($this->sccpvalues['sccp_compatible']['data'] >= '433') {
|
||||
$this->sccp_metainfo = $this->srvinterface->getеtestChanSCCP_GlablsInfo('general');
|
||||
}
|
||||
|
||||
if (!empty($this->sccpvalues['displayconfig'])) {
|
||||
if (!empty($this->sccpvalues['displayconfig']['data']) && ($this->sccpvalues['displayconfig']['data'] == 'sccpsimple')) {
|
||||
|
@ -492,6 +496,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$request = $_REQUEST;
|
||||
$action = !empty($request['action']) ? $request['action'] : '';
|
||||
$inputform = !empty($request['tech_hardware']) ? $request['tech_hardware'] : '';
|
||||
if ($this->sccpvalues['sccp_compatible']['data'] >= '433') {
|
||||
$this->sccp_metainfo = $this->srvinterface->getеtestChanSCCP_GlablsInfo('device');
|
||||
}
|
||||
|
||||
// print_r($inputform);
|
||||
if (empty($this->pagedata)) {
|
||||
|
@ -1658,7 +1665,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
foreach ($this->sccpvalues as $key => $value) {
|
||||
$data_value[$key] = $value['data'];
|
||||
}
|
||||
$data_value['server_if_list'] = $this->getIP_information();
|
||||
$data_value['server_if_list'] = $this->getIP_information2('ip4');
|
||||
$model_information = $this->getSccp_model_information($get = "enabled", $validate = false); // Get Active
|
||||
|
||||
if (empty($model_information))
|
||||
|
@ -1686,7 +1693,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$data_value[$key] = $value['data'];
|
||||
}
|
||||
$data_value['ntp_timezone_id'] = $this->extconfigs->getextConfig('sccp_timezone', $data_value['ntp_timezone']);
|
||||
$data_value['server_if_list'] = $this->getIP_information();
|
||||
$data_value['server_if_list'] = $this->getIP_information2('ip4');
|
||||
$dev_config['tftp_path'] = $this->sccppath["tftp_path"];
|
||||
$dev_config['tftp_firmware'] = '';
|
||||
/* if (!empty($this->sccpvalues['tftp_rewrite'])) {
|
||||
|
@ -1911,10 +1918,42 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $res;
|
||||
}
|
||||
|
||||
function getIP_information() {
|
||||
function getIP_information2($type = '') {
|
||||
$interfaces= array();
|
||||
switch ($type) {
|
||||
case 'ip4':
|
||||
exec("/sbin/ip -4 -o addr", $result, $ret);
|
||||
break;
|
||||
case 'ip6':
|
||||
exec("/sbin/ip -6 -o addr", $result, $ret);
|
||||
break;
|
||||
|
||||
default:
|
||||
exec("/sbin/ip -o addr", $result, $ret);
|
||||
break;
|
||||
}
|
||||
foreach ($result as $line) {
|
||||
$vals = preg_split("/\s+/", $line);
|
||||
if ($vals[3] == "mtu")
|
||||
continue;
|
||||
if ($vals[2] != "inet" && $vals[2] != "inet6")
|
||||
continue;
|
||||
if (preg_match("/(.+?)(?:@.+)?:$/", $vals[1], $res)) {
|
||||
continue;
|
||||
}
|
||||
$ret = preg_match("/(\d*+.\d*+.\d*+.\d*+)[\/(\d*+)]*/", $vals[3], $ip);
|
||||
|
||||
$interfaces[$vals[1].':'.$vals[2]] = Array('name' => $vals[1],'type' => $vals[2], 'ip' => ((empty($ip[1]) ? '' : $ip[1])));
|
||||
}
|
||||
return $interfaces;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getIP_information_old() {
|
||||
$interfaces['auto'] = array('0.0.0.0', 'All', '0');
|
||||
|
||||
exec("/sbin/ip -o addr", $result, $ret);
|
||||
exec("/sbin/ip -4 -o addr", $result, $ret);
|
||||
foreach ($result as $line) {
|
||||
$vals = preg_split("/\s+/", $line);
|
||||
|
||||
|
|
|
@ -463,6 +463,38 @@ class srvinterface {
|
|||
$metadata = $astman->send_request($action, $params);
|
||||
return $metadata;
|
||||
}
|
||||
/*
|
||||
* [Segments] => ( [0] => general [1] => device [2] => line [3] => softkey )
|
||||
*/
|
||||
function getеtestChanSCCP_GlablsInfo($Segment='') {
|
||||
global $astman;
|
||||
$params = array();
|
||||
$response = $astman->send_request('SCCPConfigMetaData', $params);
|
||||
|
||||
$action = 'SCCPConfigMetaData';
|
||||
if (empty($Segment)) {
|
||||
$Segment = 'general';
|
||||
}
|
||||
$params = array('Segment' => $Segment, 'ResultFormat'=>'command' );
|
||||
$metadata = $astman->send_request($action, $params);
|
||||
if (!empty($metadata['data'])) {
|
||||
$tmp_data = $metadata['data'];
|
||||
if (strpos($tmp_data, 'JSON:')!==false ) {
|
||||
$decode = json_decode(substr ($tmp_data,strpos($tmp_data, 'JSON:') + 5), true);
|
||||
$result = array();
|
||||
if (!empty($decode['Options'])) {
|
||||
foreach ($decode['Options'] as $value) {
|
||||
$result[$value['Name']] = $value;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
return $decode;
|
||||
}
|
||||
|
||||
}
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
/*
|
||||
private function astLogin($host="localhost", $username="admin", $password="amp111"){
|
||||
|
||||
|
@ -607,11 +639,13 @@ class srvinterface {
|
|||
fputs ($fp,"Secret: ".$amp_conf[AMPMGRPASS]."\r\n");
|
||||
fputs ($fp,"Events: on\r\n\r\n");
|
||||
|
||||
fputs ($fp,"Action: SCCPShowDevices\r\n");
|
||||
// fputs ($fp,"Action: SCCPShowDevices\r\n");
|
||||
|
||||
// fputs ($fp,"Action: SCCPConfigMetaData\r\n");
|
||||
// fputs ($fp,"Segment: device\r\n");
|
||||
// fputs ($fp,"ResultFormat: command\r\n");
|
||||
fputs ($fp,"Action: SCCPConfigMetaData\r\n");
|
||||
// fputs ($fp,"Segment: general\r\n");
|
||||
// "Segments":["general","device","line","softkey"]}
|
||||
fputs ($fp,"Segment: device\r\n");
|
||||
fputs ($fp,"ResultFormat: command\r\n");
|
||||
fputs ($fp,"\r\n");
|
||||
|
||||
/*
|
||||
|
|
|
@ -44,15 +44,26 @@ class xmlinterface {
|
|||
$xnode = &$xml_work->callManagerGroup->members;
|
||||
if ($data_values['bindaddr'] == '0.0.0.0') {
|
||||
$ifc = 0;
|
||||
// $xnode->member['priority'] = print_r($data_values['server_if_list'], true);
|
||||
foreach ($data_values['server_if_list'] as $value) {
|
||||
if (!empty($value[0])) {
|
||||
if (!in_array($value[0], array('0.0.0.0', '127.0.0.1'), true)) {
|
||||
if (!empty($value['ip'])) {
|
||||
$ip_valid = true;
|
||||
if (!empty($data_values['ccm_address'])) {
|
||||
if (strpos($data_values['ccm_address'], 'internal') !== false || strpos($data_values['ccm_address'], '0.0.0.0') !== false ) {
|
||||
// Skip
|
||||
} else {
|
||||
if (strpos($data_values['ccm_address'], $value['ip']) === false) {
|
||||
$ip_valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!in_array($value['ip'], array('0.0.0.0', '127.0.0.1'), true) && ($ip_valid)) {
|
||||
$xnode_obj = clone $xnode->member;
|
||||
$xnode_obj['priority'] = $ifc;
|
||||
//$xnode_obj = &$xnode -> member -> callManager;
|
||||
$xnode_obj->callManager->name = $data_values['servername'];
|
||||
$xnode_obj->callManager->ports->ethernetPhonePort = $data_values['port'];
|
||||
$xnode_obj->callManager->processNodeName = $value[0];
|
||||
$xnode_obj->callManager->processNodeName = $value['ip'];
|
||||
if ($ifc === 0) {
|
||||
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
|
||||
} else {
|
||||
|
@ -240,16 +251,28 @@ class xmlinterface {
|
|||
if ($data_values['bindaddr'] == '0.0.0.0') {
|
||||
$ifc = 0;
|
||||
foreach ($data_values['server_if_list'] as $value) {
|
||||
if (!empty($value[0])) {
|
||||
if (!in_array($value[0], array('0.0.0.0', '127.0.0.1'), true)) {
|
||||
$xnode_obj = clone $xnode->member;
|
||||
|
||||
if (!empty($value['ip'])) {
|
||||
$ip_valid = true;
|
||||
if (!empty($data_values['ccm_address'])) {
|
||||
if (strpos($data_values['ccm_address'], 'internal') !== false || strpos($data_values['ccm_address'], '0.0.0.0') !== false ) {
|
||||
// Skip
|
||||
} else {
|
||||
if (strpos($data_values['ccm_address'], $value['ip']) === false) {
|
||||
$ip_valid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!in_array($value['ip'], array('0.0.0.0', '127.0.0.1'), true) && ($ip_valid)) {
|
||||
|
||||
$xnode_obj = clone $xnode->member;
|
||||
// $xnode_obj = $xnode -> member;
|
||||
// $xnode_obj = $xnode -> addChild($xnode->member);
|
||||
$xnode_obj['priority'] = $ifc;
|
||||
//$xnode_obj = &$xnode -> member -> callManager;
|
||||
$xnode_obj->callManager->name = $data_values['servername'];
|
||||
$xnode_obj->callManager->ports->ethernetPhonePort = $data_values['port'];
|
||||
$xnode_obj->callManager->processNodeName = $value[0];
|
||||
$xnode_obj->callManager->processNodeName = $value['ip'];
|
||||
if ($ifc === 0) {
|
||||
$this->replaceSimpleXmlNode($xnode->member, $xnode_obj);
|
||||
} else {
|
||||
|
|
|
@ -105,8 +105,10 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
<options placeholder="Provider IP"></options>
|
||||
</input>
|
||||
<help>External IP Address of the firewall, required in case the PBX is running on a seperate host behind it. IP Address that we're going to notify in RTP media stream as the pbx source address.</help>
|
||||
<meta_help>1</meta_help>
|
||||
<nameseparator> / </nameseparator>
|
||||
</item>
|
||||
|
||||
<item type="IE" id="5">
|
||||
<label>SCCP SERVER Keepalive</label>
|
||||
<input>
|
||||
|
@ -201,6 +203,19 @@ and open the template in the editor. Base Version before all crash :-)
|
|||
<help>All RFC 1918 addresses are local networks. Should always be at least '0.0.0.0/0.0.0.0'.</help>
|
||||
</item>
|
||||
|
||||
<item type="IED" id="1" seq="98">
|
||||
<label>Device Connect Address</label>
|
||||
<name>ccm_address</name>
|
||||
<cbutton field="internal" value="internal">Internal</cbutton>
|
||||
<default>0.0.0.0</default>
|
||||
<input value="NONE" field="ip" nameseparator="">
|
||||
<options placeholder="0.0.0.0" pattern="^([0-9]{1,3}\.){3}[0-9]{1,3}$"/>
|
||||
</input>
|
||||
<add_pluss>+</add_pluss>
|
||||
<addbutton-disabled>Add Address</addbutton-disabled>
|
||||
<help>This function is useful when the server has many interfaces, but devices must connect only to some interfaces.</help>
|
||||
</item>
|
||||
|
||||
|
||||
</page_group>
|
||||
<page_group name="sccp_lang">
|
||||
|
|
|
@ -97,11 +97,10 @@ if (!empty($_REQUEST['new_id'])) {
|
|||
$defaul_tv = (empty($db_buttons[$line_id])) ? "empty": $db_buttons[$line_id]['type'];
|
||||
$defaul_btn = (empty($db_buttons[$line_id])) ? "": $db_buttons[$line_id]['name'];
|
||||
$defaul_opt = (empty($db_buttons[$line_id])) ? array(''): explode(',',$db_buttons[$line_id]['options']);
|
||||
// print_r($defaul_btn);
|
||||
// print_r($defaul_opt);
|
||||
|
||||
$show_form_mode = $defaul_tv;
|
||||
$def_hint = '';
|
||||
$def_hint = ''; // Hint check Box
|
||||
$def_hint_btn = ''; // Hint Combo Box
|
||||
$def_silent = '';
|
||||
$defaul_advline = '';
|
||||
if (strpos($defaul_btn,'@') >0) {
|
||||
|
@ -128,17 +127,21 @@ if (!empty($_REQUEST['new_id'])) {
|
|||
$test_btn = strtok($data_i,'@');
|
||||
$def_hint = 'checked';
|
||||
$defaul_btn = $data_i;
|
||||
$def_hint_btn = $data_i;
|
||||
if ($test_btn == $defaul_opt[0]) {
|
||||
foreach ($lines_list as $data){
|
||||
if ($data['name']==$test_btn) {
|
||||
$show_form_mode = 'line';
|
||||
$defaul_tv = 'monitor';
|
||||
$defaul_btn = $test_btn;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// print_r($defaul_btn);
|
||||
// print_r($defaul_opt);
|
||||
|
||||
echo '<!-- Begin button :'.$line_id.' -->';
|
||||
echo '<div class="line_button element-container" '.(($line_id < $show_buttons)?"":"hidden ").'data-id="'.$line_id.'">';
|
||||
|
@ -208,7 +211,7 @@ if (!empty($_REQUEST['new_id'])) {
|
|||
echo '<select class="form-control" name="'.$forminfo[1]['name'].$line_id.'_hline" >';
|
||||
|
||||
foreach ($hint_list as $data){
|
||||
$select = (($data['hint']==$defaul_btn)?"selected":"");
|
||||
$select = (($data['hint']==$def_hint_btn)?"selected":"");
|
||||
echo '<option value="'.$data['hint'].'" '.$select.' >'.$data['name'].' / '.$data['label'].'</option>';
|
||||
}
|
||||
echo '</select>';
|
||||
|
|
|
@ -38,6 +38,7 @@ $time_zone = array('-12' => 'GTM -12', '-11' => 'GTM -11', '-10' => 'GTM -10', '
|
|||
$time_zone_name = \FreePBX::Sccp_manager()-> extconfigs-> getextConfig('cisco_timezone');
|
||||
//$time_zone = \FreePBX::Sccp_manager()-> extconfigs-> getextConfig('cisco_time');
|
||||
//$system_time_zone = \FreePBX::Sccp_manager()->getSysnemTimeZone();
|
||||
//print_r($metainfo);
|
||||
|
||||
if (\FreePBX::Modules()->checkStatus("soundlang")) {
|
||||
$syslangs = \FreePBX::Soundlang()->getLanguages();
|
||||
|
@ -76,13 +77,22 @@ if ($h_show==1) {
|
|||
}
|
||||
foreach ($items as $child) {
|
||||
if (empty($child->help)) {
|
||||
$child->help = 'Help is not available.';
|
||||
$child->help = 'Help is not available.';
|
||||
$child->meta_help = '1';
|
||||
}
|
||||
// $child->meta_help = '1'; // Remove comments to see original help !
|
||||
|
||||
if ($child['type'] == 'IE') {
|
||||
$res_input = '';
|
||||
$res_name = '';
|
||||
$res_id = $npref.$child->input[0]->name;
|
||||
$res_oid = (string)$child->input[0]->name;
|
||||
$res_id = $npref.$res_oid;
|
||||
if (!empty($metainfo[$res_oid])){
|
||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||
$child->help = $metainfo[$res_oid]['Description'];
|
||||
}
|
||||
}
|
||||
|
||||
// --- Add Hiden option
|
||||
$res_sec_class ='';
|
||||
if (!empty($child ->class)){
|
||||
|
@ -158,8 +168,14 @@ foreach ($items as $child) {
|
|||
$res_input = '';
|
||||
$res_name = '';
|
||||
$res_value = '';
|
||||
$opt_at = array();
|
||||
$res_n = (string)$child->name;
|
||||
|
||||
if (!empty($metainfo[$res_n])){
|
||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||
$child->help = $metainfo[$res_n]['Description'];
|
||||
}
|
||||
}
|
||||
// $res_value
|
||||
$lnhtm = '';
|
||||
$res_id = $napref.$child->name;
|
||||
|
@ -300,6 +316,12 @@ foreach ($items as $child) {
|
|||
if ($child['type'] == 'IS') {
|
||||
$res_n = (string)$child->name;
|
||||
$res_id = $npref.$child->name;
|
||||
if (!empty($metainfo[$res_n])){
|
||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||
$child->help = $metainfo[$res_n]['Description'];
|
||||
}
|
||||
}
|
||||
|
||||
// --- Add Hiden option
|
||||
$res_sec_class ='';
|
||||
if (!empty($child ->class)){
|
||||
|
@ -377,6 +399,12 @@ foreach ($items as $child) {
|
|||
// $value = $child -> select;
|
||||
$res_n = (string)$child ->name;
|
||||
$res_id = $npref.$res_n;
|
||||
if (!empty($metainfo[$res_n])){
|
||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||
$child->help = $metainfo[$res_n]['Description'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($child->class)) {
|
||||
$child->class = 'form-control';
|
||||
}
|
||||
|
@ -440,6 +468,11 @@ foreach ($items as $child) {
|
|||
$res_id = $npref.$res_n;
|
||||
$child->value ='';
|
||||
|
||||
if (!empty($metainfo[$res_n])){
|
||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||
$child->help = $metainfo[$res_n]['Description'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($child['type'] == 'SLS') {
|
||||
$select_opt= $syslangs;
|
||||
|
@ -530,6 +563,12 @@ foreach ($items as $child) {
|
|||
if ($child['type'] == 'SL') {
|
||||
$res_n = (string)$child->name;
|
||||
$res_id = $npref.$child->name;
|
||||
|
||||
if (!empty($metainfo[$res_n])){
|
||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||
$child->help = $metainfo[$res_n]['Description'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($child ->class)) {
|
||||
$child->class = 'form-control';
|
||||
|
@ -584,6 +623,13 @@ foreach ($items as $child) {
|
|||
// $value = $child -> select;
|
||||
$res_n = (string)$child ->name;
|
||||
$res_id = $npref.$res_n;
|
||||
|
||||
if (!empty($metainfo[$res_n])){
|
||||
if ($child->meta_help == '1' || $child->help == 'Help!') {
|
||||
$child->help = $metainfo[$res_n]['Description'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($child->class)) {
|
||||
$child->class = 'form-control';
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ if (empty($ast_realtime)) {
|
|||
}
|
||||
$info['RealTime'] = array('Version' => $rt_sccp, 'about'=> $rt_info);
|
||||
}
|
||||
|
||||
if (empty($conf_realtime)) {
|
||||
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about'=> '<div class="alert signature alert-danger"> No found Real Time Configs</div>');
|
||||
} else {
|
||||
|
@ -70,18 +71,21 @@ if (empty($conf_realtime)) {
|
|||
$info['ConfigsRealTime'] = array('Version' => 'Error', 'about'=> $rt_info);
|
||||
}
|
||||
}
|
||||
/*
|
||||
//global $amp_conf;
|
||||
/*
|
||||
print_r("<br> Request:<br><pre>");
|
||||
$json = '';
|
||||
print_r("<br>");
|
||||
//print_r($conf_realtime);
|
||||
print_r($conf_realtime);
|
||||
print_r("<br>");
|
||||
print_r("<br>");
|
||||
//print_r($amp_conf);
|
||||
print_r($ast_realtime);
|
||||
// print_r("DIRECT START");
|
||||
print_r($this->sccpvalues['ccm_address']);
|
||||
print_r("<br>");
|
||||
// print_r($this->srvinterface->t_get_meta_data());
|
||||
// print_r($this->getIP_information2());
|
||||
// print_r($this->srvinterface->getеtestChanSCCP_GlablsInfo());
|
||||
// print_r($this->sccp_metainfo);
|
||||
print("</pre>");
|
||||
*/
|
||||
// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK');
|
||||
|
|
Loading…
Reference in a new issue