Modify installer
Change load sequence Delegate table creation to module.xml Correct module.xml tables Correct timezone typo
This commit is contained in:
parent
1c78d23df8
commit
f4927793ee
238
install.php
238
install.php
|
@ -6,20 +6,81 @@ if (!defined('FREEPBX_IS_AUTH')) {
|
|||
|
||||
global $db;
|
||||
global $amp_conf;
|
||||
global $astman;
|
||||
global $version;
|
||||
global $aminterface;
|
||||
global $mobile_hw;
|
||||
global $useAmiForSoftKeys;
|
||||
$mobile_hw = '0';
|
||||
$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT" : "AUTO_INCREMENT";
|
||||
$table_req = array('sccpdevice', 'sccpline', 'sccpsettings');
|
||||
$sccp_compatible = 0;
|
||||
$chanSCCPWarning = true;
|
||||
$db_config = '';
|
||||
$sccp_version = array();
|
||||
|
||||
CheckSCCPManagerDBTables($table_req);
|
||||
CheckAsteriskVersion();
|
||||
|
||||
// Have essential tables so can create Sccp_manager object and verify have aminterface
|
||||
$ss = FreePBX::create()->Sccp_manager;
|
||||
|
||||
$class = "\\FreePBX\\Modules\\Sccp_manager\\aminterface";
|
||||
if (!class_exists($class, false)) {
|
||||
include(__DIR__ . "/Sccp_manager.inc/aminterface.class.php");
|
||||
include(__DIR__ . "/sccpManClasses/aminterface.class.php");
|
||||
}
|
||||
if (class_exists($class, false)) {
|
||||
$aminterface = new $class();
|
||||
}
|
||||
|
||||
$sccp_version = CheckChanSCCPCompatible();
|
||||
$sccp_compatible = $sccp_version[0];
|
||||
$chanSCCPWarning = $sccp_version[1] ^= 1;
|
||||
outn("<li>" . _("Sccp model Compatible code : ") . $resultReturned[0] . "</li>");
|
||||
if ($sccp_compatible == 0) {
|
||||
outn("<br>");
|
||||
outn("<font color='red'>Chan Sccp not Found. Install it before continuing !</font>");
|
||||
die();
|
||||
}
|
||||
$db_config = Get_DB_config($sccp_compatible);
|
||||
$sccp_db_ver = CheckSCCPManagerDBVersion();
|
||||
|
||||
// BackUp Old config
|
||||
CreateBackUpConfig();
|
||||
RenameConfig();
|
||||
|
||||
InstallDB_updateSchema($db_config);
|
||||
$stmt = $db->prepare('SELECT CASE WHEN EXISTS(SELECT 1 FROM sccpdevmodel) THEN 0 ELSE 1 END AS IsEmpty;');
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
if ($result[0]['IsEmpty']) {
|
||||
outn("Populating sccpdevmodel...");
|
||||
InstallDB_fillsccpdevmodel();
|
||||
}
|
||||
if (!$sccp_db_ver) {
|
||||
InstallDB_updateSccpDevice();
|
||||
} else {
|
||||
outn("Skip update Device model");
|
||||
}
|
||||
|
||||
InstallDB_createButtonConfigTrigger();
|
||||
InstallDB_CreateSccpDeviceConfigView($sccp_compatible);
|
||||
InstallDB_updateDBVer($sccp_compatible);
|
||||
if ($chanSCCPWarning) {
|
||||
outn("<br>");
|
||||
outn("<font color='red'>Error: installed version of chan-sccp is not compatible. Please upgrade chan-sccp</font>");
|
||||
}
|
||||
if (!$sccp_db_ver) {
|
||||
Setup_RealTime();
|
||||
outn("<br>");
|
||||
outn("Install Complete !");
|
||||
} else {
|
||||
outn("<br>");
|
||||
outn("Update Complete !");
|
||||
}
|
||||
outn("<br>");
|
||||
|
||||
// Functions follow
|
||||
|
||||
function Get_DB_config($sccp_compatible)
|
||||
{
|
||||
global $mobile_hw;
|
||||
|
@ -161,26 +222,15 @@ function Get_DB_config($sccp_compatible)
|
|||
}
|
||||
}
|
||||
|
||||
$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT" : "AUTO_INCREMENT";
|
||||
|
||||
$table_req = array('sccpdevice', 'sccpline');
|
||||
$ss = FreePBX::create()->Sccp_manager;
|
||||
$astman = FreePBX::create()->astman;
|
||||
$sccp_compatible = 0;
|
||||
$chanSCCPWarning = true;
|
||||
//$db_config = $db_config_v0;
|
||||
$db_config = '';
|
||||
|
||||
function CheckSCCPManagerDBTables($table_req)
|
||||
{
|
||||
// These tables should already exist having been created by FreePBX through module.xml
|
||||
global $amp_conf;
|
||||
global $astman;
|
||||
global $db;
|
||||
outn("<li>" . _("Checking for Sccp_manager database tables..") . "</li>");
|
||||
outn("<li>" . _("Checking for required 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);
|
||||
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");
|
||||
|
@ -239,100 +289,11 @@ function CheckAsteriskVersion()
|
|||
function CheckChanSCCPCompatible()
|
||||
{
|
||||
global $chanSCCPWarning;
|
||||
global $aminterface, $astman;
|
||||
if (!$astman) {
|
||||
ie_freepbx('No asterisk manager connection provided!. Installation Failed');
|
||||
}
|
||||
global $aminterface;
|
||||
// calling with true returns array with compatibility and RevisionNumber
|
||||
return $aminterface->get_compatible_sccp(true);
|
||||
}
|
||||
|
||||
function InstallDB_Buttons()
|
||||
{
|
||||
global $db;
|
||||
outn("<li>" . _("Creating buttons table...") . "</li>");
|
||||
$sql = "DROP TABLE IF EXISTS buttonconfig;";
|
||||
$sql .= "CREATE TABLE IF NOT EXISTS sccpbuttonconfig (
|
||||
`ref` varchar(15) NOT NULL default '',
|
||||
`reftype` enum('sccpdevice', 'sipdevice', 'sccpuser') NOT NULL default 'sccpdevice',
|
||||
`instance` tinyint(4) NOT NULL default 0,
|
||||
`buttontype` enum('line','speeddial','service','feature','empty') NOT NULL default 'line',
|
||||
`name` varchar(36) default NULL,
|
||||
`options` varchar(100) default NULL,
|
||||
PRIMARY KEY (`ref`,`reftype`,`instance`,`buttontype`),
|
||||
KEY `ref` (`ref`,`reftype`)
|
||||
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
||||
$check = $db->query($sql);
|
||||
if (DB::IsError($check)) {
|
||||
die_freepbx("Can not create sccpbuttonconfig table, error:$check\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function InstallDB_sccpsettings()
|
||||
{
|
||||
global $db;
|
||||
outn("<li>" . _("Creating sccpsettings table...") . "</li>");
|
||||
$stmt = $db-> prepare('CREATE TABLE IF NOT EXISTS sccpsettings (
|
||||
keyword VARCHAR (50) NOT NULL,
|
||||
data VARCHAR (255) NOT NULL,
|
||||
seq TINYINT (1),
|
||||
type TINYINT (1) NOT NULL,
|
||||
PRIMARY KEY (keyword, seq, type )
|
||||
);');
|
||||
$check = $stmt->execute();
|
||||
if (DB::IsError($check)) {
|
||||
die_freepbx("Can not create sccpsettings table, error: $check\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
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',
|
||||
`buttons` int(2) DEFAULT '0',
|
||||
`loadimage` varchar(40) DEFAULT '',
|
||||
`loadinformationid` VARCHAR(30) NULL DEFAULT NULL,
|
||||
`enabled` INT(2) NULL DEFAULT '0',
|
||||
`nametemplate` VARCHAR(50) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`model`),
|
||||
KEY `model` (`model`)
|
||||
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
||||
$check = $db->query($sql);
|
||||
if (DB::IsError($check)) {
|
||||
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function InstallDB_sccpuser()
|
||||
{
|
||||
global $db;
|
||||
outn("<li>" . _("Creating sccpuser table...") . "</li>");
|
||||
$sql = "CREATE TABLE IF NOT EXISTS `sccpuser` (
|
||||
`name` VARCHAR(20) NULL DEFAULT NULL,
|
||||
`pin` VARCHAR(7) NULL DEFAULT NULL,
|
||||
`password` VARCHAR(7) NULL DEFAULT NULL,
|
||||
`description` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`roaminglogin` ENUM('on','off','multi') NULL DEFAULT 'off',
|
||||
`devicegroup` VARCHAR(20) NULL DEFAULT 'all',
|
||||
`auto_logout` ENUM('on','off') NULL DEFAULT 'off',
|
||||
`homedevice` VARCHAR(20) NULL DEFAULT NULL,
|
||||
UNIQUE INDEX (`name`),
|
||||
PRIMARY KEY (`name`)
|
||||
) ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;";
|
||||
$check = $db->query($sql);
|
||||
if (DB::IsError($check)) {
|
||||
die_freepbx("Can not create sccpdevmodel table, error:$check\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function InstallDB_updateSchema($db_config)
|
||||
{
|
||||
global $db;
|
||||
|
@ -346,7 +307,7 @@ function InstallDB_updateSchema($db_config)
|
|||
$sql = "DESCRIBE " . $tabl_name . "";
|
||||
$db_result = $db->getAll($sql);
|
||||
if (DB::IsError($db_result)) {
|
||||
die_freepbx("Can not add get information from " . $tabl_name . " table\n");
|
||||
die_freepbx("Can not get information from " . $tabl_name . " table\n");
|
||||
}
|
||||
foreach ($db_result as $tabl_data) {
|
||||
$fld_id = $tabl_data[0];
|
||||
|
@ -762,7 +723,7 @@ function CreateBackUpConfig()
|
|||
outn("<font color='red'>PHPx.x-zip not installed where x.x is the installed PHP version. Install it before continuing !</font>");
|
||||
die_freepbx();
|
||||
}
|
||||
$filename = $dir . "/sccp_instal_backup" . date("Ymd"). ".zip";
|
||||
$filename = $dir . "/sccp_install_backup" . date("Ymd"). ".zip";
|
||||
if ($zip->open($filename, \ZIPARCHIVE::CREATE)) {
|
||||
foreach ($backup_files as $file) {
|
||||
foreach ($backup_ext as $b_ext) {
|
||||
|
@ -776,7 +737,7 @@ function CreateBackUpConfig()
|
|||
}
|
||||
$zip->close();
|
||||
} else {
|
||||
outn("<li>" . _("Error Create BackUp: ") . $filename ."</li>");
|
||||
outn("<li>" . _("Error Creating BackUp: ") . $filename ."</li>");
|
||||
}
|
||||
unlink($fsql);
|
||||
outn("<li>" . _("Create Config BackUp: ") . $filename ."</li>");
|
||||
|
@ -808,11 +769,11 @@ function Setup_RealTime()
|
|||
$cnf_read = \FreePBX::LoadConfig();
|
||||
$backup_ext = array('_custom.conf', '_additional.conf','.conf');
|
||||
|
||||
$def_config = array('sccpdevice' => 'mysql,sccp,sccpdeviceconfig', 'sccpline' => ' mysql,sccp,sccpline');
|
||||
$def_config = array('sccpdevice' => 'mysql,asterisk,sccpdeviceconfig', 'sccpline' => ' mysql,asterisk,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','dbcharset'=>'utf8');
|
||||
$def_bd_sec = 'sccp';
|
||||
$def_bd_sec = 'asterisk';
|
||||
|
||||
$dir = $cnf_int->get('ASTETCDIR');
|
||||
$res_conf_sql = ini_get('pdo_mysql.default_socket');
|
||||
|
@ -875,59 +836,4 @@ function Setup_RealTime()
|
|||
$cnf_wr->writeConfig($ext_conf_file, $ext_conf, false);
|
||||
}
|
||||
|
||||
CheckSCCPManagerDBTables($table_req);
|
||||
CheckAsteriskVersion();
|
||||
$sccp_version = array();
|
||||
$sccp_version = CheckChanSCCPCompatible();
|
||||
$sccp_compatible = $sccp_version[0];
|
||||
$chanSCCPWarning = $sccp_version[1] ^= 1;
|
||||
outn("<li>" . _("Sccp model Compatible code : ") . $resultReturned[0] . "</li>");
|
||||
if ($sccp_compatible == 0) {
|
||||
// die_freepbx('Chan Sccp not Found. Install it before continuing');
|
||||
outn("<br>");
|
||||
outn("<font color='red'>Chan Sccp not Found. Install it before continuing !</font>");
|
||||
die();
|
||||
}
|
||||
$db_config = Get_DB_config($sccp_compatible);
|
||||
$sccp_db_ver = CheckSCCPManagerDBVersion();
|
||||
|
||||
// BackUp Old config
|
||||
CreateBackUpConfig();
|
||||
RenameConfig();
|
||||
if ($sccp_compatible > 431) {
|
||||
InstallDB_sccpuser();
|
||||
InstallDB_Buttons();
|
||||
}
|
||||
|
||||
InstallDB_sccpsettings();
|
||||
InstallDB_sccpdevmodel();
|
||||
InstallDB_updateSchema($db_config);
|
||||
$stmt = $db->prepare('SELECT CASE WHEN EXISTS(SELECT 1 FROM sccpdevmodel) THEN 0 ELSE 1 END AS IsEmpty;');
|
||||
$stmt->execute();
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
if ($result[0]['IsEmpty']) {
|
||||
outn("Populating sccpdevmodel...");
|
||||
InstallDB_fillsccpdevmodel();
|
||||
}
|
||||
if (!$sccp_db_ver) {
|
||||
InstallDB_updateSccpDevice();
|
||||
} else {
|
||||
outn("Skip update Device model");
|
||||
}
|
||||
|
||||
InstallDB_createButtonConfigTrigger();
|
||||
InstallDB_CreateSccpDeviceConfigView($sccp_compatible);
|
||||
InstallDB_updateDBVer($sccp_compatible);
|
||||
if ($chanSCCPWarning) {
|
||||
outn("<br>");
|
||||
outn("<font color='red'>Error: installed version of chan-sccp is not compatible. Please upgrade chan-sccp</font>");
|
||||
}
|
||||
if (!$sccp_db_ver) {
|
||||
Setup_RealTime();
|
||||
outn("<br>");
|
||||
outn("Install Complete !");
|
||||
} else {
|
||||
outn("<br>");
|
||||
outn("Update Complete !");
|
||||
}
|
||||
outn("<br>");
|
||||
?>
|
||||
|
|
104
module.xml
104
module.xml
|
@ -4,8 +4,7 @@
|
|||
<version>14.2.0.1</version>
|
||||
<type>setup</type>
|
||||
<category>SCCP Connectivity</category>
|
||||
<publisher>Steve Lad</publisher>
|
||||
<publisher>Alex GP</publisher>
|
||||
<publisher>Steve Lad, Alex GP</publisher>
|
||||
<repo>extended</repo>
|
||||
<description>SCCP Phone and Extension Manager</description>
|
||||
<menuitems>
|
||||
|
@ -30,49 +29,50 @@
|
|||
<md5sum></md5sum>
|
||||
<database>
|
||||
<table name="sccpdevice">
|
||||
<field name="name" type="string" length="15" default="" primarykey="true"/>
|
||||
<field name="type" type="string" length="15" default="NULL" notnull="false"/>
|
||||
<field name="addon" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="_description" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="tzoffset" type="string" length="5" default="NULL" notnull="false"/>
|
||||
<field name="imageversion" type="string" length="31" default="NULL" notnull="false"/>
|
||||
<field name="deny" type="string" length="100" default="'0.0.0.0/0.0.0.0'" notnull="false"/>
|
||||
<field name="permit" type="string" length="100" default="'internal'" notnull="false"/>
|
||||
<field name="deny" type="string" length="100" default="0.0.0.0/0.0.0.0" notnull="false"/>
|
||||
<field name="permit" type="string" length="100" default="internal" notnull="false"/>
|
||||
<field name="earlyrtp" type="string" default="NULL" notnull="false"/>
|
||||
<field name="mwilamp" type="string" default="'on'" notnull="false"/>
|
||||
<field name="mwioncall" type="string" default="'on'" notnull="false"/>
|
||||
<field name="mwilamp" type="string" default="on" notnull="false"/>
|
||||
<field name="mwioncall" type="string" default="on" notnull="false"/>
|
||||
<field name="dndFeature" type="string" default="NULL" notnull="false"/>
|
||||
<field name="transfer" type="string" default="NULL" notnull="false"/>
|
||||
<field name="cfwdall" type="string" default="'on'" notnull="false"/>
|
||||
<field name="cfwdbusy" type="string" default="'on'" notnull="false"/>
|
||||
<field name="private" type="string" default="'off'"/>
|
||||
<field name="privacy" type="string" default="'full'"/>
|
||||
<field name="cfwdall" type="string" default="on" notnull="false"/>
|
||||
<field name="cfwdbusy" type="string" default="on" notnull="false"/>
|
||||
<field name="private" type="string" default="off"/>
|
||||
<field name="privacy" type="string" default="full"/>
|
||||
<field name="nat" type="string" default="NULL" notnull="false"/>
|
||||
<field name="directrtp" type="string" default="NULL" notnull="false"/>
|
||||
<field name="softkeyset" type="string" length="100" default="'softkeyset'" notnull="false"/>
|
||||
<field name="audio_tos" type="string" length="11" default="'0xB8'" notnull="false"/>
|
||||
<field name="audio_cos" type="string" length="1" default="'6'" notnull="false"/>
|
||||
<field name="video_tos" type="string" length="11" default="'0x88'" notnull="false"/>
|
||||
<field name="video_cos" type="string" length="1" default="'5'" notnull="false"/>
|
||||
<field name="conf_allow" type="string" default="'on'"/>
|
||||
<field name="conf_play_general_announce" type="string" length="3" default="'on'" notnull="false"/>
|
||||
<field name="conf_play_part_announce" type="string" default="'on'"/>
|
||||
<field name="conf_mute_on_entry" type="string" default="'off'"/>
|
||||
<field name="conf_music_on_hold_class" type="string" length="80" default="'default'" notnull="false"/>
|
||||
<field name="conf_show_conflist" type="string" default="'on'"/>
|
||||
<field name="force_dtmfmode" type="string" default="'auto'"/>
|
||||
<field name="softkeyset" type="string" length="100" default="softkeyset" notnull="false"/>
|
||||
<field name="audio_tos" type="string" length="11" default="0xB8" notnull="false"/>
|
||||
<field name="audio_cos" type="string" length="1" default="6" notnull="false"/>
|
||||
<field name="video_tos" type="string" length="11" default="0x88" notnull="false"/>
|
||||
<field name="video_cos" type="string" length="1" default="5" notnull="false"/>
|
||||
<field name="conf_allow" type="string" default="on"/>
|
||||
<field name="conf_play_general_announce" type="string" length="3" default="on" notnull="false"/>
|
||||
<field name="conf_play_part_announce" type="string" default="on"/>
|
||||
<field name="conf_mute_on_entry" type="string" default="off"/>
|
||||
<field name="conf_music_on_hold_class" type="string" length="80" default="default" notnull="false"/>
|
||||
<field name="conf_show_conflist" type="string" default="on"/>
|
||||
<field name="force_dtmfmode" type="string" default="auto"/>
|
||||
<field name="setvar" type="string" length="100" default="NULL" notnull="false"/>
|
||||
<field name="backgroundImage" type="string" length="255" default="NULL" notnull="false"/>
|
||||
<field name="backgroundThumbnail" type="string" length="255" default="NULL" notnull="false"/>
|
||||
<field name="ringtone" type="string" length="255" default="NULL" notnull="false"/>
|
||||
<field name="name" type="string" length="15" default="''" primarykey="true"/>
|
||||
<field name="name" type="string" length="15" default="" primarykey="true"/>
|
||||
<field name="callhistory_answered_elsewhere" type="string" default="NULL" notnull="false"/>
|
||||
<field name="_hwlang" type="string" length="12" default="NULL" notnull="false"/>
|
||||
<field name="_loginname" type="string" length="20" default="NULL" notnull="false"/>
|
||||
<field name="_profileid" type="integer" default="0"/>
|
||||
<field name="_dialrules" type="string" length="255" default="NULL" notnull="false"/>
|
||||
<field name="useRedialMenu" type="string" length="5" default="'no'" notnull="false"/>
|
||||
<field name="cfwdnoanswer" type="string" default="'on'" notnull="false"/>
|
||||
<field name="park" type="string" default="'on'" notnull="false"/>
|
||||
<field name="useRedialMenu" type="string" length="5" default="no" notnull="false"/>
|
||||
<field name="cfwdnoanswer" type="string" default="on" notnull="false"/>
|
||||
<field name="park" type="string" default="on" notnull="false"/>
|
||||
<field name="monitor" type="string" default="NULL" notnull="false"/>
|
||||
<field name="transfer_on_hangup" type="string" default="NULL" notnull="false"/>
|
||||
<field name="phonecodepage" type="string" length="50" default="NULL" notnull="false"/>
|
||||
|
@ -86,7 +86,7 @@
|
|||
<field name="incominglimit" type="integer" default="6" notnull="false"/>
|
||||
<field name="transfer" type="string" default="NULL" notnull="false"/>
|
||||
<field name="mailbox" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="vmnum" type="string" length="45" default="'*97'" notnull="false"/>
|
||||
<field name="vmnum" type="string" length="45" default="*97" notnull="false"/>
|
||||
<field name="cid_name" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="cid_num" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="disallow" type="string" length="255" default="NULL" notnull="false"/>
|
||||
|
@ -94,11 +94,11 @@
|
|||
<field name="trnsfvm" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="secondary_dialtone_digits" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="secondary_dialtone_tone" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="musicclass" type="string" length="45" default="'default'" notnull="false"/>
|
||||
<field name="musicclass" type="string" length="45" default="default" notnull="false"/>
|
||||
<field name="language" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="accountcode" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="echocancel" type="string" default="'off'"/>
|
||||
<field name="silencesuppression" type="string" default="'off'"/>
|
||||
<field name="echocancel" type="string" default="off"/>
|
||||
<field name="silencesuppression" type="string" default="off"/>
|
||||
<field name="callgroup" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="pickupgroup" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="namedcallgroup" type="string" length="100" default="NULL" notnull="false"/>
|
||||
|
@ -112,20 +112,20 @@
|
|||
<field name="directed_pickup_context" type="string" length="100" default="NULL" notnull="false"/>
|
||||
<field name="pickup_modeanswer" type="string" default="NULL" notnull="false"/>
|
||||
<field name="amaflags" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="dnd" type="string" default="'reject'" notnull="false"/>
|
||||
<field name="videomode" type="string" default="'auto'" notnull="false"/>
|
||||
<field name="dnd" type="string" default="reject" notnull="false"/>
|
||||
<field name="videomode" type="string" default="auto" notnull="false"/>
|
||||
<field name="setvar" type="string" length="50" default="NULL" notnull="false"/>
|
||||
<field name="name" type="string" length="40" default="''" primarykey="true"/>
|
||||
<field name="name" type="string" length="40" default="" primarykey="true"/>
|
||||
<field name="phonecodepage" type="string" length="50" default="NULL" notnull="false"/>
|
||||
<key name="id" type="unique">
|
||||
<column name="id"/>
|
||||
</key>
|
||||
</table>
|
||||
<table name="sccpbuttonconfig">
|
||||
<field name="ref" type="string" length="15" default="''" primarykey="true"/>
|
||||
<field name="reftype" type="string" default="'sccpdevice'" primarykey="true"/>
|
||||
<field name="ref" type="string" length="15" default="" primarykey="true"/>
|
||||
<field name="reftype" type="string" default="sccpdevice" primarykey="true"/>
|
||||
<field name="instance" type="boolean" default="0" primarykey="true"/>
|
||||
<field name="buttontype" type="string" default="'line'" primarykey="true"/>
|
||||
<field name="buttontype" type="string" default="line" primarykey="true"/>
|
||||
<field name="name" type="string" length="36" default="NULL" notnull="false"/>
|
||||
<field name="options" type="string" length="100" default="NULL" notnull="false"/>
|
||||
<key name="ref" type="index">
|
||||
|
@ -133,5 +133,37 @@
|
|||
<column name="reftype"/>
|
||||
</key>
|
||||
</table>
|
||||
<table name="sccpdevmodel">
|
||||
<field name="model" type="string" length="20" default="" primarykey="true"/>
|
||||
<field name="vendor" type="string" length="40" default="" notnull="false"/>
|
||||
<field name="dns" type="integer" default="1" notnull="false"/>
|
||||
<field name="buttons" type="integer" default="0" notnull="false"/>
|
||||
<field name="loadimage" type="string" length="40" default="" notnull="false"/>
|
||||
<field name="loadinformationid" type="string" length="30" default="NULL" notnull="false"/>
|
||||
<field name="enabled" type="integer" default="0" notnull="false"/>
|
||||
<field name="nametemplate" type="string" length="50" default="NULL" notnull="false"/>
|
||||
<key name="model" type="index">
|
||||
<column name="model"/>
|
||||
</key>
|
||||
</table>
|
||||
<table name="sccpuser">
|
||||
<field name="name" type="string" length="20" primarykey="true"/>
|
||||
<field name="pin" type="string" length="7" default="NULL" notnull="false"/>
|
||||
<field name="password" type="string" length="7" default="NULL" notnull="false"/>
|
||||
<field name="description" type="string" length="45" default="NULL" notnull="false"/>
|
||||
<field name="roaminglogin" type="string" default="off" notnull="false"/>
|
||||
<field name="devicegroup" type="string" length="7"/>
|
||||
<field name="auto_logout" type="string" default="off" notnull="false"/>
|
||||
<field name="homedevice" type="string" length="20" default="NULL" notnull="false"/>
|
||||
<key name="name" type="unique">
|
||||
<column name="name"/>
|
||||
</key>
|
||||
</table>
|
||||
<table name="sccpsettings">
|
||||
<field name="keyword" type="string" length="50" primarykey="true"/>
|
||||
<field name="data" type="string" length="255"/>
|
||||
<field name="seq" type="boolean" primarykey="true"/>
|
||||
<field name="type" type="boolean" primarykey="true"/>
|
||||
</table>
|
||||
</database>
|
||||
</module>
|
||||
|
|
|
@ -156,30 +156,12 @@ class dbinterface
|
|||
public function get_db_SccpSetting()
|
||||
{
|
||||
$dbh = \FreePBX::Database();
|
||||
try {
|
||||
$stmt = $dbh->prepare('SELECT keyword, data, type, seq FROM sccpsettings ORDER BY type, seq');
|
||||
$stmt->execute();
|
||||
foreach ($stmt->fetchAll() as $var) {
|
||||
$mysccpvalues[$var['keyword']] = array('keyword' => $var['keyword'], 'data' => $var['data'], 'seq' => $var['seq'], 'type' => $var['type']);
|
||||
}
|
||||
return $mysccpvalues;
|
||||
} catch(\PDOException $e) {
|
||||
// sccpsettings table does not yet exist. FreePBX is instantiating
|
||||
// a SCCP_Manager object from the Installer before the installer can
|
||||
// create the table so will create here.
|
||||
$stmt = $dbh-> prepare('CREATE TABLE IF NOT EXISTS sccpsettings (
|
||||
keyword VARCHAR (50) NOT NULL,
|
||||
data VARCHAR (255) NOT NULL,
|
||||
seq TINYINT (1),
|
||||
type TINYINT (1) NOT NULL default 0,
|
||||
PRIMARY KEY (keyword, seq, type )
|
||||
);');
|
||||
$stmt->execute();
|
||||
//if ($dbh::IsError($check)) {
|
||||
// die_freepbx("Can not create sccpsettings table, error: $check\n");
|
||||
//}
|
||||
return array();
|
||||
$stmt = $dbh->prepare('SELECT keyword, data, type, seq FROM sccpsettings ORDER BY type, seq');
|
||||
$stmt->execute();
|
||||
foreach ($stmt->fetchAll() as $var) {
|
||||
$mysccpvalues[$var['keyword']] = array('keyword' => $var['keyword'], 'data' => $var['data'], 'seq' => $var['seq'], 'type' => $var['type']);
|
||||
}
|
||||
return $mysccpvalues;
|
||||
}
|
||||
|
||||
public function get_db_sysvalues()
|
||||
|
|
|
@ -125,11 +125,10 @@ class extconfigs
|
|||
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
|
||||
"dateformat" => 'D.M.Y',
|
||||
"disallow" => 'all', "allow" => 'alaw;ulaw',
|
||||
"hotline_enabled" => 'off',
|
||||
"hotline_context" => 'default', # !TODO!: Should this not be from-internal on FreePBX ?
|
||||
|
|
|
@ -63,7 +63,6 @@ if (!empty($version)) {
|
|||
if (DB::IsError($result)) {
|
||||
die_freepbx($result->getDebugInfo());
|
||||
}
|
||||
unset($result);
|
||||
|
||||
/* Comment: Maybe save in sccpsettings, if the chan_sccp tables already existed in the database or if they were created by install.php */
|
||||
/* So that you know if it is safe to drop/delete them */
|
||||
|
|
|
@ -28,12 +28,12 @@ $day_format = array("D.M.Y", "D.M.YA", "Y.M.D", "YA.M.D", "M-D-Y", "M-D-YA", "D-
|
|||
"D/M/Y", "D/M/YA", "Y/M/D", "YA/M/D", "M/D/Y", "M/D/YA");
|
||||
$mysql_table = array("sccpdevice","sccpdeviceconfig");
|
||||
//$time_zone_name = timezone_identifiers_list();
|
||||
$time_zone = array('-12' => 'GTM -12', '-11' => 'GTM -11', '-10' => 'GTM -10', '-09' => 'GTM -9',
|
||||
'-08' => 'GTM -8', '-07' => 'GTM -7', '-06' => 'GTM -6', '-05' => 'GTM -5',
|
||||
'-04' => 'GTM -4', '-03' => 'GTM -3', '-02' => 'GTM -2', '-01' => 'GTM -1',
|
||||
'00' => 'GTM time', '01' => 'GTM +1', '02' => 'GTM +2', '03' => 'GTM +3',
|
||||
'04' => 'GTM +4', '05' => 'GTM +5', '06' => 'GTM +6', '07' => 'GTM +7',
|
||||
'08' => 'GTM +8', '09' => 'GTM +9', '10' => 'GTM +10', '11'=> 'GTM +11', '12' => 'GTM +12');
|
||||
$time_zone = array('-12' => 'GMT -12', '-11' => 'GMT -11', '-10' => 'GMT -10', '-09' => 'GMT -9',
|
||||
'-08' => 'GMT -8', '-07' => 'GMT -7', '-06' => 'GMT -6', '-05' => 'GMT -5',
|
||||
'-04' => 'GMT -4', '-03' => 'GMT -3', '-02' => 'GMT -2', '-01' => 'GMT -1',
|
||||
'00' => 'GMT', '01' => 'GMT +1', '02' => 'GMT +2', '03' => 'GMT +3',
|
||||
'04' => 'GMT +4', '05' => 'GMT +5', '06' => 'GMT +6', '07' => 'GMT +7',
|
||||
'08' => 'GMT +8', '09' => 'GMT +9', '10' => 'GMT +10', '11'=> 'GMT +11', '12' => 'GMT +12');
|
||||
|
||||
|
||||
$time_zone_name = array();
|
||||
|
|
Loading…
Reference in a new issue