Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
d3dec54b5f
|
@ -93,60 +93,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
"tftp_path" => '/tftpboot'
|
||||
);
|
||||
public $xml_data;
|
||||
public $keysetdefault = array('onhook' => 'redial,newcall,cfwdall,dnd,pickup,gpickup,private',
|
||||
'connected' => 'hold,endcall,park,vidmode,select,cfwdall,cfwdbusy,idivert',
|
||||
'onhold' => 'resume,newcall,endcall,transfer,conflist,select,dirtrfr,idivert,meetme',
|
||||
'ringin' => 'answer,endcall,transvm,idivert',
|
||||
'offhook' => 'redial,endcall,private,cfwdall,cfwdbusy,pickup,gpickup,meetme,barge',
|
||||
'conntrans' => 'hold,endcall,transfer,conf,park,select,dirtrfr,vidmode,meetme,cfwdall,cfwdbusy',
|
||||
'digitsfoll' => 'back,endcall,dial',
|
||||
'connconf' => 'conflist,newcall,endcall,hold,vidmode',
|
||||
'ringout' => 'empty,endcall,transfer,cfwdall,idivert',
|
||||
'offhookfeat' => 'redial,endcall',
|
||||
'onhint' => 'redial,newcall,pickup,gpickup,barge',
|
||||
'onstealable' => 'redial,newcall,cfwdall,pickup,gpickup,dnd,intrcpt',
|
||||
'holdconf' => 'resume,newcall,endcall,join',
|
||||
'uriaction' => 'default');
|
||||
// Cisco Language Code / Directory
|
||||
public $sccp_lang = array('ar_SA' => array('code' => 'ar', 'language' => 'Arabic', 'locale' => 'Arabic_Saudi_Arabia'),
|
||||
'bg_BG' => array('code' => 'bg', 'language' => 'Bulgarian', 'locale' => 'Bulgarian_Bulgaria'),
|
||||
'cz_CZ' => array('code' => 'cz', 'language' => 'Czech', 'locale' => 'Czech_Czech_Republic'),
|
||||
'da_DK' => array('code' => 'da', 'language' => 'Danish', 'locale' => 'Danish_Denmark'),
|
||||
'de_DE' => array('code' => 'de', 'language' => 'German', 'locale' => 'German_Germany'),
|
||||
'el_GR' => array('code' => 'el', 'language' => 'Greek', 'locale' => 'Greek_Greece'),
|
||||
'en_AU' => array('code' => 'en', 'language' => 'English', 'locale' => 'AU_English_United_States'),
|
||||
'en_GB' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_Kingdom'),
|
||||
'en_US' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_States'),
|
||||
'es_ES' => array('code' => 'es', 'language' => 'Spanish', 'locale' => 'Spanish_Spain'),
|
||||
'et_EE' => array('code' => 'et', 'language' => 'Estonian', 'locale' => 'Estonian_Estonia'),
|
||||
'fi_FI' => array('code' => 'fi', 'language' => 'Finnish', 'locale' => 'Finnish_Finland'),
|
||||
'fr_CA' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_Canada'),
|
||||
'fr_FR' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_France'),
|
||||
'he_IL' => array('code' => 'he', 'language' => 'Hebrew', 'locale' => 'Hebrew_Israel'),
|
||||
'hr_HR' => array('code' => 'hr', 'language' => 'Croatian', 'locale' => 'Croatian_Croatia'),
|
||||
'hu_HU' => array('code' => 'hu', 'language' => 'Hungarian', 'locale' => 'Hungarian_Hungary'),
|
||||
'it_IT' => array('code' => 'it', 'language' => 'Italian', 'locale' => 'Italian_Italy'),
|
||||
'ja_JP' => array('code' => 'ja', 'language' => 'Japanese', 'locale' => 'Japanese_Japan'),
|
||||
'ko_KO' => array('code' => 'ko', 'language' => 'Korean', 'locale' => 'Korean_Korea_Republic'),
|
||||
'lt_LT' => array('code' => 'lt', 'language' => 'Lithuanian', 'locale' => 'Lithuanian_Lithuania'),
|
||||
'lv_LV' => array('code' => 'lv', 'language' => 'Latvian', 'locale' => 'Latvian_Latvia'),
|
||||
'nl_NL' => array('code' => 'nl', 'language' => 'Dutch', 'locale' => 'Dutch_Netherlands'),
|
||||
'no_NO' => array('code' => 'no', 'language' => 'Norwegian', 'locale' => 'Norwegian_Norway'),
|
||||
'pl_PL' => array('code' => 'pl', 'language' => 'Polish', 'locale' => 'Polish_Poland'),
|
||||
'pt_BR' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Brazil'),
|
||||
'pt_PT' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Portugal'),
|
||||
'ro_RO' => array('code' => 'ro', 'language' => 'Romanian', 'locale' => 'Romanian_Romania'),
|
||||
'ru_RU' => array('code' => 'ru', 'language' => 'Russian', 'locale' => 'Russian_Russian_Federation'),
|
||||
'sk_SK' => array('code' => 'sk', 'language' => 'Slovakian', 'locale' => 'Slovak_Slovakia'),
|
||||
'sl_SL' => array('code' => 'sl', 'language' => 'Slovenian', 'locale' => 'Slovenian_Slovenia'),
|
||||
'sr_ME' => array('code' => 'sr', 'language' => 'Serbian', 'locale' => 'Serbian_Republic_of_Montenegro'),
|
||||
'sr_RS' => array('code' => 'rs', 'language' => 'Serbian', 'locale' => 'Serbian_Republic_of_Serbia'),
|
||||
'sv_SE' => array('code' => 'sv', 'language' => 'Swedish', 'locale' => 'Swedish_Sweden'),
|
||||
'th_TH' => array('code' => 'th', 'language' => 'Thailand', 'locale' => 'Thai_Thailand'),
|
||||
'tr_TR' => array('code' => 'tr', 'language' => 'Turkish', 'locale' => 'Turkish_Turkey'),
|
||||
'zh_CN' => array('code' => 'cn', 'language' => 'Chinese', 'locale' => 'Chinese_China'),
|
||||
'zh_TW' => array('code' => 'zh', 'language' => 'Chinese', 'locale' => 'Chinese_Taiwan')
|
||||
);
|
||||
|
||||
public function __construct($freepbx = null) {
|
||||
if ($freepbx == null) {
|
||||
|
@ -158,12 +104,39 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$this->cnf_wr = \FreePBX::WriteConfig();
|
||||
$this->cnf_read = \FreePBX::LoadConfig();
|
||||
$this->v = new \Respect\Validation\Validator();
|
||||
|
||||
if(!class_exists("FreePBX\modules\Sccp_manager\configs",false)) {
|
||||
include(__DIR__."/Sccp_manager.inc/configs.class.php");
|
||||
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager\\configs";
|
||||
$class = $driverNamespace;
|
||||
$this->configs = new $class();
|
||||
// $this->configs = \FreePBX\Modules\Sccp_manager\configs;
|
||||
}
|
||||
/*
|
||||
$driverNamespace = "\\FreePBX\\Modules\\Sccp_manager\\configs";
|
||||
foreach(glob(__DIR__."/functions.inc/drivers/*.class.php") as $driver) {
|
||||
if(preg_match("/\/([a-z1-9]*)\.class\.php$/i",$driver,$matches)) {
|
||||
$name = $matches[1];
|
||||
$class = $driverNamespace . "\\" . $name;
|
||||
if(!class_exists($class,false)) {
|
||||
include($driver);
|
||||
}
|
||||
if(class_exists($class,false)) {
|
||||
$this->drivers[strtolower($name)] = new $class($this->freepbx);
|
||||
} else {
|
||||
throw new \Exception("Invalid Class inside the drivers folder");
|
||||
}
|
||||
}
|
||||
}
|
||||
*
|
||||
*/
|
||||
$this->getSccpSettingsDB(false); // Overwrite Exist
|
||||
// $this->getSccpSetingINI(false); // get from sccep.ini
|
||||
$this->init_sccp_path();
|
||||
$this->initVarfromDefs();
|
||||
$this->initTftpLang();
|
||||
|
||||
|
||||
// Load Advanced Form Constuctor Data
|
||||
$xml_vars = __DIR__ . '/conf/sccpgeneral.xml.v'.$this->sccpvalues['sccp_comatable'];
|
||||
if (!file_exists($xml_vars)) {
|
||||
|
@ -201,7 +174,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* Load config vars from base array
|
||||
*/
|
||||
public function initVarfromDefs() {
|
||||
foreach ($this->sccpDefaults as $key => $value) {
|
||||
foreach ($this->$this->configs->getConfig('sccpDefaults') as $key => $value) {
|
||||
if (empty($this->sccpvalues[$key])) {
|
||||
$this->sccpvalues[$key] = array('keyword' => $key, 'data' => $value, 'type' => '0', 'seq' => '0');
|
||||
}
|
||||
|
@ -740,7 +713,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
if (!empty($request['id'])) {
|
||||
$id_name = $request['id'];
|
||||
$this->sccp_conf_init[$id_name]['type'] = "softkeyset";
|
||||
foreach ($this->keysetdefault as $keyl => $vall) {
|
||||
foreach ($this->$this->configs->getConfig('keyset') as $keyl => $vall) {
|
||||
if (!empty($request[$keyl])) {
|
||||
$this->sccp_conf_init[$id_name][$keyl] = $request[$keyl];
|
||||
}
|
||||
|
@ -761,7 +734,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
foreach ($this->sccp_list_keysets() as $keyl => $vall) {
|
||||
$result[$i]['softkeys'] = $keyl;
|
||||
if ($keyl == 'default') {
|
||||
foreach ($this->keysetdefault as $key => $value) {
|
||||
foreach ($this->configs->getConfig('keyset') as $key => $value) {
|
||||
$result[$i][$key] = str_replace(',', '<br>', $value);
|
||||
}
|
||||
} else {
|
||||
|
@ -1604,7 +1577,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
|
||||
$filename = $dir . DIRECTORY_SEPARATOR . $value . DIRECTORY_SEPARATOR . $this->SCCP_LANG_DICTIONARY;
|
||||
if (file_exists($filename)) {
|
||||
foreach ($this->sccp_lang as $lang_key => $lang_value) {
|
||||
$lang_ar = $this->configs->getConfig('sccp_lang');
|
||||
foreach ($lang_ar as $lang_key => $lang_value) {
|
||||
if ($lang_value['locale'] == $value) {
|
||||
$result[$lang_key] = $value;
|
||||
}
|
||||
|
@ -1623,7 +1597,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
private function init_tftp_lang_path() {
|
||||
$dir = $this->sccppath["tftp_path"];
|
||||
foreach ($this->sccp_lang as $lang_key => $lang_value) {
|
||||
foreach ($this->configs->getConfig('sccp_lang') as $lang_key => $lang_value) {
|
||||
$filename = $dir . DIRECTORY_SEPARATOR . $lang_value['locale'];
|
||||
if (!file_exists($filename)) {
|
||||
if (!mkdir($filename, 0777, true)) {
|
||||
|
@ -1981,12 +1955,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
} else {
|
||||
$lang = $this->sccpvalues['devlang']['data'];
|
||||
}
|
||||
$xnode->name = $this->sccp_lang[$lang]['locale'];
|
||||
$xnode->langCode = $this->sccp_lang[$lang]['code'];
|
||||
// configs->getConfig('sccp_lang')
|
||||
$lang_arr = $this->configs->getConfig('sccp_lang',$lang);
|
||||
$xnode->name = $lang_arr['locale'];
|
||||
$xnode->langCode = $$lang_arr['code'];
|
||||
// $this -> replaceSimpleXmlNode($xml_work->$key,$xnode);
|
||||
break;
|
||||
case 'networkLocale':
|
||||
$xnode = $this->sccp_lang[$this->sccpvalues['netlang']['data']]['language'];
|
||||
$lang_arr = $this->configs->getConfig('sccp_lang',$this->sccpvalues['netlang']['data']);
|
||||
$xnode = $lang_arr['language'];
|
||||
break;
|
||||
}
|
||||
//$this-> replaceSimpleXmlNode($xml_work->$value, $xnode );
|
||||
|
@ -2187,9 +2164,10 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
if ($key == 'networkLocale') {
|
||||
$xml_work->$key = $lang;
|
||||
} else {
|
||||
if (!empty($this->sccp_lang[$lang])) {
|
||||
$xml_node->name = $this->sccp_lang[$lang]['locale'];
|
||||
$xml_node->langCode = $this->sccp_lang[$lang]['code'];
|
||||
$lang_arr = $this->configs->getConfig('sccp_lang',$lang);
|
||||
if (!empty($lang_arr)) {
|
||||
$xml_node->name = $lang_arr['locale'];
|
||||
$xml_node->langCode = $lang_arr['code'];
|
||||
$this->replaceSimpleXmlNode($xml_work->$key, $xml_node);
|
||||
}
|
||||
}
|
||||
|
|
93
Sccp_manager.inc/configs.class.php
Normal file
93
Sccp_manager.inc/configs.class.php
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
*/
|
||||
namespace FreePBX\modules\Sccp_manager;
|
||||
class configs {
|
||||
// protected $freepbx;
|
||||
// protected $database;
|
||||
|
||||
public function __construct() {
|
||||
// $this->freepbx = $freepbx;
|
||||
// $this->database = $freepbx->Database;
|
||||
}
|
||||
public function getConfig($id = '', $index = '') {
|
||||
switch ($id) {
|
||||
case 'keyset':
|
||||
if (empty($index)) {
|
||||
return $this->keysetdefault;
|
||||
} else {
|
||||
if (isset($this->keysetdefault[$index])) {
|
||||
return $this->keysetdefault[$index];
|
||||
} else {
|
||||
return array('');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'sccp_lang':
|
||||
return $this->cisco_language;
|
||||
break;
|
||||
|
||||
default:
|
||||
return array('noId');
|
||||
break;
|
||||
}
|
||||
return array();
|
||||
}
|
||||
private $keysetdefault = array('onhook' => 'redial,newcall,cfwdall,dnd,pickup,gpickup,private',
|
||||
'connected' => 'hold,endcall,park,vidmode,select,cfwdall,cfwdbusy,idivert',
|
||||
'onhold' => 'resume,newcall,endcall,transfer,conflist,select,dirtrfr,idivert,meetme',
|
||||
'ringin' => 'answer,endcall,transvm,idivert',
|
||||
'offhook' => 'redial,endcall,private,cfwdall,cfwdbusy,pickup,gpickup,meetme,barge',
|
||||
'conntrans' => 'hold,endcall,transfer,conf,park,select,dirtrfr,vidmode,meetme,cfwdall,cfwdbusy',
|
||||
'digitsfoll' => 'back,endcall,dial',
|
||||
'connconf' => 'conflist,newcall,endcall,hold,vidmode',
|
||||
'ringout' => 'empty,endcall,transfer,cfwdall,idivert',
|
||||
'offhookfeat' => 'redial,endcall',
|
||||
'onhint' => 'redial,newcall,pickup,gpickup,barge',
|
||||
'onstealable' => 'redial,newcall,cfwdall,pickup,gpickup,dnd,intrcpt',
|
||||
'holdconf' => 'resume,newcall,endcall,join',
|
||||
'uriaction' => 'default');
|
||||
// Cisco Language Code / Directory
|
||||
private $cisco_language = array('ar_SA' => array('code' => 'ar', 'language' => 'Arabic', 'locale' => 'Arabic_Saudi_Arabia'),
|
||||
'bg_BG' => array('code' => 'bg', 'language' => 'Bulgarian', 'locale' => 'Bulgarian_Bulgaria'),
|
||||
'cz_CZ' => array('code' => 'cz', 'language' => 'Czech', 'locale' => 'Czech_Czech_Republic'),
|
||||
'da_DK' => array('code' => 'da', 'language' => 'Danish', 'locale' => 'Danish_Denmark'),
|
||||
'de_DE' => array('code' => 'de', 'language' => 'German', 'locale' => 'German_Germany'),
|
||||
'el_GR' => array('code' => 'el', 'language' => 'Greek', 'locale' => 'Greek_Greece'),
|
||||
'en_AU' => array('code' => 'en', 'language' => 'English', 'locale' => 'AU_English_United_States'),
|
||||
'en_GB' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_Kingdom'),
|
||||
'en_US' => array('code' => 'en', 'language' => 'English', 'locale' => 'English_United_States'),
|
||||
'es_ES' => array('code' => 'es', 'language' => 'Spanish', 'locale' => 'Spanish_Spain'),
|
||||
'et_EE' => array('code' => 'et', 'language' => 'Estonian', 'locale' => 'Estonian_Estonia'),
|
||||
'fi_FI' => array('code' => 'fi', 'language' => 'Finnish', 'locale' => 'Finnish_Finland'),
|
||||
'fr_CA' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_Canada'),
|
||||
'fr_FR' => array('code' => 'fr', 'language' => 'French', 'locale' => 'French_France'),
|
||||
'he_IL' => array('code' => 'he', 'language' => 'Hebrew', 'locale' => 'Hebrew_Israel'),
|
||||
'hr_HR' => array('code' => 'hr', 'language' => 'Croatian', 'locale' => 'Croatian_Croatia'),
|
||||
'hu_HU' => array('code' => 'hu', 'language' => 'Hungarian', 'locale' => 'Hungarian_Hungary'),
|
||||
'it_IT' => array('code' => 'it', 'language' => 'Italian', 'locale' => 'Italian_Italy'),
|
||||
'ja_JP' => array('code' => 'ja', 'language' => 'Japanese', 'locale' => 'Japanese_Japan'),
|
||||
'ko_KO' => array('code' => 'ko', 'language' => 'Korean', 'locale' => 'Korean_Korea_Republic'),
|
||||
'lt_LT' => array('code' => 'lt', 'language' => 'Lithuanian', 'locale' => 'Lithuanian_Lithuania'),
|
||||
'lv_LV' => array('code' => 'lv', 'language' => 'Latvian', 'locale' => 'Latvian_Latvia'),
|
||||
'nl_NL' => array('code' => 'nl', 'language' => 'Dutch', 'locale' => 'Dutch_Netherlands'),
|
||||
'no_NO' => array('code' => 'no', 'language' => 'Norwegian', 'locale' => 'Norwegian_Norway'),
|
||||
'pl_PL' => array('code' => 'pl', 'language' => 'Polish', 'locale' => 'Polish_Poland'),
|
||||
'pt_BR' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Brazil'),
|
||||
'pt_PT' => array('code' => 'pt', 'language' => 'Portuguese', 'locale' => 'Portuguese_Portugal'),
|
||||
'ro_RO' => array('code' => 'ro', 'language' => 'Romanian', 'locale' => 'Romanian_Romania'),
|
||||
'ru_RU' => array('code' => 'ru', 'language' => 'Russian', 'locale' => 'Russian_Russian_Federation'),
|
||||
'sk_SK' => array('code' => 'sk', 'language' => 'Slovakian', 'locale' => 'Slovak_Slovakia'),
|
||||
'sl_SL' => array('code' => 'sl', 'language' => 'Slovenian', 'locale' => 'Slovenian_Slovenia'),
|
||||
'sr_ME' => array('code' => 'sr', 'language' => 'Serbian', 'locale' => 'Serbian_Republic_of_Montenegro'),
|
||||
'sr_RS' => array('code' => 'rs', 'language' => 'Serbian', 'locale' => 'Serbian_Republic_of_Serbia'),
|
||||
'sv_SE' => array('code' => 'sv', 'language' => 'Swedish', 'locale' => 'Swedish_Sweden'),
|
||||
'th_TH' => array('code' => 'th', 'language' => 'Thailand', 'locale' => 'Thai_Thailand'),
|
||||
'tr_TR' => array('code' => 'tr', 'language' => 'Turkish', 'locale' => 'Turkish_Turkey'),
|
||||
'zh_CN' => array('code' => 'cn', 'language' => 'Chinese', 'locale' => 'Chinese_China'),
|
||||
'zh_TW' => array('code' => 'zh', 'language' => 'Chinese', 'locale' => 'Chinese_Taiwan')
|
||||
);
|
||||
|
||||
|
||||
}
|
298
install.php
298
install.php
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
if (!defined('FREEPBX_IS_AUTH')) {
|
||||
die('No direct script access allowed');
|
||||
die_freepbx('No direct script access allowed');
|
||||
}
|
||||
|
||||
global $db;
|
||||
|
@ -9,14 +9,37 @@ global $amp_conf;
|
|||
global $astman;
|
||||
global $version;
|
||||
|
||||
$db_config_v0 = array('sccpdevmodel' => array('enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
|
||||
//
|
||||
// Helper function to retrieve SCCPConfigMetaData via ASTMan
|
||||
// segment: ["", "general","device","line","softkey"]}
|
||||
// returns a php variable (array/set)
|
||||
//
|
||||
// Move to seperate helper file
|
||||
function astman_retrieveJSFromMetaData($astman, $segment = "") {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
$db_config_v0 = array(
|
||||
'sccpdevmodel' => array(
|
||||
'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
|
||||
'nametemplate' => array('create' => 'VARCHAR(50) NULL DEFAULT NULL'),
|
||||
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL" )
|
||||
),
|
||||
'sccpdevice' => array(
|
||||
'_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'),
|
||||
// 'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_hwlang`"),
|
||||
// 'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),
|
||||
//'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_hwlang`"),
|
||||
//'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),
|
||||
'deny' => 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)"),
|
||||
|
@ -41,7 +64,8 @@ $db_config_v0 = array('sccpdevmodel' => array('enabled' => array('create' => "IN
|
|||
'softkeyset' =>array('def_modify' => "softkeyset")
|
||||
),
|
||||
|
||||
'sccpline' => array('namedcallgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'sccpline' => array(
|
||||
'namedcallgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'adhocNumber' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
|
||||
'meetme' =>array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
|
||||
|
@ -56,10 +80,11 @@ $db_config_v0 = array('sccpdevmodel' => array('enabled' => array('create' => "IN
|
|||
'silencesuppression' =>array('def_modify' => "off"),
|
||||
'dnd' =>array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modify' => "VARCHAR(12)", 'def_modify' =>"reject")
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
$db_config_v3 = array('sccpdevmodel' => array('enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
|
||||
$db_config_v3 = array(
|
||||
'sccpdevmodel' => array(
|
||||
'enabled' => array('create' => "INT(2) NULL DEFAULT '0'"),
|
||||
'nametemplate' => array('create' => 'VARCHAR(50) NULL DEFAULT NULL'),
|
||||
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL" )
|
||||
),
|
||||
|
@ -74,7 +99,7 @@ $db_config_v3 = array('sccpdevmodel' => array('enabled' => array('create' => "IN
|
|||
'_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'),
|
||||
'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_hwlang`"),
|
||||
|
||||
// 'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),
|
||||
//'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'),
|
||||
'dtmfmode' => array('drop' => "yes"),
|
||||
|
||||
'deny' => array('create' => 'VARCHAR(100) NULL DEFAULT NULL','modify' => "VARCHAR(100)"),
|
||||
|
@ -101,7 +126,8 @@ $db_config_v3 = array('sccpdevmodel' => array('enabled' => array('create' => "IN
|
|||
'nat' =>array('def_modify' => "auto"),
|
||||
'softkeyset' =>array('def_modify' => "softkeyset")
|
||||
),
|
||||
'sccpline' => array('namedcallgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'sccpline' => array(
|
||||
'namedcallgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"),
|
||||
'namedpickupgroup' =>array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `namedcallgroup`", 'modify' => "VARCHAR(100)"),
|
||||
'adhocNumber' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `namedpickupgroup`"),
|
||||
'meetme' =>array('create' => "VARCHAR(5) NULL DEFAULT NULL AFTER `adhocNumber`"),
|
||||
|
@ -121,97 +147,136 @@ $db_config_v3 = array('sccpdevmodel' => array('enabled' => array('create' => "IN
|
|||
'silencesuppression' =>array('def_modify' => "off"),
|
||||
'dnd' =>array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modify' => "VARCHAR(12)", 'def_modify' =>"reject")
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT" : "AUTO_INCREMENT";
|
||||
|
||||
$table_req = array('sccpdevice', 'sccpline', 'buttonconfig');
|
||||
|
||||
$ss = FreePBX::create()->Sccp_manager;
|
||||
$astman = FreePBX::create()->astman;
|
||||
$sccp_ver = 0;
|
||||
$db_config = $db_config_v0;
|
||||
|
||||
outn(_("checking for Sccp_manager database tables.."));
|
||||
foreach ($table_req as $value) {
|
||||
function CheckSCCPManagerDBTables($table_req) {
|
||||
global $db;
|
||||
outn("<li>" . _("Checking for Sccp_manager database tables..") . "</li>");
|
||||
foreach ($table_req as $value) {
|
||||
$check = $db->getRow("SELECT 1 FROM `$value` LIMIT 0", DB_FETCHMODE_ASSOC);
|
||||
if (DB::IsError($check)) {
|
||||
// print_r("none, creating table :". $value);
|
||||
out(_("none, Can't find table: " . $value));
|
||||
out(_("none, Please goto the chan-sccp/conf directory and create the DB schema (See wiki)"));
|
||||
die("!!!! Installation error: Can not find required ".$value." table !!!!!!\n");
|
||||
// die_freepbx("!!!! Instalation error. Can not find required ".$value." table !!!!!!\n");
|
||||
//print_r("none, creating table :". $value);
|
||||
outn(_("Can't find table: " . $value));
|
||||
outn(_("Please goto the chan-sccp/conf directory and create the DB schema manually (See wiki)"));
|
||||
die_freepbx("!!!! Installation error: Can not find required ".$value." table !!!!!!\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$version = FreePBX::Config()->get('ASTVERSION');
|
||||
outn(_("checking Version : ").$version);
|
||||
|
||||
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views';
|
||||
if (fileowner($_SERVER['DOCUMENT_ROOT']) != fileowner($dst)){
|
||||
die('Please (re-)check permissions by running "amportal chown"');
|
||||
function CheckPermissions() {
|
||||
outn("<li>" . _("Checking Filesystem Permissions") . "</li>");
|
||||
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views';
|
||||
if (fileowner($_SERVER['DOCUMENT_ROOT']) != fileowner($dst)){
|
||||
die_freepbx('Please (re-)check permissions by running "amportal chown. Installation Failed"');
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($version)) {
|
||||
function CheckAsteriskVersion() {
|
||||
outn("<li>" . _("Checking Asterisk Version : ") . $version . "</li>");
|
||||
$version = FreePBX::Config()->get('ASTVERSION');
|
||||
if (!empty($version)) {
|
||||
// Woo, we have a version
|
||||
if (version_compare($version, "12.2.0", ">=")) {
|
||||
$ver_compatable = true;
|
||||
}
|
||||
} else {
|
||||
// Well. I don't know what version of Asterisk I'm running.
|
||||
// Assume less than 12.
|
||||
|
||||
$ver_compatable = false;
|
||||
die('Versin is not comapable');
|
||||
}
|
||||
|
||||
// Should be replaced by a function to check the AMI:SCCPConfigMetaData
|
||||
// JSON: {"Name":"Chan-sccp-b","Branch":"issues/394_1","Version":"4.3.0","Revision":"8d9d74fM","ConfigRevision":"0","ConfigureEnabled": ["park","pickup","realtime","video","conferenence","dirtrfr","feature_monitor","functions","manager_events","devstate_feature","dynamic_speeddial","dynamic_speeddial_cid","experimental","debug"],"Segments":["general","device","line","softkey"]}
|
||||
$ast_out = $astman->Command("sccp show version");
|
||||
$db_config = $db_config_v0;
|
||||
if (preg_match("/Release.*\(/", $ast_out['data'] , $matches)) {
|
||||
$ast_out = explode(' ', substr($matches[0],9,-1));
|
||||
$sccp_ver = 0;
|
||||
if ($ast_out[0] >= '4.3.0'){
|
||||
$sccp_ver = 1;
|
||||
}
|
||||
if (!empty($ast_out[1]) && $ast_out[1] == 'develop'){
|
||||
$sccp_ver = 10;
|
||||
if (!empty($ast_out[3])) {
|
||||
if (base_convert($ast_out[3],16,10) >= base_convert('702487a',16,10)){
|
||||
$sccp_ver += 1;
|
||||
$db_config = $db_config_v3;
|
||||
}
|
||||
$ver_compatible = true;
|
||||
} else {
|
||||
die_freepbx('Asterisk Version is to old, please upgrade to asterisk-12 or higher. Installation Failed');
|
||||
}
|
||||
} else {
|
||||
$sccp_ver = 0;
|
||||
// Well. I don't know what version of Asterisk I'm running.
|
||||
// Assume less than 12.
|
||||
$ver_compatible = false;
|
||||
die_freepbx('Asterisk Version could not be verified. Installation Failed');
|
||||
}
|
||||
return $ver_compatible;
|
||||
}
|
||||
|
||||
function CheckChanSCCPVersion($astman) {
|
||||
global $db_config, $db_config_v0, $db_config_v3;
|
||||
if (!$astman) {
|
||||
ie_freepbx('No asterisk manager connection provided!. Installation Failed');
|
||||
}
|
||||
$metadata = astman_retrieveJSFromMetaData($astman, "");
|
||||
// example metadata:
|
||||
// {"Name":"Chan-sccp-b","Branch":"develop","Version":"4.3.0","RevisionHash":"d3f4482","RevisionNum":"10403","Tag":"v4.2.3-574-gd3f44824","VersioningType":"git","ConfigRevision":"0",
|
||||
// "ConfigureEnabled": ["park","pickup","realtime","video","conferenence","dirtrfr","feature_monitor","functions","manager_events","devstate_feature","dynamic_speeddial","dynamic_speeddial_cid","experimental","debug"],
|
||||
// "Segments":["general","device","line","softkey"]}
|
||||
|
||||
if ($metadata && array_key_exists("Version",$metadata)) {
|
||||
$version_parts=explode(".", $metadata["Version"]);
|
||||
|
||||
// test
|
||||
// $sccp_ver = 0;
|
||||
// $db_config = $db_config_v0;
|
||||
// test
|
||||
outn(_(" Sccp Version : ").$sccp_ver);
|
||||
# not sure about this sccp_ver numbering. Might be better to just check "Version" and Revision
|
||||
if ($version_parts[0] == "4") {
|
||||
$sccp_ver = 400;
|
||||
$db_config = $db_config_v0;
|
||||
if ($version_parts[1] == "1") {
|
||||
$sccp_ver = 410;
|
||||
} else
|
||||
if ($version_parts[1] == "2") {
|
||||
$sccp_ver = 420;
|
||||
} else
|
||||
if ($version_parts[1] >= "3") {
|
||||
$sccp_ver = 430;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = <<< END
|
||||
CREATE TABLE IF NOT EXISTS `sccpsettings` (
|
||||
/*
|
||||
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;
|
||||
$db_config = $db_config_v3;
|
||||
} else
|
||||
if (array_key_exists("RevisionNum",$metadata) && $metadata["RevisionNum"] >= "10403") { // new method, RevisionNum is incremental
|
||||
$sccp_ver = 432;
|
||||
$db_config = $db_config_v3;
|
||||
}
|
||||
} else {
|
||||
die_freepbx("Version information could not be retrieved from chan-sccp, via astman::SCCPConfigMetaData");
|
||||
}
|
||||
outn("<li>" . _("Sccp Version : ") . $sccp_ver . "</li>");
|
||||
return $sccp_ver;
|
||||
}
|
||||
|
||||
function InstallDB_sccpsettings() {
|
||||
global $db;
|
||||
outn("<li>" . _("Creating sccpsettings table...") . "</li>");
|
||||
$sql = "CREATE TABLE IF NOT EXISTS `sccpsettings` (
|
||||
`keyword` VARCHAR (50) NOT NULL default '',
|
||||
`data` VARCHAR (255) NOT NULL default '',
|
||||
`seq` TINYINT (1),
|
||||
`type` TINYINT (1) NOT NULL default '0',
|
||||
PRIMARY KEY (`keyword`,`seq`,`type`)
|
||||
)
|
||||
END;
|
||||
|
||||
out(_("No sccpsettings table, creating table"));
|
||||
);";
|
||||
$check = $db->query($sql);
|
||||
if (db::IsError($check)) {
|
||||
die_freepbx("Can not create sccpsettings table, error:$check\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$sql = <<< END
|
||||
CREATE TABLE IF NOT EXISTS `sccpdevmodel` (
|
||||
function InstallDB_sccpdevmodel() {
|
||||
global $db;
|
||||
outn("<li>" . _("Creating sccpdevmodel table...") . "</li>");
|
||||
$sql = "CREATE TABLE IF NOT EXISTS `sccpdevmodel` (
|
||||
`model` varchar(20) NOT NULL DEFAULT '',
|
||||
`vendor` varchar(40) DEFAULT '',
|
||||
`dns` int(2) DEFAULT '1',
|
||||
|
@ -222,17 +287,22 @@ $sql = <<< END
|
|||
`nametemplate` VARCHAR(50) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`model`),
|
||||
KEY `model` (`model`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
END;
|
||||
|
||||
$check = $db->query($sql);
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;";
|
||||
$check = $db->query($sql);
|
||||
if (db::IsError($check)) {
|
||||
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
||||
}
|
||||
out(_("none, Modify DB schama"));
|
||||
return true;
|
||||
}
|
||||
|
||||
function InstallDB_updateSchema($db_config) {
|
||||
global $db;
|
||||
if (!$db_config) {
|
||||
die_freepbx("No db_config provided");
|
||||
}
|
||||
outn("<li>" . _("Modify Database schema") . "</li>");
|
||||
foreach ($db_config as $tabl_name => &$tab_modify) {
|
||||
// 0 - name 1-type 4- default
|
||||
// 0 - name 1-type 4- default
|
||||
$sql = "DESCRIBE ".$tabl_name."";
|
||||
$db_result= $db->getAll($sql);
|
||||
if (DB::IsError($db_result)) {
|
||||
|
@ -309,10 +379,12 @@ $check = $db->query($sql);
|
|||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
out(_("none, Uptade Table Info"));
|
||||
|
||||
//$sql = "REPLACE INTO `sccpdevmodel` VALUES ('7925','CISCO',1,1,'',''),('7902','CISCO',1,1,'CP7902080002SCCP060817A','loadInformation30008'),('7905','CISCO',1,1,'CP7905080003SCCP070409A','loadInformation20000'),('7906','CISCO',1,1,'SCCP11.8-3-1S','loadInformation369'),('7910','CISCO',1,1,'P00405000700','loadInformation6'),('7911','CISCO',1,1,'SCCP11.8-3-1S','loadInformation307'),('7912','CISCO',1,1,'CP7912080003SCCP070409A','loadInformation30007'),('7914','CISCO',0,14,'S00105000300','loadInformation124'),('7920','CISCO',1,1,'cmterm_7920.4.0-03-02','loadInformation30002'),('7921','CISCO',1,1,'CP7921G-1.0.3','loadInformation365'),('7931','CISCO',1,1,'SCCP31.8-3-1S','loadInformation348'),('7936','CISCO',1,1,'cmterm_7936.3-3-13-0','loadInformation30019'),('7937','CISCO',1,1,'','loadInformation431'),('7940','CISCO',1,2,'P00308000500','loadInformation8'),('Digital Access+','CISCO',1,1,'D00303010033','loadInformation42'),('7941','CISCO',1,2,'P00308000500','loadInformation115'),('7941G-GE','CISCO',1,2,'P00308000500','loadInformation309'),('7942','CISCO',1,2,'P00308000500','loadInformation434'),('Digital Access','CISCO',1,1,'D001M022','loadInformation40'),('7945','CISCO',1,2,'P00308000500','loadInformation435'),('7960','CISCO',3,6,'P00308000500','loadInformation7'),('7961','CISCO',3,6,'P00308000500','loadInformation30018'),('7961G-GE','CISCO',3,6,'P00308000500','loadInformation308'),('7962','CISCO',3,6,'P00308000500','loadInformation404'),('7965','CISCO',3,6,'P00308000500','loadInformation436'),('7970','CISCO',3,8,'SCCP70.8-3-1S','loadInformation30006'),('7971','CISCO',3,8,'SCCP70.8-3-1S','loadInformation119'),('7975','CISCO',3,8,'SCCP70.8-3-1S','loadInformation437'),('7985','CISCO',3,8,'cmterm_7985.4-1-4-0','loadInformation302'),('ATA 186','CISCO',1,1,'ATA030203SCCP051201A','loadInformation12'),('IP Communicator','CISCO',1,1,'','loadInformation30016'),('12 SP','CISCO',1,1,'','loadInformation3'),('12 SP+','CISCO',1,1,'','loadInformation2'),('30 SP+','CISCO',1,1,'','loadInformation1'),('30 VIP','CISCO',1,1,'','loadInformation5'),('7914,7914','CISCO',0,28,'S00105000300','loadInformation124'),('7915','CISCO',0,14,'',''),('7916','CISCO',0,14,'',''),('7915,7915','CISCO',0,28,'',''),('7916,7916','CISCO',0,28,'',''),('CN622','MOTOROLA',1,1,'','loadInformation335'),('ICC','NOKIA',1,1,'',''),('E-Series','NOKIA',1,1,'',''),('3911','CISCO',1,1,'','loadInformation446'),('3951','CISCO',1,1,'','loadInformation412');";
|
||||
function InstallDB_fillsccpdevmodel() {
|
||||
global $db;
|
||||
outn("<li>" . _("Fill sccpdevmodel") . "</li>");
|
||||
$sql = "REPLACE INTO `sccpdevmodel` (`model`, `vendor`, `dns`, `buttons`, `loadimage`, `loadinformationid`, `enabled`, `nametemplate`) VALUES ('12 SP', 'CISCO', 1, 1, '', 'loadInformation3', 0, NULL)," .
|
||||
"('12 SP+', 'CISCO', 1, 1, '', 'loadInformation2', 0, NULL), ('30 SP+', 'CISCO', 1, 1, '', 'loadInformation1', 0, NULL), ('30 VIP', 'CISCO', 1, 1, '', 'loadInformation5', 0, NULL), ('3911', 'CISCO', 1, 1, '', 'loadInformation446', 0, NULL), ('3951', 'CISCO', 1, 1, '', 'loadInformation412', 0, ''), ('6901', 'CISCO', 1, 0, 'SCCP6901.9-2-1-a', 'loadInformation547', 0, NULL), ('6911', 'CISCO', 1, 0, 'SCCP6911.9-2-1-a', 'loadInformation548', 0, NULL), ('6921', 'CISCO', 1, 0, 'SCCP69xx.9-2-1-0', 'loadInformation496', 0, NULL), ('6941', 'CISCO', 1, 1, 'SCCP69xx.9-2-1-0', 'loadInformation495', 0, NULL), ('6945', 'CISCO', 1, 0, 'SCCP6945.9-2-1-0', 'loadInformation564', 0, NULL), ('6961', 'CISCO', 1, 0, 'SCCP69xx.9-2-1-0', 'loadInformation497', 0, NULL), ('7902', 'CISCO', 1, 1, 'CP7902080002SCCP060817A', 'loadInformation30008', 0, NULL), " .
|
||||
"('7905', 'CISCO', 1, 1, 'CP7905080003SCCP070409A', 'loadInformation20000', 0, NULL), ('7906', 'CISCO', 1, 1, 'SCCP11.9-2-1S', 'loadInformation369', 1, 'SEP0000000000.cnf.xml_791x_template'), ('7910', 'CISCO', 1, 1, 'SCCP11.9-2-1S', 'loadInformation6', 1, 'SEP0000000000.cnf.xml_791x_template'), ('7911', 'CISCO', 1, 1, 'SCCP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_template'), ('7912', 'CISCO', 1, 1, 'CP7912080004SCCP080108A', 'loadInformation30007', 0, NULL), ('7914', 'CISCO', 0, 14, 'S00105000400', 'loadInformation124', 1, NULL),('7914,7914', 'CISCO', 0, 28, 'S00105000400', 'loadInformation124', 1, NULL), ('7915', 'CISCO', 0, 24, 'B015-1-0-4', 'loadInformation227', 1, NULL), ('7915,7915', 'CISCO', 0, 48, 'B015-1-0-4', 'loadInformation228', 1, NULL), ('7916', 'CISCO', 0, 24, 'B015-1-0-4', 'loadInformation229', 1, NULL), " .
|
||||
|
@ -320,17 +392,27 @@ $check = $db->query($sql);
|
|||
"('7941', 'CISCO', 1, 2, 'SCCP41.9-2-1S', 'loadInformation115', 0, 'SEP0000000000.cnf.xml_796x_template'),('7941G-GE', 'CISCO', 1, 2, 'SCCP41.9-2-1S', 'loadInformation309', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7942', 'CISCO', 1, 2, 'SCCP42.9-2-1S', 'loadInformation434', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7945', 'CISCO', 1, 2, 'SCCP45.9-2-1S', 'loadInformation435', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7960', 'CISCO', 3, 6, 'P0030801SR02', 'loadInformation7', 1, 'SEP0000000000.cnf.xml_796x_template'), ('7961', 'CISCO', 3, 6, 'SCCP41.9-2-1S', 'loadInformation30018', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7961G-GE', 'CISCO', 3, 6, 'SCCP41.9-2-1S', 'loadInformation308', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7962', 'CISCO', 3, 6, 'SCCP42.9-2-1S', 'loadInformation404', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7965', 'CISCO', 3, 6, 'SCCP45.9-2-1S', 'loadInformation436', 0, 'SEP0000000000.cnf.xml_796x_template'), ('7970', 'CISCO', 3, 8, 'SCCP70.9-2-1S', 'loadInformation30006', 0, NULL), ('7971', 'CISCO', 1, 2, 'SCCP75.9-2-1S', 'loadInformation119', 0, NULL), ('7975', 'CISCO', 3, 8, 'SCCP75.9-2-1S', 'loadInformation437', 0, NULL), ('7985', 'CISCO', 3, 8, 'cmterm_7985.4-1-7-0', 'loadInformation302', 0, NULL), ('8941', 'CISCO', 1, 0, 'SCCP894x.9-2-2-0', 'loadInformation586', 0, NULL), ('8945', 'CISCO', 1, 0, 'SCCP894x.9-2-2-0', 'loadInformation585', 0, NULL), ('ATA 186', 'CISCO', 1, 1, 'ATA030204SCCP090202A', 'loadInformation12', 0, NULL), ('ATA 187', 'CISCO', 1, 1, 'ATA187.9-2-3-1', 'loadInformation550', 0, NULL), ('CN622', 'MOTOROLA', 1, 1, '', 'loadInformation335', 0, NULL), ('Digital Access', 'CISCO', 1, 1, 'D001M022', 'loadInformation40', 0, NULL), ('Digital Access+', 'CISCO', 1, 1, 'D00303010033', 'loadInformation42', 0, NULL), ('E-Series', 'NOKIA', 1, 1, '', '', 0, NULL), ('ICC', 'NOKIA', 1, 1, '', '', 0, NULL), " .
|
||||
"('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL), ('Nokia E', 'Nokia', 0, 28, '', 'loadInformation275', 0, NULL), ('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL), ('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);";
|
||||
$check = $db->query($sql);
|
||||
if (DB::IsError($check)) {
|
||||
die_freepbx("Can not REPLACE defaults into sccpdevmodel table\n");
|
||||
if (db::IsError($check)) {
|
||||
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
$sql = 'UPDATE `sccpdevice` set audio_tos="0xB8",audio_cos="6",video_tos="0x88",video_cos="5" where audio_tos=NULL or audio_tos="";';
|
||||
function InstallDB_updateSccpDevice() {
|
||||
global $db;
|
||||
outn("<li>" . _("Update sccpdevice") . "</li>");
|
||||
$sql = "UPDATE `sccpdevice` set audio_tos='0xB8',audio_cos='6',video_tos='0x88',video_cos='5' where audio_tos=NULL or audio_tos='';";
|
||||
$check = $db->query($sql);
|
||||
if (DB::IsError($check)) {
|
||||
die_freepbx("Can not REPLACE defaults into sccpdevice table\n");
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "DROP TRIGGER IF EXISTS trg_buttonconfig;
|
||||
function InstallDB_createButtonConfigTrigger() {
|
||||
global $db;
|
||||
outn("<li>" . _("(Re)Create buttonconfig trigger") . "</li>");
|
||||
$sql = "
|
||||
DROP TRIGGER IF EXISTS trg_buttonconfig;
|
||||
DELIMITER $$
|
||||
CREATE TRIGGER trg_buttonconfig BEFORE INSERT ON buttonconfig
|
||||
FOR EACH ROW
|
||||
|
@ -343,23 +425,22 @@ $check = $db->query($sql);
|
|||
UPDATE `Foreign key contraint violated: line does not exist in sccpline` SET x=1;
|
||||
END IF;
|
||||
END IF;
|
||||
END$$
|
||||
END $$
|
||||
DELIMITER ;";
|
||||
$check = $db->query($sql);
|
||||
if (DB::IsError($check)) {
|
||||
die_freepbx("Can not modify sccpdevice table\n");
|
||||
}
|
||||
$sql_v3 = "CREATE OR REPLACE
|
||||
ALGORITHM = MERGE
|
||||
VIEW sccpdeviceconfig AS
|
||||
SELECT GROUP_CONCAT( CONCAT_WS( ',', buttonconfig.type, buttonconfig.name, buttonconfig.options )
|
||||
ORDER BY instance ASC
|
||||
SEPARATOR ';' ) AS button, sccpdevice.*
|
||||
FROM sccpdevice
|
||||
LEFT JOIN buttonconfig ON ( buttonconfig.device = sccpdevice.name )
|
||||
GROUP BY sccpdevice.name;";
|
||||
return true;
|
||||
}
|
||||
|
||||
$sql_v0 = "CREATE OR REPLACE
|
||||
function InstallDB_CreateSccpDeviceConfigView($sccp_ver) {
|
||||
global $db;
|
||||
outn("<li>" . _("(Re)Create sccpdeviceconfig view") . "</li>");
|
||||
$sql = "";
|
||||
if ($sccp_ver < 430) {
|
||||
$sql= "
|
||||
CREATE OR REPLACE
|
||||
ALGORITHM = MERGE
|
||||
VIEW sccpdeviceconfig AS
|
||||
|
||||
|
@ -380,18 +461,39 @@ $check = $db->query($sql);
|
|||
FROM sccpdevice
|
||||
LEFT JOIN buttonconfig ON ( buttonconfig.device = sccpdevice.name )
|
||||
GROUP BY sccpdevice.name;";
|
||||
|
||||
if ($sccp_ver == 11) {
|
||||
$check = $db->query($sql_v3);
|
||||
} else {
|
||||
$check = $db->query($sql_v0);
|
||||
$sql = "
|
||||
CREATE OR REPLACE
|
||||
ALGORITHM = MERGE
|
||||
VIEW sccpdeviceconfig AS
|
||||
SELECT GROUP_CONCAT( CONCAT_WS( ',', buttonconfig.type, buttonconfig.name, buttonconfig.options )
|
||||
ORDER BY instance ASC
|
||||
SEPARATOR ';' ) AS button, sccpdevice.*
|
||||
FROM sccpdevice
|
||||
LEFT JOIN buttonconfig ON ( buttonconfig.device = sccpdevice.name )
|
||||
GROUP BY sccpdevice.name;";
|
||||
}
|
||||
$results = $db->query($sql);
|
||||
if (DB::IsError($check)) {
|
||||
die_freepbx("Can not modify sccpdevice table\n");
|
||||
die_freepbx(sprintf(_("Error updating sccpdeviceconfig view. Command was: %s; error was: %s "), $sql, $results->getMessage()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
CheckSCCPManagerDBTables($table_req);
|
||||
CheckPermissions();
|
||||
CheckAsteriskVersion();
|
||||
$sccp_ver = CheckChanSCCPVersion($astman);
|
||||
InstallDB_sccpsettings();
|
||||
InstallDB_sccpdevmodel();
|
||||
InstallDB_updateSchema($db_config);
|
||||
InstallDB_fillsccpdevmodel();
|
||||
InstallDB_updateSccpDevice();
|
||||
InstallDB_createButtonConfigTrigger();
|
||||
InstallDB_CreateSccpDeviceConfigView($sccp_ver);
|
||||
outn("<br>");
|
||||
|
||||
// $ss->save_submit($request);
|
||||
// $ss->sccp_create_sccp_init();
|
||||
// $ss->sccp_db_save_setting();
|
||||
|
||||
//}
|
|
@ -12,11 +12,11 @@
|
|||
// print_r($dev_data);
|
||||
|
||||
/// $sccpdriver = $this->freepbx->Config->get_conf_setting('ASTSCCPDRIVER');
|
||||
// $driver = $this->FreePBX->Core->getAllDriversInfo();
|
||||
$driver = $this->configs->getConfig('sccp_lang');
|
||||
// $driver = $this->FreePBX->Config->get_conf_setting('ASTSCCPDRIVER');
|
||||
// $driver = $this->FreePBX->Config->get_conf_setting('ASTSIPDRIVER');
|
||||
// $tversion = $freepbx->Config;
|
||||
// print_r($driver );
|
||||
print_r($driver );
|
||||
|
||||
?>
|
||||
|
||||
|
|
Loading…
Reference in a new issue