From ca459655346241c15263b74d650631be4964054f Mon Sep 17 00:00:00 2001 From: PhantomVl Date: Mon, 9 Sep 2019 17:26:09 +0300 Subject: [PATCH] - ADD SIP TFTP - Activate Dial Template --- Sccp_manager.class.php | 42 ++++++++++++++++--------- Sccp_manager.inc/xmlinterface.class.php | 14 ++++++++- conf/sccpgeneral.xml.v433 | 8 +++++ install.php | 8 +++-- uninstall.php | 14 +++++---- views/form.sbuttons.php | 3 +- views/server.info.php | 6 +--- 7 files changed, 66 insertions(+), 29 deletions(-) diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index bb8e1c1..7a4f54a 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -95,7 +95,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { private $SCCP_LANG_DICTIONARY = 'be-sccp.jar'; // CISCO LANG file search in /tftp-path private $pagedata = null; private $sccp_driver_ver = '11.3'; // Ver fore SCCP.CLASS.PHP - public $sccp_manager_ver = '13.0.0.4(M)'; + public $sccp_manager_ver = '14.0.0.1'; private $tftpLang = array(); // private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!! private $hint_context = array('default' => '@ext-local'); /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!! @@ -478,12 +478,14 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { "sccpkeyset" => array( "name" => _("SCCP Device Keyset"), "page" => 'views/advserver.keyset.php' - ), - "sccpdialplan" => array( - "name" => _("SIP Dial Plan information"), - "page" => 'views/advserver.dialtemplate.php' ) ); + if ($this->sccpvalues['siptftp']['data'] == 'on') { + $this->pagedata["sccpdialplan"] = array( + "name" => _("SIP Dial Plan information"), + "page" => 'views/advserver.dialtemplate.php' + ); + } break; } foreach ($this->pagedata as &$page) { @@ -567,12 +569,14 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { "sccpdevice" => array( "name" => _("SCCP Phone"), "page" => 'views/hardware.phone.php' - ), - "sipdevice" => array( - "name" => _("SIP CISCO Phone"), - "page" => 'views/hardware.sphone.php' ) ); + if ($this->sccpvalues['siptftp']['data'] == 'on') { + $this->pagedata["sipdevice"] = array( + "name" => _("SIP CISCO Phone"), + "page" => 'views/hardware.sphone.php' + ); + } break; } foreach ($this->pagedata as &$page) { @@ -1932,13 +1936,22 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $data_tmp = explode(';',$dev_ext_config['sip_lines']); foreach ($data_tmp as $value) { $tmp_line = explode(',',$value); - if ($tmp_line[0] == 'line') { - $dev_line_data= $this->sipconfigs->get_db_sip_TableData('DeviceById',array('id'=>$tmp_line[1])); - if (!empty($dev_line_data)) { - $data_value['siplines'][] = $dev_line_data; - } + switch ($tmp_line[0]) { + case 'line': + $dev_line_data= $this->sipconfigs->get_db_sip_TableData('DeviceById',array('id'=>$tmp_line[1])); + if (!empty($dev_line_data)) { + $data_value['siplines'][] = $dev_line_data; + } + break; + case 'speeddial': + $data_value['speeddial'][] = array("name"=>$tmp_line[1],"dial"=>$tmp_line[2]); + break; + default: + $data_value['sipfunctions'][] = $tmp_line; + break; } } +// return print_r($data_tmp ,true); // return print_r($dev_line_data,true); } } @@ -1957,6 +1970,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $dev_config['addon_info'][$key] = $hw_data[0]['loadimage']; } } +// return print_r($data_value,true); // return print_r($dev_config,true); $lang_data = $this->extconfigs->getextConfig('sccp_lang'); diff --git a/Sccp_manager.inc/xmlinterface.class.php b/Sccp_manager.inc/xmlinterface.class.php index 88fa965..7b13818 100644 --- a/Sccp_manager.inc/xmlinterface.class.php +++ b/Sccp_manager.inc/xmlinterface.class.php @@ -614,11 +614,12 @@ class xmlinterface { $ifc = 0; if (!empty($data_values['siplines'])) { foreach ($data_values['siplines'] as $spkey => $spvalue) { +// if $spvalue[] $xnode_obj = clone $xnode->line; - $xnode_obj['button'] = $ifc + 1; $xnode_obj['lineIndex'] = $ifc + 1; //$xnode_obj->proxy = $data_values['bindaddr']; + $xnode_obj-> featureID = "9"; if ($xnode_obj->proxy != 'USECALLMANAGER') { $xnode_obj->proxy = $sip_bind[0]['ip']; $xnode_obj->port = $sip_bind[0]['port']; @@ -636,6 +637,17 @@ class xmlinterface { $ifc ++; } } + if (!empty($data_values['speeddial'])) { + foreach ($data_values['speeddial'] as $spkey => $spvalue) { + $xmlstr = ' 22' + .''.$spvalue["name"].'' + .''.$spvalue["dial"].'' + .''.$spvalue["dial"].' '; + $xnode_obj = simplexml_load_string($xmlstr); + $this->appendSimpleXmlNode($xnode->line, $xnode_obj); + $ifc ++; + } + } // $xnode = &$xml_node->$dkey->members; //$xnode = null; break; diff --git a/conf/sccpgeneral.xml.v433 b/conf/sccpgeneral.xml.v433 index 106624e..e48fe8e 100644 --- a/conf/sccpgeneral.xml.v433 +++ b/conf/sccpgeneral.xml.v433 @@ -149,6 +149,14 @@ and open the template in the editor. Base Version before all crash :-) Help! + + siptftp + + off + + + Help! + diff --git a/install.php b/install.php index 14af1e2..e35cf4c 100644 --- a/install.php +++ b/install.php @@ -245,8 +245,9 @@ function Get_DB_config($sccp_compatible) { '_hwlang' => array('create' => 'varchar(12) NULL DEFAULT NULL'), '_loginname' => array('create' => 'varchar(20) NULL DEFAULT NULL AFTER `_hwlang`'), '_profileid' => array('create' => "INT(11) NOT NULL DEFAULT '0' AFTER `_loginname`"), + '_dialrules' => array('create' => "VARCHAR(255) NULL DEFAULT NULL AFTER `_profileid`"), - 'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_profileid`"), + 'useRedialMenu' => array('create' => "VARCHAR(5) NULL DEFAULT 'no' AFTER `_dialrules`"), //'dtmfmode' => array('create' => "VARCHAR(10) default 'outofband'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'outofband'), 'dtmfmode' => array('drop' => "yes"), // 'force_dtmfmode' => array('create' => "VARCHAR(10) default 'auto'", 'modify' => "VARCHAR(10)", 'def_modify'=> 'auto'), @@ -334,6 +335,7 @@ function Get_DB_config($sccp_compatible) { '_description' => array('rename' => "description"), '_loginname' => array('drop' => "yes"), '_profileid' => array('drop' => "yes"), + '_dialrules' => array('create' => "VARCHAR(255) NULL DEFAULT NULL AFTER `_profileid`"), 'transfer_on_hangup' => array('create' => "enum('on','off') NULL DEFAULT NULL", 'modify' => "enum('on','off')"), ), 'sccpline' => array( @@ -656,7 +658,9 @@ function InstallDB_fillsccpdevmodel() { "('S60', 'NOKIA', 0, 1, '', 'loadInformation376', 0, ''), ('9971', 'CISCO', 1, 1, '', 'loadInformation493', 0, ''), ('9951', 'CISCO', 1, 1, '', 'loadInformation537', 0, ''), ('8961', 'CISCO', 1, 1, '', 'loadInformation540', 0, ''), ('Iphone', 'APPLE', 0, 1, '', 'loadInformation562', 0, ''), ('Android', 'ANDROID', 0, 1, '', 'loadInformation575', 0, ''), ('7926', 'CISCO', 1, 1, 'CP7926G-1.4.5.3', 'loadInformation577', 0, ''), ('7821', 'CISCO', 1, 1, '', 'loadInformation621', 0, ''), ('7841', 'CISCO', 1, 1, '', 'loadInformation622', 0, ''), ('7861', 'CISCO', 1, 1, '', 'loadInformation623', 0, ''), ('VXC 6215', 'CISCO', 1, 1, '', 'loadInformation634', 0, ''), ('8831', 'CISCO', 1, 1, '', 'loadInformation659', 0, ''), ('8841', 'CISCO', 1, 1, '', 'loadInformation683', 0, ''), ('8851', 'CISCO', 1, 1, '', 'loadInformation684', 0, ''), ('8861', 'CISCO', 1, 1, '', 'loadInformation685', 0, ''), ". "('Analog', 'CISCO', 1, 1, '', 'loadInformation30027', 0, ''), ('ISDN', 'CISCO', 1, 1, '', 'loadInformation30028', 0, ''), ('SCCP GW', 'CISCO', 1, 1, '', 'loadInformation30032', 0, ''), ('IP-STE', 'CISCO', 1, 1, '', 'loadInformation30035', 0, ''), ". "('SPA 521S', 'CISCO', 1, 1, '', 'loadInformation80000', 0, ''), ('SPA 502G', 'CISCO', 1, 1, '', 'loadInformation80003', 0, ''), ('SPA 504G', 'CISCO', 1, 1, '', 'loadInformation80004', 0, ''), ('SPA 525G', 'CISCO', 1, 1, '', 'loadInformation80005', 0, ''), ('SPA 525G2', 'CISCO', 1, 1, '', 'loadInformation80009', 0, ''), ('SPA 303G', 'CISCO', 1, 1, '', 'loadInformation80011', 0, ''),". - "('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL), ('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL), ('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL), ('VGC Virtual', 'CISCO', 1, 1, '', 'loadInformation11', 0, NULL);"; + "('IP Communicator', 'CISCO', 1, 1, '', 'loadInformation30016', 0, NULL), ('Nokia E', 'Nokia', 1, 28, '', 'loadInformation275', 0, NULL), ('VGC Phone', 'CISCO', 1, 1, '', 'loadInformation10', 0, NULL),". + "('7911-sip', 'CISCO-SIP', 1, 1, 'SIP11.9-2-1S', 'loadInformation307', 1, 'SEP0000000000.cnf.xml_791x_sip_template'),". + "('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"); diff --git a/uninstall.php b/uninstall.php index 6090e0f..e43b4be 100644 --- a/uninstall.php +++ b/uninstall.php @@ -58,12 +58,14 @@ if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); } /* 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 save to drop/delete them */ -/* DROP VIEW `sccpdeviceconfig`; - DROP TABLE `sccpbuttonconfig`; - DROP TABLE `sccpdevice`; - DROP TABLE `sccpdevmodel`; - DROP TABLE `sccpline`; - DROP TABLE `sccpsettings`; +/* DROP VIEW IF EXISTS`sccpdeviceconfig`; + DROP TABLE IF EXISTS `sccpbuttonconfig`; + DROP TABLE IF EXISTS `sccpdevice`; + DROP TABLE IF EXISTS `sccpdevmodel`; + DROP TABLE IF EXISTS `sccpline`; + DROP TABLE IF EXISTS `sccpsettings`; + DROP TABLE IF EXISTS `sccpuser`; + * */ } diff --git a/views/form.sbuttons.php b/views/form.sbuttons.php index ff0b69e..67a4f0b 100644 --- a/views/form.sbuttons.php +++ b/views/form.sbuttons.php @@ -11,7 +11,8 @@ $forminfo =array( ); //$buttons_type= array("empty","line","service","feature","speeddial"); // "feature","service" -- Add leter ! -$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line"); +//$buttons_type= array("empty","line","silent","monitor","speeddial","feature","adv.line"); +$buttons_type= array("empty","line","speeddial"); $feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status"); //$lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); diff --git a/views/server.info.php b/views/server.info.php index d783e61..e2def53 100644 --- a/views/server.info.php +++ b/views/server.info.php @@ -100,7 +100,7 @@ if ($mysql_info['Value'] <= '2000') { } global $amp_conf; // ************************************************************************************ - +/* //$tmp_data_list = $this->getSccp_model_information('enabled', $validate = TRUE); //$tmp_data_list = $amp_conf; //$tmp_data_list=FreePBX::create()->Sipsettings->getConfig('bindport'); @@ -109,20 +109,16 @@ if ($mysql_info['Value'] <= '2000') { // $tmp_data_list=$this->dbinterface->get_db_SccpTableData('SccpExtension'); // $tmp_data_list=$this->dbinterface->get_db_SccpTableData('SccpDevice', array('type'=>'cisco-sip')); // $tmp_data_list= FreePBX::Sipsettings()->getChanSipDefaults(); -$file_ext = array('.loads', '.sbn', '.bin', '.zup'); -$dir = '/tftpboot'; //$tmp_data_list = $this->find_all_files($dir, $file_ext, 'fileonly'); print_r("
Help Info:
");
  print_r("
"); print_r($tmp_data_list); //$tmp_data_list = FreePBX::Sipsettings()->getChanSipDefaults(); - $tmp_data_list = FreePBX::Sipsettings()->getBinds(); // $tmp_data_list = \FreePBX::Sipsettings()->getSipPortOwner(); //print_r($buton_list); print_r("
"); print_r($this->sccp_conf_init); //$tmp_data_list=$this->sipconfigs->get_db_sip_TableData('Device'); - print_r($this->srvinterface->sccp_list_keysets()); print_r("
"); // print_r("DIRECT START"); // print_r($this->sccpvalues['ccm_address']);