Begin resample Sccp_manager
few Bugs, no Doc, maybe something is not working 16.10.2017 Fix mail box, sccp driver
This commit is contained in:
parent
ec5f214555
commit
6b68cba0ea
|
@ -68,7 +68,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.1';
|
private $sccp_driver_ver = '11.2';
|
||||||
private $tftpLang = array();
|
private $tftpLang = array();
|
||||||
private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
|
private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!!
|
||||||
public $sccp_model_list = array();
|
public $sccp_model_list = array();
|
||||||
|
@ -90,6 +90,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
$this->v = new \Respect\Validation\Validator();
|
$this->v = new \Respect\Validation\Validator();
|
||||||
|
|
||||||
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager";
|
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager";
|
||||||
|
if(class_exists($driverNamespace,false)) {
|
||||||
foreach(glob(__DIR__."/Sccp_manager.inc/*.class.php") as $driver) {
|
foreach(glob(__DIR__."/Sccp_manager.inc/*.class.php") as $driver) {
|
||||||
if(preg_match("/\/([a-z1-9]*)\.class\.php$/i",$driver,$matches)) {
|
if(preg_match("/\/([a-z1-9]*)\.class\.php$/i",$driver,$matches)) {
|
||||||
$name = $matches[1];
|
$name = $matches[1];
|
||||||
|
@ -100,10 +101,14 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
||||||
if(class_exists($class,false)) {
|
if(class_exists($class,false)) {
|
||||||
$this->$name = new $class();
|
$this->$name = new $class();
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception("Invalid Class inside in the include folder");
|
throw new \Exception("Invalid Class inside in the include folder".print_r($freepbx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->getSccpSettingFromDB(); // Overwrite Exist
|
$this->getSccpSettingFromDB(); // Overwrite Exist
|
||||||
// $this->getSccpSetingINI(false); // get from sccep.ini
|
// $this->getSccpSetingINI(false); // get from sccep.ini
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace FreePBX\modules\Sccp_manager;
|
namespace FreePBX\modules\Sccp_manager;
|
||||||
|
|
||||||
class srvinterface {
|
class srvinterface {
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
@ -126,24 +127,42 @@ class srvinterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_comatable_sccp() {
|
public function get_comatable_sccp() {
|
||||||
$res = 0;
|
$res = $this-> getChanSCCPVersion();
|
||||||
|
if (empty($res)) {
|
||||||
|
$res = $this-> getChanSCCPVersion();
|
||||||
|
}
|
||||||
|
if (empty($res)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ($res["vCode"] >= 431) {
|
||||||
|
return 11;
|
||||||
|
} else {
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
// return $res["vCode"];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCoreSCCPVersion() {
|
||||||
|
$result = array();
|
||||||
$ast_out = $this->sccp_version();
|
$ast_out = $this->sccp_version();
|
||||||
if ($ast_out[0] >= '4.3.0'){
|
$result["Version"] = $ast_out[0];
|
||||||
$res = 1;
|
$version_parts=explode(".", $ast_out[0]);
|
||||||
}
|
$result["vCode"] = implode('', $version_parts);
|
||||||
if (!empty($ast_out[1]) && $ast_out[1] == 'develop'){
|
if (!empty($ast_out[1]) && $ast_out[1] == 'develop'){
|
||||||
|
$result["develop"] = $ast_out[1];
|
||||||
$res = 10;
|
$res = 10;
|
||||||
if (!empty($ast_out[3])) {
|
if (base_convert($ast_out[3],16,10) == base_convert('702487a',16,10)) {
|
||||||
if (base_convert($ast_out[3],16,10) >= base_convert('702487a',16,10)){
|
$result["vCode"] = 431;
|
||||||
$res += 1;
|
}
|
||||||
|
if (base_convert($ast_out[3],16,10) >= "10403") { // new method, RevisionNum is incremental
|
||||||
|
$result["vCode"] = 432;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return $result;
|
||||||
return $res;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// rename public - > privat
|
// rename public - > privat
|
||||||
public function sccp_version() {
|
private function sccp_version() {
|
||||||
$ast_out = $this->sccp_core_comands(array('cmd' => 'get_version'));
|
$ast_out = $this->sccp_core_comands(array('cmd' => 'get_version'));
|
||||||
if (preg_match("/Release.*\(/", $ast_out['data'] , $matches)) {
|
if (preg_match("/Release.*\(/", $ast_out['data'] , $matches)) {
|
||||||
$ast_out = substr($matches[0],9,-1);
|
$ast_out = substr($matches[0],9,-1);
|
||||||
|
@ -153,6 +172,69 @@ class srvinterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getChanSCCPVersion() {
|
||||||
|
global $astman;
|
||||||
|
$result = array();
|
||||||
|
if (!$astman) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
$metadata = $this->astman_retrieveJSFromMetaData("");
|
||||||
|
if ($metadata && array_key_exists("Version",$metadata)) {
|
||||||
|
$result["Version"] = $metadata["Version"];
|
||||||
|
$version_parts=explode(".", $metadata["Version"]);
|
||||||
|
$result["vCode"] = 0;
|
||||||
|
|
||||||
|
# not sure about this sccp_ver numbering. Might be better to just check "Version" and Revision
|
||||||
|
# $result["vCode"] = implode('', $version_parts);
|
||||||
|
$result["vCode"] = 0;
|
||||||
|
if ($version_parts[0] == "4") {
|
||||||
|
$result["vCode"] = 400;
|
||||||
|
if ($version_parts[1] == "1") {
|
||||||
|
$result["vCode"] = 410;
|
||||||
|
} else
|
||||||
|
if ($version_parts[1] == "2") {
|
||||||
|
$result["vCode"] = 420;
|
||||||
|
} else
|
||||||
|
if ($version_parts[1] >= "3") {
|
||||||
|
$result["vCode"] = 430;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (array_key_exists("Branch",$metadata)) {
|
||||||
|
if ($metadata["Branch"] == "master") {
|
||||||
|
|
||||||
|
} else
|
||||||
|
if ($metadata["Branch"] == "develop") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Revision got replaced by RevisionHash in 10404 (using the hash does not work)*/
|
||||||
|
if (array_key_exists("Revision",$metadata)) {
|
||||||
|
if (base_convert($metadata["Revision"],16,10) == base_convert('702487a',16,10)) {
|
||||||
|
$result["vCode"] = 431;
|
||||||
|
}
|
||||||
|
if (base_convert($metadata["Revision"],16,10) >= "10403") {
|
||||||
|
$result["vCode"] = 431;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (array_key_exists("RevisionNum",$metadata)) {
|
||||||
|
if ($metadata["RevisionNum"] >= "10403") { // new method, RevisionNum is incremental
|
||||||
|
$result["vCode"] = 432;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (array_key_exists("ConfigureEnabled",$metadata)) {
|
||||||
|
$result["futures"] = implode(';', $metadata["ConfigureEnabled"]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
die_freepbx("Version information could not be retrieved from chan-sccp, via astman::SCCPConfigMetaData");
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
public function sccp_list_keysets() {
|
public function sccp_list_keysets() {
|
||||||
$ast_out = $this->sccp_core_comands(array('cmd' => 'get_softkey'));
|
$ast_out = $this->sccp_core_comands(array('cmd' => 'get_softkey'));
|
||||||
|
|
||||||
|
@ -228,6 +310,24 @@ class srvinterface {
|
||||||
}
|
}
|
||||||
return $ast_key;
|
return $ast_key;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Replace sccp_core_comands($params = array()) {
|
||||||
|
*/
|
||||||
|
|
||||||
|
private function astman_retrieveJSFromMetaData($segment = "") {
|
||||||
|
global $astman;
|
||||||
|
$params = array();
|
||||||
|
if ($segment != "") {
|
||||||
|
$params["Segment"] = $segment;
|
||||||
|
}
|
||||||
|
$response = $astman->send_request('SCCPConfigMetaData', $params);
|
||||||
|
if ($response["Response"] == "Success") {
|
||||||
|
//outn(_("JSON-content:").$response["JSON"]);
|
||||||
|
$decode=json_decode($response["JSON"], true);
|
||||||
|
return $decode;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -304,6 +304,38 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.sccp_button_hide').each(function () { // On page create !!
|
||||||
|
var dev_id = $(this).data('vhide');
|
||||||
|
var dev_class = $(this).data('clhide');
|
||||||
|
var dev_val = $(this).val();
|
||||||
|
var dev_state = $(this).attr('checked');
|
||||||
|
if (dev_state == 'checked'){
|
||||||
|
$(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');
|
||||||
|
var dev_class = $(this).data('clhide');
|
||||||
|
var dev_val = $(this).val();
|
||||||
|
$(dev_class).each(function () {
|
||||||
|
if (dev_val != dev_id) {
|
||||||
|
$(this).removeClass('hidden');
|
||||||
|
$(this).removeAttr('hidden')
|
||||||
|
} else {
|
||||||
|
$(this).addClass('hidden');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// ----------------------- TEST Validate ----------------
|
// ----------------------- TEST Validate ----------------
|
||||||
$('.need-validate').on('change', function (e) {
|
$('.need-validate').on('change', function (e) {
|
||||||
var dev_class = $(this).attr('class');
|
var dev_class = $(this).attr('class');
|
||||||
|
@ -314,17 +346,15 @@ $(document).ready(function () {
|
||||||
// confirm(dev_id);
|
// confirm(dev_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
// $('.sccp_test').on('click', function (e) {
|
$('.sccp_test').on('click', function (e) {
|
||||||
// var dev_id = [];
|
var dev_id = [];
|
||||||
// $('table').bootstrapTable('getSelections').forEach(function (entry) {
|
// $('table').bootstrapTable('getSelections').forEach(function (entry) {
|
||||||
// dev_id.push(entry['name']);
|
// dev_id.push(entry['name']);
|
||||||
// });
|
// });
|
||||||
// dv = dev_id;
|
dv = dev_id;
|
||||||
// confirm(dv);
|
confirm(dv);
|
||||||
// });
|
});
|
||||||
// ----------------------- TEST ----------------
|
// ----------------------- TEST ----------------
|
||||||
|
|
||||||
|
|
||||||
$('.test').on('click', function (e) {
|
$('.test').on('click', function (e) {
|
||||||
var dev_fld = ['onhook', 'connected', 'onhold', 'ringin', 'offhook', 'conntrans', 'digitsfoll', 'connconf', 'ringout', 'offhookfeat',
|
var dev_fld = ['onhook', 'connected', 'onhold', 'ringin', 'offhook', 'conntrans', 'digitsfoll', 'connconf', 'ringout', 'offhookfeat',
|
||||||
'onhint', 'onstealable', 'holdconf', 'uriaction'];
|
'onhint', 'onstealable', 'holdconf', 'uriaction'];
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
"prettyName" => _("Sccp Custom Driver"),
|
"prettyName" => _("Sccp Custom Driver"),
|
||||||
"shortName" => "SCCP",
|
"shortName" => "SCCP",
|
||||||
"description" => _("Sccp Device"),
|
"description" => _("Sccp Device"),
|
||||||
"sccp_driver_ver" => "11.1"
|
"sccp_driver_ver" => "11.2"
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delDevice($id) {
|
public function delDevice($id) {
|
||||||
$sql = "DELETE FROM sccpline WHERE id = ?";
|
$sql = "DELETE FROM sccpline WHERE name = ?";
|
||||||
$sth = $this->database->prepare($sql);
|
$sth = $this->database->prepare($sql);
|
||||||
$sth->execute(array($id));
|
$sth->execute(array($id));
|
||||||
return true;
|
return true;
|
||||||
|
@ -78,11 +78,11 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
|
|
||||||
public function getDevice($id) {
|
public function getDevice($id) {
|
||||||
$sccp_line = array();
|
$sccp_line = array();
|
||||||
$sql = "SELECT id";
|
$sql = "SELECT name as id";
|
||||||
foreach($this->data_fld as $key => $val) {
|
foreach($this->data_fld as $key => $val) {
|
||||||
$sql .= ',`'. $key .'` as '.$val;
|
$sql .= ',`'. $key .'` as '.$val;
|
||||||
}
|
}
|
||||||
$sql .= " FROM sccpline WHERE id = ?";
|
$sql .= " FROM sccpline WHERE name = ?";
|
||||||
$sth = $this->database->prepare($sql);
|
$sth = $this->database->prepare($sql);
|
||||||
$result = array();
|
$result = array();
|
||||||
$tech = array();
|
$tech = array();
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
"callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
|
"callgroup"=>'callgroup',"pickupgroup"=>'pickupgroup',
|
||||||
"transfer" => 'transfer', "echocancel" => 'echocancel',
|
"transfer" => 'transfer', "echocancel" => 'echocancel',
|
||||||
"language" => 'language', "description" => 'callerid',
|
"language" => 'language', "description" => 'callerid',
|
||||||
"cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'description',
|
"cid_num" => 'cid_num', "cid_name" => 'label', "mailbox" => 'mailbox',
|
||||||
"musicclass" => 'musicclass',
|
"musicclass" => 'musicclass',
|
||||||
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
|
"dnd" => 'dnd', "silencesuppression" => 'silencesuppression',
|
||||||
"secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone',
|
"secondary_dialtone_digits" => 'secondary_dialtone_digits', "secondary_dialtone_tone" => 'secondary_dialtone_tone',
|
||||||
|
@ -29,7 +29,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
"prettyName" => _("Sccp Custom Driver"),
|
"prettyName" => _("Sccp Custom Driver"),
|
||||||
"shortName" => "SCCP",
|
"shortName" => "SCCP",
|
||||||
"description" => _("Sccp Device"),
|
"description" => _("Sccp Device"),
|
||||||
"sccp_driver_ver" => "11.1"
|
"sccp_driver_ver" => "11.2"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
public function addDevice1($id, $settings) {
|
public function addDevice1($id, $settings) {
|
||||||
|
@ -43,11 +43,12 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addDevice($id, $settings) {
|
public function addDevice($id, $settings) {
|
||||||
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description');
|
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description','devinfo_mailbox'=>'mailbox');
|
||||||
// print_r($_REQUEST);
|
// print_r($_REQUEST);
|
||||||
// echo '<br><br>';
|
// echo '<br><br>';
|
||||||
// die(print_r($settings));
|
// die(print_r($settings));
|
||||||
$settings['cid_num']['value']='';
|
$settings['cid_num']['value']='';
|
||||||
|
$settings['mailbox']['value']= '';
|
||||||
if (isset($_REQUEST)){
|
if (isset($_REQUEST)){
|
||||||
foreach($add_fld as $key => $val) {
|
foreach($add_fld as $key => $val) {
|
||||||
if (!empty($_REQUEST[$key])){
|
if (!empty($_REQUEST[$key])){
|
||||||
|
@ -58,7 +59,16 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
if (empty($settings['cid_num']['value'])) {
|
if (empty($settings['cid_num']['value'])) {
|
||||||
$settings['cid_num']['value']= $id;
|
$settings['cid_num']['value']= $id;
|
||||||
}
|
}
|
||||||
$sql = 'INSERT INTO sccpline (name, id';
|
|
||||||
|
if (!empty($_REQUEST['vm']) && ($_REQUEST['vm'] =='enabled')){ // mailbox
|
||||||
|
if (empty($settings['mailbox']['value'])) {
|
||||||
|
$settings['mailbox']['value']= $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// die(print_r($settings));
|
||||||
|
|
||||||
|
$sql = 'REPLACE INTO sccpline (name, id';
|
||||||
$sqlv = 'values ("'.$id.'", "'.$id.'"';
|
$sqlv = 'values ("'.$id.'", "'.$id.'"';
|
||||||
foreach($this->data_fld as $key => $val) {
|
foreach($this->data_fld as $key => $val) {
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
|
@ -84,13 +94,15 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= ") ".$sqlv.");";
|
$sql .= ") ".$sqlv.");";
|
||||||
|
// die(print_r($sql));
|
||||||
$sth = $this->database->prepare($sql);
|
$sth = $this->database->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delDevice($id) {
|
public function delDevice($id) {
|
||||||
$sql = "DELETE FROM sccpline WHERE id = ?";
|
// $sql = "DELETE FROM sccpline WHERE id = ?";
|
||||||
|
$sql = "DELETE FROM sccpline WHERE name = ?";
|
||||||
$sth = $this->database->prepare($sql);
|
$sth = $this->database->prepare($sql);
|
||||||
$sth->execute(array($id));
|
$sth->execute(array($id));
|
||||||
return true;
|
return true;
|
||||||
|
@ -99,11 +111,12 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
|
|
||||||
public function getDevice($id) {
|
public function getDevice($id) {
|
||||||
$sccp_line = array();
|
$sccp_line = array();
|
||||||
$sql = "SELECT id";
|
$sql = "SELECT name as id";
|
||||||
foreach($this->data_fld as $key => $val) {
|
foreach($this->data_fld as $key => $val) {
|
||||||
$sql .= ',`'. $key .'` as '.$val;
|
$sql .= ',`'. $key .'` as '.$val;
|
||||||
}
|
}
|
||||||
$sql .= " FROM sccpline WHERE id = ?";
|
// $sql .= " FROM sccpline WHERE id = ?";
|
||||||
|
$sql .= " FROM sccpline WHERE name = ?";
|
||||||
$sth = $this->database->prepare($sql);
|
$sth = $this->database->prepare($sql);
|
||||||
$result = array();
|
$result = array();
|
||||||
$tech = array();
|
$tech = array();
|
||||||
|
@ -114,6 +127,12 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
$tech['dial']='SCCP/'.$id;
|
$tech['dial']='SCCP/'.$id;
|
||||||
} catch(\Exception $e) {}
|
} catch(\Exception $e) {}
|
||||||
|
|
||||||
|
// print_r($tech);
|
||||||
|
// echo '<br><br>';
|
||||||
|
// print_r($sql);
|
||||||
|
// die(print_r($id));
|
||||||
|
// echo '<br><br>';
|
||||||
|
|
||||||
return $tech;
|
return $tech;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,6 +166,10 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
|
public function getDefaultDeviceSettings($id, $displayname, &$flag) {
|
||||||
$dial = 'SCCP';
|
$dial = 'SCCP';
|
||||||
$settings = array(
|
$settings = array(
|
||||||
|
"mailbox" => array(
|
||||||
|
"value" => "",
|
||||||
|
"flag" => $flag++
|
||||||
|
),
|
||||||
"incominglimit" => array(
|
"incominglimit" => array(
|
||||||
"value" => "2",
|
"value" => "2",
|
||||||
"flag" => $flag++
|
"flag" => $flag++
|
||||||
|
@ -220,6 +243,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
|
||||||
// Assigned DID/CID
|
// Assigned DID/CID
|
||||||
$named_group = $this->getNamedGroup();
|
$named_group = $this->getNamedGroup();
|
||||||
$tmparr = array();
|
$tmparr = array();
|
||||||
|
$tt = _("Name or id of lincked maibox");
|
||||||
|
$tmparr['mailbox'] = array('prompttext' => _('Mailbox'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section);
|
||||||
$tt = _("The SCCP channel number for this port. If you plaining to use this line as 'Shared' or use on several devices - leave this field blank or set limit to 10 calls.");
|
$tt = _("The SCCP channel number for this port. If you plaining to use this line as 'Shared' or use on several devices - leave this field blank or set limit to 10 calls.");
|
||||||
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel);
|
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '2', 'tt' => $tt, 'level' => 0, 'jsvalidation' => 'isEmpty()', 'failvalidationmsg' => $msgInvalidChannel);
|
||||||
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
|
// $tmparr['incominglimit'] = array('prompttext' => _('Incoming Call Limit'), 'value' => '', 'tt' => $tt, 'level' => 1, 'section' => $section, 'category' => 'general');
|
||||||
|
|
|
@ -800,6 +800,7 @@ and open the template in the editor. Base Version before all crash :-)
|
||||||
</item>
|
</item>
|
||||||
<item type="IS" id="8" seq="99"><name>directed_pickup</name> <label>Pickup/Gpickup</label>
|
<item type="IS" id="8" seq="99"><name>directed_pickup</name> <label>Pickup/Gpickup</label>
|
||||||
<default>yes</default>
|
<default>yes</default>
|
||||||
|
<option_hide class=".pickup_hide">no</option_hide>
|
||||||
<button value="yes">On</button>
|
<button value="yes">On</button>
|
||||||
<button value="no">Off</button>
|
<button value="no">Off</button>
|
||||||
<help>Enable Pickup function to direct pickup an extension. Default is On</help>
|
<help>Enable Pickup function to direct pickup an extension. Default is On</help>
|
||||||
|
@ -808,6 +809,7 @@ and open the template in the editor. Base Version before all crash :-)
|
||||||
<name>conf_allow</name>
|
<name>conf_allow</name>
|
||||||
<label>Conference</label>
|
<label>Conference</label>
|
||||||
<default>yes</default>
|
<default>yes</default>
|
||||||
|
<option_hide class=".conf_hide">no</option_hide>
|
||||||
<button value="yes">Yes</button>
|
<button value="yes">Yes</button>
|
||||||
<button value="no">No</button>
|
<button value="no">No</button>
|
||||||
<help>Allow the use of conference</help>
|
<help>Allow the use of conference</help>
|
||||||
|
@ -815,6 +817,7 @@ and open the template in the editor. Base Version before all crash :-)
|
||||||
</page_group>
|
</page_group>
|
||||||
|
|
||||||
<page_group name="sccp_hw_dev_pickup"><label>Pickup</label>
|
<page_group name="sccp_hw_dev_pickup"><label>Pickup</label>
|
||||||
|
<class>pickup_hide</class>
|
||||||
<item type="IE" id="10" seq="99"><label>Context</label>
|
<item type="IE" id="10" seq="99"><label>Context</label>
|
||||||
<input>
|
<input>
|
||||||
<name>directed_pickup_context</name>
|
<name>directed_pickup_context</name>
|
||||||
|
@ -863,6 +866,7 @@ and open the template in the editor. Base Version before all crash :-)
|
||||||
</page_group>
|
</page_group>
|
||||||
|
|
||||||
<page_group name="sccp_hw_dev_conference">
|
<page_group name="sccp_hw_dev_conference">
|
||||||
|
<class>conf_hide</class>
|
||||||
<label>Conference</label>
|
<label>Conference</label>
|
||||||
<item type="IS" id="2" seq="99">
|
<item type="IS" id="2" seq="99">
|
||||||
<name>conf_play_general_announce</name>
|
<name>conf_play_general_announce</name>
|
||||||
|
|
61
install.php
61
install.php
|
@ -8,6 +8,17 @@ global $db;
|
||||||
global $amp_conf;
|
global $amp_conf;
|
||||||
global $astman;
|
global $astman;
|
||||||
global $version;
|
global $version;
|
||||||
|
global $srvinterface;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$class = "\\FreePBX\\Modules\\Sccp_manager\\srvinterface";
|
||||||
|
if(!class_exists($class,false)) {
|
||||||
|
include(__DIR__."/Sccp_manager.inc/srvinterface.class.php");
|
||||||
|
}
|
||||||
|
if(class_exists($class,false)) {
|
||||||
|
$srvinterface = new $class();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Helper function to retrieve SCCPConfigMetaData via ASTMan
|
// Helper function to retrieve SCCPConfigMetaData via ASTMan
|
||||||
|
@ -78,6 +89,7 @@ $db_config_v0 = array(
|
||||||
'musicclass' =>array('def_modify' => "default"),
|
'musicclass' =>array('def_modify' => "default"),
|
||||||
'echocancel' =>array('def_modify' => "on"),
|
'echocancel' =>array('def_modify' => "on"),
|
||||||
'silencesuppression' =>array('def_modify' => "off"),
|
'silencesuppression' =>array('def_modify' => "off"),
|
||||||
|
'id' =>array('create' => 'VARCHAR( 20 ) NULL DEFAULT NULL', 'modify' => "VARCHAR(20)", 'def_modify' =>"NULL"),
|
||||||
'dnd' =>array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modify' => "VARCHAR(12)", 'def_modify' =>"reject")
|
'dnd' =>array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modify' => "VARCHAR(12)", 'def_modify' =>"reject")
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -198,8 +210,24 @@ function CheckAsteriskVersion() {
|
||||||
return $ver_compatible;
|
return $ver_compatible;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CheckChanSCCPVersion($astman) {
|
function CheckChanSCCPVersion() {
|
||||||
global $db_config, $db_config_v0, $db_config_v3;
|
global $db_config, $db_config_v0, $db_config_v3, $srvinterface,$astman;
|
||||||
|
if (!$astman) {
|
||||||
|
ie_freepbx('No asterisk manager connection provided!. Installation Failed');
|
||||||
|
}
|
||||||
|
$sccp_ver = $srvinterface->get_comatable_sccp();
|
||||||
|
outn("<li>" . _("Sccp model Version : ") . $sccp_ver . "</li>");
|
||||||
|
if ($sccp_ver >= 11) {
|
||||||
|
$db_config = $db_config_v3;
|
||||||
|
} else {
|
||||||
|
$db_config = $db_config_v0;
|
||||||
|
}
|
||||||
|
return $sccp_ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
function CheckChanSCCPVersion() {
|
||||||
|
global $db_config, $db_config_v0, $db_config_v3, $astman;
|
||||||
if (!$astman) {
|
if (!$astman) {
|
||||||
ie_freepbx('No asterisk manager connection provided!. Installation Failed');
|
ie_freepbx('No asterisk manager connection provided!. Installation Failed');
|
||||||
}
|
}
|
||||||
|
@ -226,35 +254,25 @@ function CheckChanSCCPVersion($astman) {
|
||||||
$sccp_ver = 430;
|
$sccp_ver = 430;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (array_key_exists("Revision",$metadata)) { // old method
|
||||||
/*
|
if (base_convert($metadata["Revision"],16,10) == base_convert('702487a',16,10)) { // hash values are random, not incrementa
|
||||||
if (array_key_exists("Branch",$metadata)) {
|
|
||||||
if ($metadata["Branch"] == "master") {
|
|
||||||
|
|
||||||
} else
|
|
||||||
if ($metadata["Branch"] == "develop") {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Revision got replaced by RevisionHash in 10404 (using the hash does not work)*/
|
|
||||||
if (array_key_exists("Revision",$metadata) && // old method
|
|
||||||
(base_convert($metadata["Revision"],16,10) == base_convert('702487a',16,10)) // hash values are random, not incremental
|
|
||||||
) {
|
|
||||||
$sccp_ver = 431;
|
$sccp_ver = 431;
|
||||||
$db_config = $db_config_v3;
|
$db_config = $db_config_v3;
|
||||||
} else
|
}
|
||||||
if (array_key_exists("RevisionNum",$metadata) && $metadata["RevisionNum"] >= "10403") { // new method, RevisionNum is incremental
|
}
|
||||||
|
if (array_key_exists("RevisionNum",$metadata)) {
|
||||||
|
if ($metadata["RevisionNum"] >= "10403") { // new method, RevisionNum is incremental
|
||||||
$sccp_ver = 432;
|
$sccp_ver = 432;
|
||||||
$db_config = $db_config_v3;
|
$db_config = $db_config_v3;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
die_freepbx("Version information could not be retrieved from chan-sccp, via astman::SCCPConfigMetaData");
|
die_freepbx("Version information could not be retrieved from chan-sccp, via astman::SCCPConfigMetaData");
|
||||||
}
|
}
|
||||||
outn("<li>" . _("Sccp Version : ") . $sccp_ver . "</li>");
|
outn("<li>" . _("Sccp Version : ") . $sccp_ver . "</li>");
|
||||||
return $sccp_ver;
|
return $sccp_ver;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
function InstallDB_sccpsettings() {
|
function InstallDB_sccpsettings() {
|
||||||
global $db;
|
global $db;
|
||||||
|
@ -483,7 +501,7 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_ver) {
|
||||||
CheckSCCPManagerDBTables($table_req);
|
CheckSCCPManagerDBTables($table_req);
|
||||||
CheckPermissions();
|
CheckPermissions();
|
||||||
CheckAsteriskVersion();
|
CheckAsteriskVersion();
|
||||||
$sccp_ver = CheckChanSCCPVersion($astman);
|
$sccp_ver = CheckChanSCCPVersion();
|
||||||
InstallDB_sccpsettings();
|
InstallDB_sccpsettings();
|
||||||
InstallDB_sccpdevmodel();
|
InstallDB_sccpdevmodel();
|
||||||
InstallDB_updateSchema($db_config);
|
InstallDB_updateSchema($db_config);
|
||||||
|
@ -496,4 +514,5 @@ outn("<br>");
|
||||||
// $ss->save_submit($request);
|
// $ss->save_submit($request);
|
||||||
// $ss->sccp_create_sccp_init();
|
// $ss->sccp_create_sccp_init();
|
||||||
// $ss->sccp_db_save_setting();
|
// $ss->sccp_db_save_setting();
|
||||||
|
//
|
||||||
//}
|
//}
|
|
@ -55,12 +55,16 @@ $items = $itm -> children();
|
||||||
//print_r($syslangs);
|
//print_r($syslangs);
|
||||||
//print_r($moh_list);
|
//print_r($moh_list);
|
||||||
if ($h_show==1) {
|
if ($h_show==1) {
|
||||||
|
$sec_class ='';
|
||||||
|
if (!empty($items ->class)){
|
||||||
|
$sec_class = (string)$items ->class;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="section-title" data-for="<?php echo $npref.$itm['name'];?>">
|
<div class="section-title" data-for="<?php echo $npref.$itm['name'];?>">
|
||||||
<h3><i class="fa fa-minus"></i><?php echo _($items ->label) ?></h3>
|
<h3><i class="fa fa-minus"></i><?php echo _($items ->label) ?></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" data-id="<?php echo $npref.$itm['name'];?>">
|
<div class="section <?php echo $sec_class;?>" data-id="<?php echo $npref.$itm['name'];?>">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -242,10 +246,11 @@ foreach ($items as $child) {
|
||||||
<label class="control-label" for="<?php echo $res_id; ?>"><?php echo _($child->label);?></label>
|
<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>
|
<i class="fa fa-question-circle fpbx-help-icon" data-for="<?php echo $res_id; ?>"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9 radioset">
|
<div class="col-md-9 radioset " data-hide="on">
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
// $res_v = 'no';
|
// $res_v = 'no';
|
||||||
|
$opt_hide = '';
|
||||||
if (empty($child->default)) {
|
if (empty($child->default)) {
|
||||||
$res_v = 'no';
|
$res_v = 'no';
|
||||||
} else {
|
} else {
|
||||||
|
@ -259,9 +264,11 @@ foreach ($items as $child) {
|
||||||
$res_v = (string)$fvalues[$res_n]['data'];
|
$res_v = (string)$fvalues[$res_n]['data'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!empty($child->option_hide)) {
|
||||||
|
$opt_hide = ' class="sccp_button_hide" data-vhide="'.$child->option_hide.'" data-clhide="'.$child->option_hide['class'].'" ';
|
||||||
|
}
|
||||||
foreach ($child->xpath('button') as $value) {
|
foreach ($child->xpath('button') as $value) {
|
||||||
echo '<input type="radio" name="' . $res_id . '" id="' . $res_id. '_' . $i .'" value="' . $value[@value] . '"' . (strtolower((string)$value[@value]) == strtolower($res_v) ? " checked" : "") . '>';
|
echo '<input type="radio" name="' . $res_id . '" id="' . $res_id. '_' . $i .'" value="' . $value[@value] . '"' . (strtolower((string)$value[@value]) == strtolower($res_v) ? " checked" : "") . $opt_hide.'>';
|
||||||
echo '<label for="' . $res_id. '_' . $i . '">' . _($value) . '</label>';
|
echo '<label for="' . $res_id. '_' . $i . '">' . _($value) . '</label>';
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,13 @@
|
||||||
// print_r($this->sccpvalues['sccp_comatable']);
|
// print_r($this->sccpvalues['sccp_comatable']);
|
||||||
// print_r($this->sccpvalues);
|
// print_r($this->sccpvalues);
|
||||||
// $id_name = 'SEP000A8A5C5F25';
|
// $id_name = 'SEP000A8A5C5F25';
|
||||||
// $dev_data = $this->srvinterface->sccp_getdevice_info($id_name);
|
print_r($this->srvinterface->getChanSCCPVersion());
|
||||||
|
print_r('<br>');
|
||||||
// print_r($dev_data);
|
print_r($this->srvinterface->getCoreSCCPVersion());
|
||||||
// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK');
|
// $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK');
|
||||||
//print_r($this->sccpvalues);
|
print_r('<br>');
|
||||||
|
print_r($this->srvinterface->get_comatable_sccp());
|
||||||
|
print_r('<br>');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue