Diederik de Groot <dkgroot@talon.nl> 03.11.2017

- Update README.md
  - Commented out astman_retrieveJSFromMetaData in install.php (was moved to srvinterface)
  - Addd/Updated some !TODO! entries
  - Spelling:
  - devise -> device
  - Compatable/Comable -> Compatible
  - Templet -> Template
  - buton -> button
  - Templatee -> Template
  - format style PHP
This commit is contained in:
PhantomVl 2017-11-03 17:46:34 +03:00
parent 9a18a0940b
commit e416b55654
7 changed files with 1079 additions and 1078 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,27 +1,32 @@
<?php
/**
*
* Core Comsnd Interface
*
*
*/
/**
*
* Core Comsnd Interface
*
*
*/
namespace FreePBX\modules\Sccp_manager;
class dbinterface {
private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct() {
}
public function info() {
$Ver = '13.0.2';
return Array('Version' => $Ver,
'about' =>'Data access interface ver: '.$Ver);
'about' => 'Data access interface ver: ' . $Ver);
}
/*
* Core Access Function
*/
public function get_db_SccpTableData($dataid, $data = array()) {
if ($dataid == '') {
return False;
@ -76,6 +81,7 @@ class dbinterface {
/*
* Get Sccp Device Model information
*/
function getDb_model_info($get = "all", $format_list = "all", $filter = array()) {
global $db;
switch ($format_list) {
@ -93,9 +99,9 @@ class dbinterface {
case "byciscoid":
if (!empty($filter)) {
if (!empty($filter['model'])) {
if (strpos($filter['model'],'loadInformation')) {
if (strpos($filter['model'], 'loadInformation')) {
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`loadinformationid` ='" . $filter['model'] . "') ORDER BY model ";
} else {
} else {
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`loadinformationid` ='loadInformation" . $filter['model'] . "') ORDER BY model ";
}
} else {
@ -204,4 +210,5 @@ class dbinterface {
}
return $result;
}
}

View file

@ -1,213 +1,214 @@
<?php
/**
*
*/
namespace FreePBX\modules\Sccp_manager;
class extconfigs {
public function __construct() {
}
public function __construct() {
public function info() {
$Ver = '13.0.2';
return Array('Version' => $Ver,
'about' =>'Default Setings and Enums ver: '.$Ver);
}
}
public function getextConfig($id = '', $index = '') {
switch ($id) {
case 'keyset':
$result = $this->keysetdefault;
break;
case 'sccp_lang':
$result = $this->cisco_language;
break;
case 'sccpDefaults':
$result = $this->sccpDefaults;
break;
case 'sccp_timezone':
$result = array();
foreach ($this->cisco_timezone as $key => $value) {
$cisco_code = $key .' Standard'.((empty($value['daylight']))? '': '/'.$value['daylight']).' Time';
if (isset($value['cisco_code'])) {
$cisco_code = (empty($value['cisco_code']))? $cisco_code : $value['cisco_code'];
}
$result[$key] = array('offset' => $value['offset'], 'daylight' => $value['daylight'], 'cisco_code' =>$cisco_code);
public function info() {
$Ver = '13.0.2';
return Array('Version' => $Ver,
'about' => 'Default Setings and Enums ver: ' . $Ver);
}
public function getextConfig($id = '', $index = '') {
switch ($id) {
case 'keyset':
$result = $this->keysetdefault;
break;
case 'sccp_lang':
$result = $this->cisco_language;
break;
case 'sccpDefaults':
$result = $this->sccpDefaults;
break;
case 'sccp_timezone':
$result = array();
foreach ($this->cisco_timezone as $key => $value) {
$cisco_code = $key . ' Standard' . ((empty($value['daylight'])) ? '' : '/' . $value['daylight']) . ' Time';
if (isset($value['cisco_code'])) {
$cisco_code = (empty($value['cisco_code'])) ? $cisco_code : $value['cisco_code'];
}
break;
/* case 'cisco_time':
$result = array();
foreach ($this->cisco_timezone as $key => $value) {
$result[] = array('id'=> ($value['offset']/60) ,'val'=>$key.((empty($value['daylight']))? '': '/'.$value['daylight']));
}
break;
*/
case 'cisco_timezone':
$result = array();
foreach ($this->cisco_timezone as $key => $value) {
$result[] = array('id'=> $key ,'val'=>$key.((empty($value['daylight']))? '': '/'.$value['daylight']));
// $result[$key] =$key.((empty($value['daylight']))? '': '/'.$value['daylight']);
}
break;
default:
return array('noId');
break;
}
if (empty($index)) {
return $result;
} else {
if (isset($result[$index])) {
return $result[$index];
} else {
return array();
$result[$key] = array('offset' => $value['offset'], 'daylight' => $value['daylight'], 'cisco_code' => $cisco_code);
}
break;
/* case 'cisco_time':
$result = array();
foreach ($this->cisco_timezone as $key => $value) {
$result[] = array('id'=> ($value['offset']/60) ,'val'=>$key.((empty($value['daylight']))? '': '/'.$value['daylight']));
}
break;
*/
case 'cisco_timezone':
$result = array();
foreach ($this->cisco_timezone as $key => $value) {
$result[] = array('id' => $key, 'val' => $key . ((empty($value['daylight'])) ? '' : '/' . $value['daylight']));
// $result[$key] =$key.((empty($value['daylight']))? '': '/'.$value['daylight']);
}
break;
default:
return array('noId');
break;
}
if (empty($index)) {
return $result;
} else {
if (isset($result[$index])) {
return $result[$index];
} else {
return array();
}
}
}
private $sccpDefaults = array(
"servername" => 'VPBXSCCP',
"bindaddr" => '0.0.0.0', "port" => '2000', # chan_sccp also supports ipv6
# bindaddr = "::" will support ipv6 and ipv4 at the same time
"deny" => '0.0.0.0/0.0.0.0',
"permit" => '0.0.0.0/0.0.0.0', # !TODO!: please change this to 'internal' which would mean:
# permit:127.0.0.0/255.0.0.0,permit:10.0.0.0/255.0.0.0,permit:172.0.0.0/255.224.0.0,permit:192.168.0.0/255.255.0.0"
"dateformat" => 'D.M.Y', # This is the german default format. Should be "D/M/Y" or "D/M/YA" instead
"disallow" => 'all', "allow" => 'alaw;ulaw',
"hotline_enabled" => 'no',
"hotline_context" => 'default', # !TODO!: Should this not be from-internal on FreePBX ?
"hotline_extension" => '*60', # !TODO!: Is this a good default extension to dial for hotline ?
"hotline_label" => 'hotline',
"devicetable" => 'sccpdevice',
"linetable" => 'sccpline',
"tftp_path" => '/tftpboot'
);
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');
private $sccpDefaults = array(
"servername" => 'VPBXSCCP',
"bindaddr" => '0.0.0.0', "port" => '2000', # chan_sccp also supports ipv6
# bindaddr = "::" will support ipv6 and ipv4 at the same time
"deny" => '0.0.0.0/0.0.0.0',
"permit" => '0.0.0.0/0.0.0.0', # !TODO!: please change this to 'internal' which would mean:
# permit:127.0.0.0/255.0.0.0,permit:10.0.0.0/255.0.0.0,permit:172.0.0.0/255.224.0.0,permit:192.168.0.0/255.255.0.0"
"dateformat" => 'D.M.Y', # This is the german default format. Should be "D/M/Y" or "D/M/YA" instead
"disallow" => 'all', "allow" => 'alaw;ulaw',
"hotline_enabled" => 'no',
"hotline_context" => 'default', # !TODO!: Should this not be from-internal on FreePBX ?
"hotline_extension" => '*60', # !TODO!: Is this a good default extension to dial for hotline ?
"hotline_label" => 'hotline',
"devicetable" => 'sccpdevice',
"linetable" => 'sccpline',
"tftp_path" => '/tftpboot'
);
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')
);
private $cisco_timezone = array(
'Dateline' => array('offset' => '-720', 'daylight' => ''),
'Samoa' => array('offset' => '-660', 'daylight' => ''),
'Hawaiian' => array('offset' => '-600', 'daylight' => ''),
'Alaskan' => array('offset' => '-540', 'daylight' => 'Daylight'),
'Pacific' => array('offset' => '-480', 'daylight' => 'Daylight'),
'Mountain' => array('offset' => '-420', 'daylight' => 'Daylight'),
'US Mountain' => array('offset' => '-420', 'daylight' => ''),
'Central' => array('offset' => '-360', 'daylight' => 'Daylight'),
'Mexico' => array('offset' => '-360', 'daylight' => 'Daylight'),
'Canada Central' => array('offset' => '-360', 'daylight' => ''),
'SA Pacific' => array('offset' => '-300', 'daylight' => ''),
'Eastern' => array('offset' => '-300', 'daylight' => 'Daylight'),
'US Eastern' => array('offset' => '-300', 'daylight' => ''),
'Atlantic' => array('offset' => '-240', 'daylight' => 'Daylight'),
'SA Western' => array('offset' => '-240', 'daylight' => ''),
'Pacific SA' => array('offset' => '-240', 'daylight' => ''),
'Newfoundland' => array('offset' => '-210', 'daylight' => 'Daylight'),
'E. South America' => array('offset' => '-180', 'daylight' => 'Daylight'),
'SA Eastern' => array('offset' => '-180', 'daylight' => ''),
'Pacific SA' => array('offset' => '-180', 'daylight' => 'Daylight'),
'Mid-Atlantic' => array('offset' => '-120', 'daylight' => 'Daylight'),
'Azores' => array('offset' => '-060', 'daylight' => 'Daylight'),
'GMT' => array('offset' => '00', 'daylight' => 'Daylight'),
'Greenwich' => array('offset' => '00', 'daylight' => ''),
'W. Europe' => array('offset' => '60', 'daylight' => 'Daylight'),
'GTB' => array('offset' => '60', 'daylight' => 'Daylight'),
'Egypt' => array('offset' => '60', 'daylight' => 'Daylight'),
'E. Europe' => array('offset' => '60', 'daylight' => 'Daylight'),
'Romance' => array('offset' => '120', 'daylight' => 'Daylight'),
'Central Europe' => array('offset' => '120', 'daylight' => 'Daylight'),
'South Africa' => array('offset' => '120', 'daylight' => ''),
'Jerusalem' => array('offset' => '120', 'daylight' => 'Daylight'),
'Saudi Arabia' => array('offset' => '180', 'daylight' => ''),
/* Russion Regions */
'Russian/Kaliningrad' => array('offset' => '120', 'daylight' => '', 'cisco_code' => 'South Africa Standard Time'),
'Russian/Moscow' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
'Russian/St.Peterburg' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
'Russian/Samara' => array('offset' => '240', 'daylight' => '', 'cisco_code' => 'Arabian Standard Time'),
'Russian/Novosibirsk' => array('offset' => '300', 'daylight' => '', 'cisco_code' => 'Ekaterinburg Standard Time'),
'Russian/Ekaterinburg' => array('offset' => '300', 'daylight' => '', 'cisco_code' => 'Ekaterinburg Standard Time'),
'Russian/Irkutsk' => array('offset' => '480', 'daylight' => '', 'cisco_code' => 'China Standard Time'),
'Russian/Yakutsk' => array('offset' => '540', 'daylight' => '', 'cisco_code' => 'Tokyo Standard Time'),
'Russian/Khabarovsk' => array('offset' => '600', 'daylight' => '', 'cisco_code' => 'West Pacific Standard Time'),
'Russian/Vladivostok' => array('offset' => '600', 'daylight' => '', 'cisco_code' => 'West Pacific Standard Time'),
'Russian/Sakhalin' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'),
'Russian/Magadan' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'),
'Russian/Kamchatka' => array('offset' => '720', 'daylight' => '', 'cisco_code' => 'Fiji Standard Time'),
/* EnD - Russion Regions */
'Iran' => array('offset' => '210', 'daylight' => 'Daylight'),
'Caucasus' => array('offset' => '240', 'daylight' => 'Daylight'),
'Arabian' => array('offset' => '240', 'daylight' => ''),
'Afghanistan' => array('offset' => '270', 'daylight' => ''),
'West Asia' => array('offset' => '300', 'daylight' => ''),
'India' => array('offset' => '330', 'daylight' => ''),
'Central Asia' => array('offset' => '360', 'daylight' => ''),
'SE Asia' => array('offset' => '420', 'daylight' => ''),
'China' => array('offset' => '480', 'daylight' => ''),
'Taipei' => array('offset' => '480', 'daylight' => ''),
'Tokyo' => array('offset' => '540', 'daylight' => ''),
'Cen. Australia' => array('offset' => '570', 'daylight' => 'Daylight'),
'AUS Central' => array('offset' => '570', 'daylight' => ''),
'E. Australia' => array('offset' => '600', 'daylight' => ''),
'AUS Eastern' => array('offset' => '600', 'daylight' => 'Daylight'),
'West Pacific' => array('offset' => '600', 'daylight' => ''),
'Tasmania' => array('offset' => '600', 'daylight' => 'Daylight'),
'Central Pacific' => array('offset' => '660', 'daylight' => ''),
'Fiji' => array('offset' => '720', 'daylight' => ''),
'New Zealand' => array('offset' => '720', 'daylight' => 'Daylight')
);
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')
);
private $cisco_timezone = array(
'Dateline' => array('offset' => '-720', 'daylight' => ''),
'Samoa' => array('offset' => '-660', 'daylight' => ''),
'Hawaiian' => array('offset' => '-600', 'daylight' => ''),
'Alaskan' => array('offset' => '-540', 'daylight' => 'Daylight'),
'Pacific' => array('offset' => '-480', 'daylight' => 'Daylight'),
'Mountain' => array('offset' => '-420', 'daylight' => 'Daylight'),
'US Mountain' => array('offset' => '-420', 'daylight' => ''),
'Central' => array('offset' => '-360', 'daylight' => 'Daylight'),
'Mexico' => array('offset' => '-360', 'daylight' => 'Daylight'),
'Canada Central' => array('offset' => '-360', 'daylight' => ''),
'SA Pacific' => array('offset' => '-300', 'daylight' => ''),
'Eastern' => array('offset' => '-300', 'daylight' => 'Daylight'),
'US Eastern' => array('offset' => '-300', 'daylight' => ''),
'Atlantic' => array('offset' => '-240', 'daylight' => 'Daylight'),
'SA Western' => array('offset' => '-240', 'daylight' => ''),
'Pacific SA' => array('offset' => '-240', 'daylight' => ''),
'Newfoundland' => array('offset' => '-210', 'daylight' => 'Daylight'),
'E. South America' => array('offset' => '-180', 'daylight' => 'Daylight'),
'SA Eastern' => array('offset' => '-180', 'daylight' => ''),
'Pacific SA' => array('offset' => '-180', 'daylight' => 'Daylight'),
'Mid-Atlantic' => array('offset' => '-120', 'daylight' => 'Daylight'),
'Azores' => array('offset' => '-060', 'daylight' => 'Daylight'),
'GMT' => array('offset' => '00', 'daylight' => 'Daylight'),
'Greenwich' => array('offset' => '00', 'daylight' => ''),
'W. Europe' => array('offset' => '60', 'daylight' => 'Daylight'),
'GTB' => array('offset' => '60', 'daylight' => 'Daylight'),
'Egypt' => array('offset' => '60', 'daylight' => 'Daylight'),
'E. Europe' => array('offset' => '60', 'daylight' => 'Daylight'),
'Romance' => array('offset' => '120', 'daylight' => 'Daylight'),
'Central Europe' => array('offset' => '120', 'daylight' => 'Daylight'),
'South Africa' => array('offset' => '120', 'daylight' => ''),
'Jerusalem' => array('offset' => '120', 'daylight' => 'Daylight'),
'Saudi Arabia' => array('offset' => '180', 'daylight' => ''),
/* Russion Regions */
'Russian/Kaliningrad' => array('offset' => '120', 'daylight' => '', 'cisco_code' => 'South Africa Standard Time'),
'Russian/Moscow' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
'Russian/St.Peterburg' => array('offset' => '180', 'daylight' => '', 'cisco_code' => 'Russian Standard Time'),
'Russian/Samara' => array('offset' => '240', 'daylight' => '', 'cisco_code' => 'Arabian Standard Time'),
'Russian/Novosibirsk' => array('offset' => '300', 'daylight' => '', 'cisco_code' => 'Ekaterinburg Standard Time'),
'Russian/Ekaterinburg' => array('offset' => '300', 'daylight' => '', 'cisco_code' => 'Ekaterinburg Standard Time'),
'Russian/Irkutsk' => array('offset' => '480', 'daylight' => '', 'cisco_code' => 'China Standard Time'),
'Russian/Yakutsk' => array('offset' => '540', 'daylight' => '', 'cisco_code' => 'Tokyo Standard Time'),
'Russian/Khabarovsk' => array('offset' => '600', 'daylight' => '', 'cisco_code' => 'West Pacific Standard Time'),
'Russian/Vladivostok' => array('offset' => '600', 'daylight' => '', 'cisco_code' => 'West Pacific Standard Time'),
'Russian/Sakhalin' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'),
'Russian/Magadan' => array('offset' => '660', 'daylight' => '', 'cisco_code' => 'Central Pacific Standard Time'),
'Russian/Kamchatka' => array('offset' => '720', 'daylight' => '', 'cisco_code' => 'Fiji Standard Time'),
/* EnD - Russion Regions */
'Iran' => array('offset' => '210', 'daylight' => 'Daylight'),
'Caucasus' => array('offset' => '240', 'daylight' => 'Daylight'),
'Arabian' => array('offset' => '240', 'daylight' => ''),
'Afghanistan' => array('offset' => '270', 'daylight' => ''),
'West Asia' => array('offset' => '300', 'daylight' => ''),
'India' => array('offset' => '330', 'daylight' => ''),
'Central Asia' => array('offset' => '360', 'daylight' => ''),
'SE Asia' => array('offset' => '420', 'daylight' => ''),
'China' => array('offset' => '480', 'daylight' => ''),
'Taipei' => array('offset' => '480', 'daylight' => ''),
'Tokyo' => array('offset' => '540', 'daylight' => ''),
'Cen. Australia' => array('offset' => '570', 'daylight' => 'Daylight'),
'AUS Central' => array('offset' => '570', 'daylight' => ''),
'E. Australia' => array('offset' => '600', 'daylight' => ''),
'AUS Eastern' => array('offset' => '600', 'daylight' => 'Daylight'),
'West Pacific' => array('offset' => '600', 'daylight' => ''),
'Tasmania' => array('offset' => '600', 'daylight' => 'Daylight'),
'Central Pacific' => array('offset' => '660', 'daylight' => ''),
'Fiji' => array('offset' => '720', 'daylight' => ''),
'New Zealand' => array('offset' => '720', 'daylight' => 'Daylight')
);
}

View file

@ -1,27 +1,31 @@
<?php
/**
*
* Core Comsnd Interface
*
*
*/
/**
*
* Core Comsnd Interface
*
*
*/
/* !TODO!: Re-Indent this file */
namespace FreePBX\modules\Sccp_manager;
class srvinterface {
public function __construct() {
}
public function info() {
$Ver = '13.0.2';
return Array('Version' => $Ver,
'about' =>'Server interface data ver: '.$Ver);
}
/*
Core Access Function
*/
}
public function info() {
$Ver = '13.0.2';
return Array('Version' => $Ver,
'about' => 'Server interface data ver: ' . $Ver);
}
/*
Core Access Function
*/
public function sccp_core_commands($params = array()) {
global $astman;
$cmd_list = array('get_softkey' => array('cmd' => "sccp show softkeyssets", 'param' => ''),
@ -41,7 +45,7 @@ class srvinterface {
$id_param = $cmd_list[$id_cmd]['param'];
if (!empty($id_param)) {
if (!empty($params[$id_param])) {
$result = $astman->Command($cmd_list[$id_cmd]['cmd'] .' '. $params[$id_param]);
$result = $astman->Command($cmd_list[$id_cmd]['cmd'] . ' ' . $params[$id_param]);
}
} else {
$result = $astman->Command($cmd_list[$id_cmd]['cmd']);
@ -79,15 +83,15 @@ class srvinterface {
return array();
}
$res = $this->sccp_core_commands(array('cmd' => 'get_dev_info', 'name' => $dev_id));
$res1 = str_replace(array("\r\n", "\r", "\n"), ';', strip_tags((string)$res['data']));
if (strpos($res1,'MAC-Address')) {
$res2 = substr($res1,0,strpos($res1,'+--- Buttons '));
$res1 = explode(';',substr($res2,strpos($res2,'MAC-Address')));
foreach ($res1 as $data ){
$res1 = str_replace(array("\r\n", "\r", "\n"), ';', strip_tags((string) $res['data']));
if (strpos($res1, 'MAC-Address')) {
$res2 = substr($res1, 0, strpos($res1, '+--- Buttons '));
$res1 = explode(';', substr($res2, strpos($res2, 'MAC-Address')));
foreach ($res1 as $data) {
if (!empty($data)) {
$tmp = explode(':',$data);
$data_key =str_replace(array(" ", "-", "\t"), '_', trim($tmp[0]));
$res3[$data_key] =$tmp[1];
$tmp = explode(':', $data);
$data_key = str_replace(array(" ", "-", "\t"), '_', trim($tmp[0]));
$res3[$data_key] = $tmp[1];
}
}
@ -98,9 +102,9 @@ class srvinterface {
} else {
$res2 = '';
}
$res3['SCCP_Vendor']= Array('vendor' => strtok($res1,' '),'model' => strtok('('), 'model_id' => strtok(')'), 'vendor_addon' => strtok($res2,' '), 'model_addon' => strtok(' '));
if (empty($res3['SCCP_Vendor']['vendor']) || $res3['SCCP_Vendor']['vendor']=='Undefined'){
$res3['SCCP_Vendor']= Array('vendor' => 'Undefined','model' => $res4, 'model_id' => '', 'vendor_addon' => $res3['SCCP_Vendor']['vendor_addon'], 'model_addon' => $res3['SCCP_Vendor']['model_addon']);
$res3['SCCP_Vendor'] = Array('vendor' => strtok($res1, ' '), 'model' => strtok('('), 'model_id' => strtok(')'), 'vendor_addon' => strtok($res2, ' '), 'model_addon' => strtok(' '));
if (empty($res3['SCCP_Vendor']['vendor']) || $res3['SCCP_Vendor']['vendor'] == 'Undefined') {
$res3['SCCP_Vendor'] = Array('vendor' => 'Undefined', 'model' => $res4, 'model_id' => '', 'vendor_addon' => $res3['SCCP_Vendor']['vendor_addon'], 'model_addon' => $res3['SCCP_Vendor']['model_addon']);
// return $res4;
// return array();
}
@ -110,7 +114,8 @@ class srvinterface {
}
}
/* Current not use */
/* Current not use */
public function sccp_list_hints() {
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_hints'));
$ast_out = preg_split("/[\n]/", $ast_out['data']);
@ -136,11 +141,12 @@ class srvinterface {
return $ast_key;
}
/* !TODO!: install.php is still using the other version number*/
/* !TODO!: install.php is still using the other version number */
public function get_compatible_sccp() {
$res = $this-> getChanSCCPVersion();
$res = $this->getChanSCCPVersion();
if (empty($res)) {
$res = $this-> getChanSCCPVersion();
$res = $this->getChanSCCPVersion();
}
if (empty($res)) {
return 0;
@ -153,104 +159,105 @@ class srvinterface {
// return $res["vCode"];
}
/* !TODO!: Multiple Version functions (choose one)*/
/* !TODO!: private ? */
function getCoreSCCPVersion() {
$result = array();
/* !TODO!: Multiple Version functions (choose one) */
/* !TODO!: private ? */
function getCoreSCCPVersion() {
$result = array();
$ast_out = $this->sccp_version();
$result["Version"] = $ast_out[0];
$version_parts=explode(".", $ast_out[0]);
$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;
if (base_convert($ast_out[3],16,10) == base_convert('702487a',16,10)) { /* !TODO!: This does not work as you might expect */
if (base_convert($ast_out[3], 16, 10) == base_convert('702487a', 16, 10)) { /* !TODO!: This does not work as you might expect */
$result["vCode"] = 431;
}
if (base_convert($ast_out[3],16,10) >= "10403") { // new method, RevisionNum is incremental
$result["vCode"] = 432;
if (base_convert($ast_out[3], 16, 10) >= "10403") { // new method, RevisionNum is incremental
$result["vCode"] = 432;
}
}
return $result;
}
/* !TODO!: Old Method */
/* !TODO!: rename public - > private
private function sccp_version() {
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_version'));
if (preg_match("/Release.*\(/", $ast_out['data'] , $matches)) {
$ast_out = substr($matches[0],9,-1);
return explode(' ', $ast_out);
} else {
return aray('unknown');
}
}
private function sccp_version() {
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_version'));
if (preg_match("/Release.*\(/", $ast_out['data'] , $matches)) {
$ast_out = substr($matches[0],9,-1);
return explode(' ', $ast_out);
} else {
return aray('unknown');
}
}
/* !TODO!: Multiple Version functions (choose one :-)*/
/* !TODO!: private ? */
function getChanSCCPVersion() {
global $astman;
$result = array();
if (!$astman) {
/* !TODO!: Multiple Version functions (choose one :-) */
/* !TODO!: private ? */
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)) {
$result["RevisionNum"] = $metadata["RevisionNum"];
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;
}
$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)) {
$result["RevisionNum"]=$metadata["RevisionNum"];
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() {
$ast_out = $this->sccp_core_commands(array('cmd' => 'get_softkey'));
@ -308,28 +315,28 @@ class srvinterface {
list ($descr, $adress, $devname, $status, $token, $junk) = explode(";|", implode(";|", $line_arr));
// list ($descr, $adress, $devname, $status, $junk) = $line_arr;
// if (strlen($ast_key[$devname]) < 1) {
if (strlen($devname) > 1) {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token);
}
/*
if (isset($ast_key[$devname])) {
if (strlen($ast_key[$devname]) < 1) {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $descr);
}
} else {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token);
}
*
*/
/*
if (isset($ast_key[$devname])) {
if (strlen($ast_key[$devname]) < 1) {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $descr);
}
} else {
$ast_key[$devname] = Array('name' => $devname, 'status' => $status, 'address' => $adress, 'descr' => $descr, 'token' => $token);
}
*
*/
}
}
return $ast_key;
}
/*
* Replace sccp_core_commands($params = array()) {
*/
/*
* Replace sccp_core_commands($params = array()) {
*/
private function astman_retrieveJSFromMetaData($segment = "") {
global $astman;
@ -340,7 +347,7 @@ class srvinterface {
$response = $astman->send_request('SCCPConfigMetaData', $params);
if ($response["Response"] == "Success") {
//outn(_("JSON-content:").$response["JSON"]);
$decode=json_decode($response["JSON"], true);
$decode = json_decode($response["JSON"], true);
return $decode;
} else {
return false;

View file

@ -1,26 +1,30 @@
<?php
/**
*
* Core Comsnd Interface
*
*
*/
/**
*
* Core Comsnd Interface
*
*
*/
/* !TODO!: Would you like to use my XSD file to check if the provided template file is a correct cisco cnf.xml file ? */
namespace FreePBX\modules\Sccp_manager;
class xmlinterface {
private $val_null = 'NONE'; /// REPLACE to null Field
public function __construct() {
}
public function info() {
$Ver = '13.0.2';
return Array('Version' => $Ver,
'about' =>'Create XML data interface ver: '.$Ver);
}
}
function create_default_XML($data_path = '', $data_values= array(), $model_information =array(), $lang_info =array()) {
public function info() {
$Ver = '13.0.2';
return Array('Version' => $Ver,
'about' => 'Create XML data interface ver: ' . $Ver);
}
function create_default_XML($data_path = '', $data_values = array(), $model_information = array(), $lang_info = array()) {
if (empty($data_path) || empty($data_values)) {
return;
}
@ -112,16 +116,15 @@ class xmlinterface {
}
}
function create_SEP_XML($data_path = '', $data_values= array(), $dev_config = array(), $dev_id = '',$lang_info =array()) {
function create_SEP_XML($data_path = '', $data_values = array(), $dev_config = array(), $dev_id = '', $lang_info = array()) {
$var_xml_general_fields = array('authenticationURL' => 'dev_authenticationURL', 'informationURL' => 'dev_informationURL', 'messagesURL' => 'dev_messagesURL',
'servicesURL' => 'dev_servicesURL', 'directoryURL' => 'dev_directoryURL', 'proxyServerURL' => 'dev_proxyServerURL', 'idleTimeout' => 'dev_idleTimeout',
'idleURL' => 'dev_idleURL', 'sshUserId' => 'dev_sshUserId', 'sshPassword' => 'dev_sshPassword', 'deviceProtocol' => 'dev_deviceProtocol'
);
$var_xml_general_vars = array('capfAuthMode' => 'null', 'capfList'=> 'null', 'mobility' => 'null',
'phoneServices' =>'null', 'certHash' =>'null',
'deviceSecurityMode' => '1');
);
$var_xml_general_vars = array('capfAuthMode' => 'null', 'capfList' => 'null', 'mobility' => 'null',
'phoneServices' => 'null', 'certHash' => 'null',
'deviceSecurityMode' => '1');
if (empty($dev_id)) {
return false;
@ -168,7 +171,7 @@ class xmlinterface {
$xnode = &$xml_node->$dkey;
$tz_id = $data_values['ntp_timezone'];
$TZdata = $data_values['ntp_timezone_id'];
if (empty($TZdata)){
if (empty($TZdata)) {
$TZdata = array('offset' => '0', 'daylight' => '', 'cisco_code' => 'Greenwich Standard Time');
}
$xnode->name = $tz_id;
@ -189,36 +192,36 @@ class xmlinterface {
break;
}
$xnode = &$xml_node->$dkey;
$xnode -> name = $data_values['srst_Name'];
$xnode -> srstOption = $data_values['srst_Option'];
$xnode -> userModifiable = $data_values['srst_userModifiable'];
$xnode -> isSecure = $data_values['srst_isSecure'];
$xnode->name = $data_values['srst_Name'];
$xnode->srstOption = $data_values['srst_Option'];
$xnode->userModifiable = $data_values['srst_userModifiable'];
$xnode->isSecure = $data_values['srst_isSecure'];
$srst_fld = array('srst_ip' => array('ipAddr','port') );
$srst_fld = array('srst_ip' => array('ipAddr', 'port'));
// $srst_fld = array('srst_ip' => array('ipAddr','port') , 'srst_sip' => array('sipIpAddr','sipPort') );
foreach ($srst_fld as $srst_pro => $srs_put){
foreach ($srst_fld as $srst_pro => $srs_put) {
$srst_data = explode(';', $data_values[$srst_pro]);
$si = 1;
// $xnode['test'] = $srst_data[0];
foreach ($srst_data as $value) {
$srs_val = explode('/',$value);
$nod = $srs_put[0].$si;
$xnode -> $nod = $srs_val[0];
$nod = $srs_put[1].$si;
$xnode -> $nod = $srs_val[1];
$srs_val = explode('/', $value);
$nod = $srs_put[0] . $si;
$xnode->$nod = $srs_val[0];
$nod = $srs_put[1] . $si;
$xnode->$nod = $srs_val[1];
$si ++;
}
while ($si < 4) {
$nod = $srs_put[0].$si;
$xnode -> $nod = '';
$nod = $srs_put[1].$si;
$xnode -> $nod = '';
while ($si < 4) {
$nod = $srs_put[0] . $si;
$xnode->$nod = '';
$nod = $srs_put[1] . $si;
$xnode->$nod = '';
$si ++;
}
}
break;
case 'connectionMonitorDuration':
$xml_node->$dkey = strval(intval(intval($data_values['keepalive'])* 0.75));
$xml_node->$dkey = strval(intval(intval($data_values['keepalive']) * 0.75));
break;
case 'callManagerGroup':
$xnode = &$xml_node->$dkey->members;
@ -286,7 +289,7 @@ class xmlinterface {
} else {
$lang = (empty($hwlang[1])) ? $data_values['devlang'] : $hwlang[1];
}
if (($lang !='null') && (!empty(trim($lang)))) {
if (($lang != 'null') && (!empty(trim($lang)))) {
if ($key == 'networkLocale') {
$xml_work->$key = $lang;
} else {
@ -297,7 +300,7 @@ class xmlinterface {
}
}
} else {
$xml_work->$key ='';
$xml_work->$key = '';
}
break;
// Move all set to $var_xml_general_vars
@ -320,8 +323,6 @@ class xmlinterface {
return time();
}
private function replaceSimpleXmlNode($xml, $element = SimpleXMLElement) {
$dom = dom_import_simplexml($xml);
$import = $dom->ownerDocument->importNode(
@ -340,6 +341,4 @@ class xmlinterface {
$dom->parentNode->appendChild($import->cloneNode(true));
}
}

View file

@ -1,4 +1,5 @@
<?php
// vim: set ai ts=4 sw=4 ft=php:
// Version for SCCP Manager 13.0.0.A
namespace FreePBX\modules\Core\Drivers;

View file

@ -12,211 +12,197 @@ 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)) {
include(__DIR__ . "/Sccp_manager.inc/srvinterface.class.php");
}
if(class_exists($class,false)) {
if (class_exists($class, false)) {
$srvinterface = new $class();
}
function Get_DB_config($sccp_compatible) {
$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'),
'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)"),
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
$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'),
'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)"),
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
'transfer' => array('def_modify' => "on"),
'cfwdall' => array('def_modify' => "on"),
'cfwdbusy' => array('def_modify' => "on"),
'directrtp' => array('def_modify' => "off"),
'dndFeature' => array('def_modify' => "on"),
'earlyrtp' => array('def_modify' => "on"),
'audio_tos' => array('def_modify' => "0xB8"),
'audio_cos' => array('def_modify' => "6"),
'video_tos' => array('def_modify' => "0x88"),
'video_cos' => array('def_modify' => "5"),
'mwilamp' => array('def_modify' => "on"),
'mwioncall' => array('def_modify' => "on"),
'private' => array('def_modify' => "on"),
'privacy' => array('def_modify' => "off"),
'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)"),
'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`"),
'meetmenum' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
'meetmeopts' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
'regexten' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
'incominglimit' => array('def_modify' => "2"),
'transfer' => array('def_modify' => "on"),
'vmnum' => array('def_modify' => "*97"),
'musicclass' => array('def_modify' => "default"),
'echocancel' => array('def_modify' => "on"),
'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")
)
);
/* Old */
$db_config_v5 = 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(
'pickupexten' => array('rename' => "directed_pickup"),
'directed_pickup' => array('create' => "VARCHAR(5) NULL DEFAULT 'yes'"),
'pickupcontext' => array('rename' => "directed_pickup_context"),
'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"),
'pickupmodeanswer' => array('rename' => "directed_pickup_modeanswer"),
'directed_pickup_modeanswer' => array('create' => "VARCHAR(5) NULL DEFAULT 'yes'"),
'hwlang' => array('rename' => "_hwlang"),
'_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('drop' => "yes"),
'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)"),
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
'transfer' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
'cfwdall' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
'cfwdbusy' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
'directrtp' => array('create' => 'VARCHAR(3) DEFAULT "off"', 'modify' => "VARCHAR(3)", 'def_modify' => "off"),
'dndFeature' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
'earlyrtp' => array('create' => 'VARCHAR(10) DEFAULT "progress"', 'modify' => "VARCHAR(10)", 'def_modify' => "progress"),
'audio_tos' => array('def_modify' => "0xB8"),
'audio_cos' => array('def_modify' => "6"),
'video_tos' => array('def_modify' => "0x88"),
'video_cos' => array('def_modify' => "5"),
'trustphoneip' => array('drop' => "yes"),
'mwilamp' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
'mwioncall' => array('create' => 'VARCHAR(5) DEFAULT "off"', 'modify' => "VARCHAR(5)", 'def_modify' => "off"),
'private' => array('create' => 'VARCHAR(5) DEFAULT "on"', 'modify' => "VARCHAR(5)", 'def_modify' => "on"),
'privacy' => array('create' => 'VARCHAR(100) DEFAULT "full"', 'modify' => "VARCHAR(5)", 'def_modify' => "full"),
'nat' => array('create' => 'VARCHAR(7) DEFAULT "auto"', 'modify' => "VARCHAR(7)", 'def_modify' => "auto"),
'softkeyset' => array('def_modify' => "softkeyset")
),
'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`"),
'meetmenum' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
'meetmeopts' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
'regexten' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
'rtptos' => array('drop' => "yes"),
'audio_tos' => array('drop' => "yes"),
'audio_cos' => array('drop' => "yes"),
'video_tos' => array('drop' => "yes"),
'video_cos' => array('drop' => "yes"),
'incominglimit' => array('def_modify' => "2"),
'transfer' => array('def_modify' => "on"),
'vmnum' => array('def_modify' => "*97"),
'musicclass' => array('def_modify' => "default"),
'echocancel' => array('def_modify' => "on"),
'silencesuppression' => array('def_modify' => "off"),
'dnd' => array('create' => 'VARCHAR( 12 ) DEFAULT "reject" AFTER `amaflags`', 'modify' => "VARCHAR(12)", 'def_modify' => "reject")
)
);
'transfer' =>array('def_modify' => "on"),
'cfwdall' =>array('def_modify' => "on"),
'cfwdbusy' =>array('def_modify' => "on"),
'directrtp' =>array('def_modify' => "off"),
'dndFeature' =>array('def_modify' => "on"),
'earlyrtp' =>array('def_modify' => "on"),
'audio_tos'=>array('def_modify' => "0xB8"),
'audio_cos'=>array('def_modify' => "6"),
'video_tos'=>array('def_modify' => "0x88"),
'video_cos'=>array('def_modify' => "5"),
'mwilamp' =>array('def_modify' => "on"),
'mwioncall' =>array('def_modify' => "on"),
'private' =>array('def_modify' => "on"),
'privacy' =>array('def_modify' => "off"),
'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)"),
'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`"),
'meetmenum' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
'meetmeopts' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
'regexten' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
'incominglimit' =>array('def_modify' => "2"),
'transfer' =>array('def_modify' => "on"),
'vmnum' =>array('def_modify' => "*97"),
'musicclass' =>array('def_modify' => "default"),
'echocancel' =>array('def_modify' => "on"),
'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")
)
);
/* Old */
$db_config_v5 = 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(
'pickupexten' => array('rename' => "directed_pickup"),
'directed_pickup' => array('create' => "VARCHAR(5) NULL DEFAULT 'yes'"),
'pickupcontext' => array('rename' => "directed_pickup_context"),
'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"),
'pickupmodeanswer' => array('rename' => "directed_pickup_modeanswer"),
'directed_pickup_modeanswer' => array('create' => "VARCHAR(5) NULL DEFAULT 'yes'"),
'hwlang' => array('rename' => "_hwlang"),
'_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('drop' => "yes"),
'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)"),
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
'transfer' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
'cfwdall' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
'cfwdbusy' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
'directrtp' =>array('create' => 'VARCHAR(3) DEFAULT "off"','modify' => "VARCHAR(3)",'def_modify' => "off"),
'dndFeature' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
'earlyrtp' =>array('create' => 'VARCHAR(10) DEFAULT "progress"','modify' => "VARCHAR(10)",'def_modify' => "progress"),
'audio_tos' =>array('def_modify' => "0xB8"),
'audio_cos' =>array('def_modify' => "6"),
'video_tos' =>array('def_modify' => "0x88"),
'video_cos' =>array('def_modify' => "5"),
'trustphoneip'=>array('drop' => "yes"),
'mwilamp' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
'mwioncall' =>array('create' => 'VARCHAR(5) DEFAULT "off"','modify' => "VARCHAR(5)",'def_modify' => "off"),
'private' =>array('create' => 'VARCHAR(5) DEFAULT "on"','modify' => "VARCHAR(5)",'def_modify' => "on"),
'privacy' =>array('create' => 'VARCHAR(100) DEFAULT "full"','modify' => "VARCHAR(5)",'def_modify' => "full"),
'nat' =>array('create' => 'VARCHAR(7) DEFAULT "auto"','modify' => "VARCHAR(7)",'def_modify' => "auto"),
'softkeyset' =>array('def_modify' => "softkeyset")
),
'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`"),
'meetmenum' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
'meetmeopts' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
'regexten' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
'rtptos' => array('drop' => "yes"),
'audio_tos' => array('drop' => "yes"),
'audio_cos' => array('drop' => "yes"),
'video_tos' => array('drop' => "yes"),
'video_cos' => array('drop' => "yes"),
'incominglimit' =>array('def_modify' => "2"),
'transfer' =>array('def_modify' => "on"),
'vmnum' =>array('def_modify' => "*97"),
'musicclass' =>array('def_modify' => "default"),
'echocancel' =>array('def_modify' => "on"),
'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'"),
'nametemplate' => array('create' => 'VARCHAR(50) NULL DEFAULT NULL'),
'loadinformationid' => array('create' => "VARCHAR(30) NULL DEFAULT NULL" )
),
'sccpdevice' => array(
'pickupexten' => array('rename' => "directed_pickup"),
'directed_pickup' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'pickupcontext' => array('rename' => "directed_pickup_context"),
'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"),
'pickupmodeanswer' => array('rename' => "directed_pickup_modeanswer"),
'directed_pickup_modeanswer' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'hwlang' => array('rename' => "_hwlang"),
'_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('drop' => "yes"),
'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)"),
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL','modify' => "VARCHAR(255)"),
'transfer' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'cfwdall' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'cfwdbusy' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'directrtp' =>array('create' => "enum('on','off') NULL default NULL",'modify' => "enum('on','off')"),
'dndFeature' =>array('create' => "enum('on','off') NULL default NULL",'modify' => "enum('on','off')"),
'earlyrtp' =>array('create' => "ENUM('immediate','offHook','dialing','ringout','progress','none') NULL default NULL",'modify' => "ENUM('immediate','offHook','dialing','ringout','progress','none')"),
'audio_tos'=>array('def_modify' => "0xB8"),
'audio_cos'=>array('def_modify' => "6"),
'video_tos'=>array('def_modify' => "0x88"),
'video_cos'=>array('def_modify' => "5"),
'trustphoneip'=>array('drop' => "yes"),
'mwilamp' =>array('create' => "enum('on','off','wink','flash','blink') NULL default 'on'" ,'modify' => "enum('on','off','wink','flash','blink')"),
'mwioncall' =>array('create' => "enum('on','off') NULL default 'on'",'modify' => "enum('on','off')"),
'private' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"), // Что-то лишенне
'privacy' =>array('create' => "enum('full','on','off') NOT NULL default 'full'",'modify' => "enum('full','on','off')"), // Что-то лишенне
'nat' =>array('create' => "enum('on','off','auto') NULL default NULL",'modify' => "enum('on','off','auto')"),
'conf_allow' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'conf_play_part_announce' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'conf_mute_on_entry' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
'conf_show_conflist' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'type' =>array('create' => 'VARCHAR(15) NULL DEFAULT NULL','modify' => "VARCHAR(15)"),
'imageversion' =>array('create' => 'VARCHAR(31) NULL DEFAULT NULL','modify' => "VARCHAR(31)"),
'softkeyset' =>array('def_modify' => "softkeyset")
),
'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`"),
'meetmenum' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
'meetmeopts' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
'regexten' =>array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
'rtptos' => array('drop' => "yes"),
'audio_tos' => array('drop' => "yes"),
'audio_cos' => array('drop' => "yes"),
'video_tos' => array('drop' => "yes"),
'video_cos' => array('drop' => "yes"),
'incominglimit' =>array('create' => "INT(11) DEFAULT '6'", 'modify' =>'INT(11)', 'def_modify' => "6"),
'transfer' =>array('create' => "enum('on','off') NOT NULL default 'on'",'modify' => "enum('on','off')"),
'vmnum' =>array('def_modify' => "*97"),
'musicclass' =>array('def_modify' => "default"),
'id' =>array('create' => 'MEDIUMINT(9) NOT NULL AUTO_INCREMENT, ADD UNIQUE(id);', 'modify' => "MEDIUMINT(9)",'index' =>'id'),
$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")
),
'sccpdevice' => array(
'pickupexten' => array('rename' => "directed_pickup"),
'directed_pickup' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'pickupcontext' => array('rename' => "directed_pickup_context"),
'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"),
'pickupmodeanswer' => array('rename' => "directed_pickup_modeanswer"),
'directed_pickup_modeanswer' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'hwlang' => array('rename' => "_hwlang"),
'_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('drop' => "yes"),
'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)"),
'ringtone' => array('create' => 'VARCHAR(255) NULL DEFAULT NULL', 'modify' => "VARCHAR(255)"),
'transfer' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'cfwdall' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'cfwdbusy' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'directrtp' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"),
'dndFeature' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"),
'earlyrtp' => array('create' => "ENUM('immediate','offHook','dialing','ringout','progress','none') NULL default NULL", 'modify' => "ENUM('immediate','offHook','dialing','ringout','progress','none')"),
'audio_tos' => array('def_modify' => "0xB8"),
'audio_cos' => array('def_modify' => "6"),
'video_tos' => array('def_modify' => "0x88"),
'video_cos' => array('def_modify' => "5"),
'trustphoneip' => array('drop' => "yes"),
'mwilamp' => array('create' => "enum('on','off','wink','flash','blink') NULL default 'on'", 'modify' => "enum('on','off','wink','flash','blink')"),
'mwioncall' => array('create' => "enum('on','off') NULL default 'on'", 'modify' => "enum('on','off')"),
'private' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"), // Что-то лишенне
'privacy' => array('create' => "enum('full','on','off') NOT NULL default 'full'", 'modify' => "enum('full','on','off')"), // Что-то лишенне
'nat' => array('create' => "enum('on','off','auto') NULL default NULL", 'modify' => "enum('on','off','auto')"),
'conf_allow' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'conf_play_part_announce' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'conf_mute_on_entry' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'conf_show_conflist' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'type' => array('create' => 'VARCHAR(15) NULL DEFAULT NULL', 'modify' => "VARCHAR(15)"),
'imageversion' => array('create' => 'VARCHAR(31) NULL DEFAULT NULL', 'modify' => "VARCHAR(31)"),
'softkeyset' => array('def_modify' => "softkeyset")
),
'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`"),
'meetmenum' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetme`"),
'meetmeopts' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmenum`"),
'regexten' => array('create' => "VARCHAR(45) NULL DEFAULT NULL AFTER `meetmeopts`"),
'rtptos' => array('drop' => "yes"),
'audio_tos' => array('drop' => "yes"),
'audio_cos' => array('drop' => "yes"),
'video_tos' => array('drop' => "yes"),
'video_cos' => array('drop' => "yes"),
'incominglimit' => array('create' => "INT(11) DEFAULT '6'", 'modify' => 'INT(11)', 'def_modify' => "6"),
'transfer' => array('create' => "enum('on','off') NOT NULL default 'on'", 'modify' => "enum('on','off')"),
'vmnum' => array('def_modify' => "*97"),
'musicclass' => array('def_modify' => "default"),
'id' => array('create' => 'MEDIUMINT(9) NOT NULL AUTO_INCREMENT, ADD UNIQUE(id);', 'modify' => "MEDIUMINT(9)", 'index' => 'id'),
// 'id' =>array('create' => 'VARCHAR( 20 ) NULL DEFAULT NULL', 'modify' => "VARCHAR(20)", 'def_modify' =>"NULL"),
'echocancel' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
'silencesuppression' =>array('create' => "enum('on','off') NOT NULL default 'off'",'modify' => "enum('on','off')"),
'dnd' => array('create' => "enum('off','reject','silent','user') NOT NULL default 'reject'", 'modify' => "enum('off','reject','silent','user')", 'def_modify' =>"reject")
)
);
'echocancel' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'silencesuppression' => array('create' => "enum('on','off') NOT NULL default 'off'", 'modify' => "enum('on','off')"),
'dnd' => array('create' => "enum('off','reject','silent','user') NOT NULL default 'reject'", 'modify' => "enum('off','reject','silent','user')", 'def_modify' => "reject")
)
);
if ($sccp_compatible >= 430) {
return $db_config_v3;
} else {
@ -242,16 +228,17 @@ function CheckSCCPManagerDBTables($table_req) {
//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");
die_freepbx("!!!! Installation error: Can not find required " . $value . " table !!!!!!\n");
}
}
}
/* notused */
function CheckPermissions() {
outn("<li>" . _("Checking Filesystem Permissions") . "</li>");
$dst = $_SERVER['DOCUMENT_ROOT'] . '/admin/modules/sccp_manager/views';
if (fileowner($_SERVER['DOCUMENT_ROOT']) != fileowner($dst)){
if (fileowner($_SERVER['DOCUMENT_ROOT']) != fileowner($dst)) {
die_freepbx('Please (re-)check permissions by running "amportal chown. Installation Failed"');
}
}
@ -276,7 +263,7 @@ function CheckAsteriskVersion() {
}
function CheckChanSCCPCompatible() {
global $srvinterface,$astman;
global $srvinterface, $astman;
if (!$astman) {
ie_freepbx('No asterisk manager connection provided!. Installation Failed');
}
@ -285,7 +272,6 @@ function CheckChanSCCPCompatible() {
return $sccp_compatible;
}
function InstallDB_sccpsettings() {
global $db;
outn("<li>" . _("Creating sccpsettings table...") . "</li>");
@ -334,58 +320,58 @@ function InstallDB_updateSchema($db_config) {
outn("<li>" . _("Modify Database schema") . "</li>");
foreach ($db_config as $tabl_name => &$tab_modify) {
// 0 - name 1-type 4- default
$sql = "DESCRIBE ".$tabl_name."";
$db_result= $db->getAll($sql);
$sql = "DESCRIBE " . $tabl_name . "";
$db_result = $db->getAll($sql);
if (DB::IsError($db_result)) {
die_freepbx("Can not add get informations from ".$tabl_name." table\n");
die_freepbx("Can not add get informations from " . $tabl_name . " table\n");
}
foreach ($db_result as $tabl_data){
foreach ($db_result as $tabl_data) {
$fld_id = $tabl_data[0];
if (!empty($tab_modify[$fld_id])) {
$db_config[$tabl_name][$fld_id]['status'] = 'yes';
$db_config[$tabl_name][$fld_id]['status'] = 'yes';
if (!empty($tab_modify[$fld_id]['def_modify'])) {
if (strtoupper($tab_modify[$fld_id]['def_modify']) == strtoupper($tabl_data[4])) {
$db_config[$tabl_name][$fld_id]['def_mod_stat'] = 'no';
if (strtoupper($tab_modify[$fld_id]['def_modify']) == strtoupper($tabl_data[4])) {
$db_config[$tabl_name][$fld_id]['def_mod_stat'] = 'no';
}
}
if (!empty($tab_modify[$fld_id]['modify'])) {
if ( strtoupper ($tab_modify[$fld_id]['modify']) == strtoupper($tabl_data[1])) {
$db_config[$tabl_name][$fld_id]['mod_stat'] = 'no';
if (strtoupper($tab_modify[$fld_id]['modify']) == strtoupper($tabl_data[1])) {
$db_config[$tabl_name][$fld_id]['mod_stat'] = 'no';
}
}
if (!empty($tab_modify[$fld_id]['rename'])) {
$fld_id_source = $tab_modify[$fld_id]['rename'];
$db_config[$tabl_name][$fld_id_source]['status'] = 'yes';
$db_config[$tabl_name][$fld_id]['create'] = $db_config[$tabl_name][$fld_id_source]['create'];
$db_config[$tabl_name][$fld_id_source]['status'] = 'yes';
$db_config[$tabl_name][$fld_id]['create'] = $db_config[$tabl_name][$fld_id_source]['create'];
}
}
}
$sql_create ='';
$sql_modify ='';
$sql_update ='';
$sql_create = '';
$sql_modify = '';
$sql_update = '';
foreach ($tab_modify as $row_fld => $row_data){
foreach ($tab_modify as $row_fld => $row_data) {
if (empty($row_data['status'])) {
if (!empty($row_data['create'])) {
$sql_create .='ADD COLUMN `'.$row_fld.'` '. $row_data['create'].', ';
$sql_create .= 'ADD COLUMN `' . $row_fld . '` ' . $row_data['create'] . ', ';
$count_modify ++;
}
} else {
if (!empty($row_data['rename'])) {
$sql_modify .= 'CHANGE COLUMN `'.$row_fld.'` `'. $row_data['rename'].'` '.$row_data['create'].', ';
$sql_modify .= 'CHANGE COLUMN `' . $row_fld . '` `' . $row_data['rename'] . '` ' . $row_data['create'] . ', ';
$count_modify ++;
}
if (!empty($row_data['modify'])) {
if (empty($row_data['mod_stat'])) {
if (!empty($row_data['create'])) {
// $sql_modify .= "CHANGE COLUMN `".$row_fld."` `".$row_fld."` ".$row_data['create'].", ";
$sql_modify .= "MODIFY COLUMN `".$row_fld."` ".$row_data['create'].", ";
$sql_modify .= "MODIFY COLUMN `" . $row_fld . "` " . $row_data['create'] . ", ";
} else {
// $sql_modify .= "CHANGE COLUMN `".$row_fld."` `".$row_fld."` ".$row_data['modify']." DEFAULT '".$row_data['def_modify']."', ";
$sql_modify .= "MODIFY COLUMN `".$row_fld."` ".$row_data['modify']." DEFAULT '".$row_data['def_modify']."', ";
$sql_modify .= "MODIFY COLUMN `" . $row_fld . "` " . $row_data['modify'] . " DEFAULT '" . $row_data['def_modify'] . "', ";
}
if (strpos($row_data['modify'],'enum') !== false ) {
$sql_update .= "UPDATE ".$tabl_name." set `".$row_fld."`=case when lower(`".$row_fld."`) in ('yes','true','1') then 'on' when lower(`".$row_fld."`) in ('no', 'false', '0') then 'off' else `".$row_fld."` end; ";
if (strpos($row_data['modify'], 'enum') !== false) {
$sql_update .= "UPDATE " . $tabl_name . " set `" . $row_fld . "`=case when lower(`" . $row_fld . "`) in ('yes','true','1') then 'on' when lower(`" . $row_fld . "`) in ('no', 'false', '0') then 'off' else `" . $row_fld . "` end; ";
}
$row_data['def_mod_stat'] = 'no';
$count_modify ++;
@ -393,24 +379,23 @@ function InstallDB_updateSchema($db_config) {
}
if (!empty($row_data['def_modify'])) {
if (empty($row_data['def_mod_stat'])) {
$sql_modify .= "ALTER COLUMN `".$row_fld."` SET DEFAULT '".$row_data['def_modify']."', ";
$sql_modify .= "ALTER COLUMN `" . $row_fld . "` SET DEFAULT '" . $row_data['def_modify'] . "', ";
$count_modify ++;
}
}
if (!empty($row_data['drop'])) {
$sql_create .='DROP COLUMN `'.$row_fld.'`, ';
$sql_create .= 'DROP COLUMN `' . $row_fld . '`, ';
$count_modify ++;
}
}
}
if (!empty($sql_update)) {
$sql_update = 'BEGIN; '.$sql_update.' COMMIT;';
$sql_update = 'BEGIN; ' . $sql_update . ' COMMIT;';
sql($sql_update);
$affected_rows = $db->affectedRows();
// $check = $db->query($sql_update);
// $db->closeCursor();
outn("<li>" . _("Update table row :").$affected_rows. "</li>");
outn("<li>" . _("Update table row :") . $affected_rows . "</li>");
// if (db::IsError($check)) {
// die_freepbx("Can not update ".$tabl_name." table sql: ".$sql_update."n");
// die_freepbx("Can not update ".$tabl_name." table\n");
@ -418,26 +403,26 @@ function InstallDB_updateSchema($db_config) {
}
if (!empty($sql_create)) {
outn("<li>" . _("Create New table"). "</li>");
$sql_create = "ALTER TABLE `".$tabl_name."` ". substr($sql_create,0,-2);
outn("<li>" . _("Create New table") . "</li>");
$sql_create = "ALTER TABLE `" . $tabl_name . "` " . substr($sql_create, 0, -2);
$check = $db->query($sql_create);
if (db::IsError($check)) {
die_freepbx("Can not create ".$tabl_name." table sql: ".$sql_create."n");
die_freepbx("Can not create " . $tabl_name . " table sql: " . $sql_create . "n");
}
}
if (!empty($sql_modify)) {
outn("<li>" . _("Modify table"). "</li>");
outn("<li>" . _("Modify table") . "</li>");
$sql_modify = "ALTER TABLE `".$tabl_name."` ". substr($sql_modify,0,-2).';';
$sql_modify = "ALTER TABLE `" . $tabl_name . "` " . substr($sql_modify, 0, -2) . ';';
$check = $db->query($sql_modify);
if (db::IsError($check)) {
out("<li>" . print_r($check,1). "</li>");
die("Can not modify ".$tabl_name." table sql: ".$sql_modify."n");
die_freepbx("Can not modify ".$tabl_name." table sql: ".$sql_modify."n");
out("<li>" . print_r($check, 1) . "</li>");
die("Can not modify " . $tabl_name . " table sql: " . $sql_modify . "n");
die_freepbx("Can not modify " . $tabl_name . " table sql: " . $sql_modify . "n");
}
}
}
outn("<li>" . _("Total modify count :") .$count_modify. "</li>");
outn("<li>" . _("Total modify count :") . $count_modify . "</li>");
return true;
}
@ -445,11 +430,11 @@ 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), " .
"('7916,7916', 'CISCO', 0, 48, 'B016-1-0-4', 'loadInformation230', 1, NULL), ('7920', 'CISCO', 1, 1, 'cmterm_7920.4.0-03-02', 'loadInformation30002', 0, NULL), ('7921', 'CISCO', 1, 1, 'CP7921G-1.4.1SR1', 'loadInformation365', 0, NULL),('7925', 'CISCO', 1, 6, 'CP7925G-1.4.1SR1', 'loadInformation484', 0, NULL), ('7926', 'CISCO', 1, 1, 'CP7926G-1.4.1SR1', 'loadInformation557', 0, NULL), ('7931', 'CISCO', 1, 34, 'SCCP31.9-2-1S', 'loadInformation348', 0, NULL), ('7935', 'CISCO', 1, 2, 'P00503021900', 'loadInformation9', 0, NULL), ('7936', 'CISCO', 1, 1, 'cmterm_7936.3-3-21-0', 'loadInformation30019', 0, NULL), ('7937', 'CISCO', 1, 1, 'apps37sccp.1-4-4-0', 'loadInformation431', 0, 'SEP0000000000.cnf.xml_7937_template'), ('7940', 'CISCO', 1, 2, 'P0030801SR02', 'loadInformation8', 1, 'SEP0000000000.cnf.xml_796x_template'), " .
"('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);";
"('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), " .
"('7916,7916', 'CISCO', 0, 48, 'B016-1-0-4', 'loadInformation230', 1, NULL), ('7920', 'CISCO', 1, 1, 'cmterm_7920.4.0-03-02', 'loadInformation30002', 0, NULL), ('7921', 'CISCO', 1, 1, 'CP7921G-1.4.1SR1', 'loadInformation365', 0, NULL),('7925', 'CISCO', 1, 6, 'CP7925G-1.4.1SR1', 'loadInformation484', 0, NULL), ('7926', 'CISCO', 1, 1, 'CP7926G-1.4.1SR1', 'loadInformation557', 0, NULL), ('7931', 'CISCO', 1, 34, 'SCCP31.9-2-1S', 'loadInformation348', 0, NULL), ('7935', 'CISCO', 1, 2, 'P00503021900', 'loadInformation9', 0, NULL), ('7936', 'CISCO', 1, 1, 'cmterm_7936.3-3-21-0', 'loadInformation30019', 0, NULL), ('7937', 'CISCO', 1, 1, 'apps37sccp.1-4-4-0', 'loadInformation431', 0, 'SEP0000000000.cnf.xml_7937_template'), ('7940', 'CISCO', 1, 2, 'P0030801SR02', 'loadInformation8', 1, 'SEP0000000000.cnf.xml_796x_template'), " .
"('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 create sccpdevmodel table, error:$check\n");
@ -497,8 +482,8 @@ function InstallDB_CreateSccpDeviceConfigView($sccp_compatible) {
global $db;
outn("<li>" . _("(Re)Create sccpdeviceconfig view") . "</li>");
$sql = "";
if ($sccp_compatible < 431) {
$sql= "
if ($sccp_compatible < 431) {
$sql = "
CREATE OR REPLACE
ALGORITHM = MERGE
VIEW sccpdeviceconfig AS
@ -545,10 +530,10 @@ function Setup_RealTime() {
$cnf_int = \FreePBX::Config();
$cnf_wr = \FreePBX::WriteConfig();
$cnf_read = \FreePBX::LoadConfig();
$def_config =array('sccpdevice' => 'mysql,sccp,sccpdeviceconfig','sccpline' => ' mysql,sccp,sccpline');
$def_config = array('sccpdevice' => 'mysql,sccp,sccpdeviceconfig', 'sccpline' => ' mysql,sccp,sccpline');
$def_bd_config = array('dbhost' => $amp_conf['AMPDBHOST'], 'dbname' => $amp_conf['AMPDBNAME'],
'dbuser' => $amp_conf['AMPDBUSER'], 'dbpass' => $amp_conf['AMPDBPASS'],
'dbport' => '3306', 'dbsock' => '/var/lib/mysql/mysql.sock');
'dbuser' => $amp_conf['AMPDBUSER'], 'dbpass' => $amp_conf['AMPDBPASS'],
'dbport' => '3306', 'dbsock' => '/var/lib/mysql/mysql.sock');
$def_bd_sec = 'sccp';
$dir = $cnf_int->get('ASTETCDIR');
@ -556,7 +541,7 @@ function Setup_RealTime() {
$res_conf_old = '';
$res_conf = '';
$ext_conf = '';
if (file_exists($dir. '/extconfig.conf')) {
if (file_exists($dir . '/extconfig.conf')) {
$ext_conf = $cnf_read->getConfig('extconfig.conf');
}
@ -564,44 +549,43 @@ function Setup_RealTime() {
$tmp = array();
if (!empty($ext_conf['settings']['sccpdevice'])) {
$tmp = explode(',', $ext_conf['settings']['sccpdevice']);
$def_config['sccpdevice']=$ext_conf['settings']['sccpdevice'];
$def_config['sccpdevice'] = $ext_conf['settings']['sccpdevice'];
}
if (!empty($ext_conf['settings']['sccpline'])) {
if (empty($tmp)){
if (empty($tmp)) {
$tmp = explode(',', $ext_conf['settings']['sccpline']);
$tmp[2] ='sccpdevice';
$def_config['sccpdevice']= implode(',', $tmp);
$tmp[2] = 'sccpdevice';
$def_config['sccpdevice'] = implode(',', $tmp);
}
$def_config['sccpline']=$ext_conf['settings']['sccpline'];
$def_config['sccpline'] = $ext_conf['settings']['sccpline'];
}
if (!empty($tmp)){
if (!empty($tmp)) {
$def_bd_sec = $tmp[1];
}
}
$ext_conf['settings']['sccpdevice'] = $def_config['sccpdevice'];
$ext_conf['settings']['sccpline'] = $def_config['sccpline'];
if (file_exists($dir. '/res_mysql.conf')) {
if (file_exists($dir . '/res_mysql.conf')) {
$res_conf = $cnf_read->getConfig('res_mysql.conf');
if (empty($res_conf[$def_bd_sec])) {
$res_conf[$def_bd_sec] = $def_bd_config;
}
$cnf_wr -> writeConfig('res_mysql.conf', $res_conf,false);
$cnf_wr->writeConfig('res_mysql.conf', $res_conf, false);
}
if (file_exists($dir. '/res_config_mysql.conf')) {
if (file_exists($dir . '/res_config_mysql.conf')) {
$res_conf = $cnf_read->getConfig('res_config_mysql.conf');
if (empty($res_conf_old[$def_bd_sec])) {
$res_conf[$def_bd_sec] = $def_bd_config;
}
$cnf_wr -> writeConfig('res_config_mysql.conf', $res_conf,false);
$cnf_wr->writeConfig('res_config_mysql.conf', $res_conf, false);
}
if (empty($res_conf)) {
$res_conf[$def_bd_sec] = $def_bd_config;
$res_conf['general']['dbsock'] = $res_conf[$def_bd_sec]['dbsock'];
$cnf_wr -> writeConfig('res_config_mysql.conf', $res_conf,false);
$cnf_wr->writeConfig('res_config_mysql.conf', $res_conf, false);
}
$cnf_wr -> writeConfig('extconfig.conf', $ext_conf,false);
$cnf_wr->writeConfig('extconfig.conf', $ext_conf, false);
}
CheckSCCPManagerDBTables($table_req);