From bbfc6bb007fb3064c4cfc125dde8b79ec68a0da7 Mon Sep 17 00:00:00 2001 From: PhantomVl Date: Wed, 19 Dec 2018 17:40:10 +0300 Subject: [PATCH] Update 433 bug fix --- !Readme.txt/help.tftprewrite | 58 ++++++++ Sccp_manager.class.php | 3 +- Sccp_manager.inc/srvinterface.class.php | 79 +++++----- assets/js/sccp_manager.js | 8 + conf/SEP0000000000.cnf.xml_7937_template | 178 +++++++++++++++++++++++ install.php | 2 +- views/server.info.php | 17 ++- 7 files changed, 305 insertions(+), 40 deletions(-) create mode 100644 !Readme.txt/help.tftprewrite create mode 100644 conf/SEP0000000000.cnf.xml_7937_template diff --git a/!Readme.txt/help.tftprewrite b/!Readme.txt/help.tftprewrite new file mode 100644 index 0000000..bcc089a --- /dev/null +++ b/!Readme.txt/help.tftprewrite @@ -0,0 +1,58 @@ +diff --git a/src/sccp_config.c b/src/sccp_config.c +index e15d19db..c78bcbf2 100644 +--- a/src/sccp_config.c ++++ b/src/sccp_config.c +@@ -3062,6 +3062,7 @@ int sccp_manager_config_metadata(struct mansession *s, const struct message *m) + uint i; + const char *id = astman_get_header(m, "ActionID"); + const char *req_segment = astman_get_header(m, "Segment"); ++ const char *req_listresult = astman_get_header(m, "ListResult"); + uint comma = 0; + + if (sccp_strlen_zero(req_segment)) { // return all segments +@@ -3180,11 +3181,22 @@ int sccp_manager_config_metadata(struct mansession *s, const struct message *m) + sccpConfigSegment = &sccpConfigSegments[i]; + const SCCPConfigOption *config = sccpConfigSegment->config; + +- astman_append(s, "Response: Success\r\n"); +- if (!ast_strlen_zero(id)) { +- astman_append(s, "ActionID: %s\r\n", id); ++ if (sccp_strcaseequals(req_listresult, "yes")) { ++ //astman_append(s, "Response: Follows\r\n\r\n"); ++ //astman_append(s, "EventList: Start\r\n"); ++ astman_send_listack(s, m, "SCCPConfigMetaData Follows", "Start"); ++ astman_append(s, "Event: SCCPConfigMetaData\r\n"); ++ if (!ast_strlen_zero(id)) { ++ astman_append(s, "ActionID: %s\r\n", id); ++ } ++ } else if (sccp_strcaseequals(req_listresult, "freepbx")) { ++ astman_append(s, "Response: Follows\r\n"); ++ } else { ++ astman_append(s, "Response: Success\r\n"); ++ if (!ast_strlen_zero(id)) { ++ astman_append(s, "ActionID: %s\r\n", id); ++ } + } +- + astman_append(s, "JSON: {"); + astman_append(s, "\"Segment\":\"%s\",", sccpConfigSegment->name); + astman_append(s, "\"Options\":["); +@@ -3296,8 +3308,17 @@ int sccp_manager_config_metadata(struct mansession *s, const struct message *m) + comma = 1; + } + } +- astman_append(s, "]}\r\n\r\n"); ++ astman_append(s, "]}\r\n"); + total++; ++ if (sccp_strcaseequals(req_listresult, "yes")) { ++ astman_append(s, ++ "\r\nEvent: SCCPConfigMetaDataComplete\r\n" ++ "EventList: Complete\r\n" ++ "ListItems: %d\r\n\r\n", total); ++ } else if (sccp_strcaseequals(req_listresult, "freepbx")) { ++ astman_append(s, "--END COMMAND--\r\n"); ++ } ++ astman_append(s, "\r\n"); + } + } + } diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index 45da570..fbabba6 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -678,11 +678,12 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } break; case 'create_hw_tftp': + $ver_id = ' Test !'; $this->sccp_delete_device_XML('all'); // Концы в вводу !! $this->sccp_create_tftp_XML(); $models = $this->dbinterface->get_db_SccpTableData("SccpDevice"); $ver_id = ' on found active model !'; -// return array('status' => false, 'message' => print_r($models)); + //return array('status' => false, 'message' => 'Error :'. print_r($models,1)); foreach ($models as $data) { $ver_id = $this->sccp_create_device_XML($data['name']); }; diff --git a/Sccp_manager.inc/srvinterface.class.php b/Sccp_manager.inc/srvinterface.class.php index 6663710..6a9a31e 100644 --- a/Sccp_manager.inc/srvinterface.class.php +++ b/Sccp_manager.inc/srvinterface.class.php @@ -17,12 +17,14 @@ class srvinterface { public function __construct($parent_class = null) { global $amp_conf; $this->paren_class = $parent_class; -/* $this->socket = FALSE; $this->error = ""; - $this->astLogin(localhost, $amp_conf[AMPMGRUSER],$amp_conf[AMPMGRPASS]); - * - */ +/* + if (isset($amp_conf[AMPMGRUSER])) { + $this->astLogin('localhost', $amp_conf[AMPMGRUSER],$amp_conf[AMPMGRPASS]); + } + +*/ } public function info() { @@ -432,16 +434,18 @@ class srvinterface { if (!is_bool(strpos($inthat, $value))) return substr($inthat, strpos($inthat, $value) + strlen($value)); } -/* + function getеtestChanSCC() { global $astman; - $params = array(); - $action = 'GetConfigJSON'; - $metadata['a'] = $response = $astman->send_request($action, $params); - $metadata['b'] = $this->astman_retrieveMeta($action, $params, true); + $action = 'SCCPConfigMetaData'; + $params = array('Segment' => 'device', 'ResultFormat'=>'command' ); +// $params = array('Segment' => 'device'); + // $params = array(); + $metadata['a'] = $astman->send_request($action, $params); + // $metadata['b'] = $this->astman_retrieveMeta($action, $params, true); return $metadata; } - */ + /* private function astLogin($host="localhost", $username="admin", $password="amp111"){ $this->socket = @fsockopen("127.0.0.1","5038", $errno, $errstr, 1); @@ -477,7 +481,7 @@ class srvinterface { return; } - private function astQuery($query){ + private function astQuery($query, $rawdata = false){ $wrets = ""; if ($this->socket === FALSE) @@ -485,30 +489,33 @@ class srvinterface { $parameters = array(); $data_store = 'data'; fputs($this->socket, $query); + $parameters['raw_q'] = $query; do { $line = fgets($this->socket, 4096); $parameters['raw'] .= $line; - $a = strpos($line, ':'); - if($a) { - $key = substr($line, 0, $a); - switch ($key) { - case 'Response': - case 'Message': - case 'EventList': - $parameters[$key] = trim(substr($line, $a + 2)); - break; - case 'JSON': - $parameters[$key] = substr($line, $a + 2); - $data_store = $key; - break; - default: - $parameters[$data_store] .= $line; - break; - } + if (!$rawdata) { + $a = strpos($line, ':'); + if($a) { + $key = substr($line, 0, $a); + switch ($key) { + case 'Response': + case 'Message': + case 'EventList': + $parameters[$key] = trim(substr($line, $a + 2)); + break; + case 'JSON': + $parameters[$key] = substr($line, $a + 2); + $data_store = $key; + break; + default: + $parameters[$data_store] .= $line; + break; + } // store parameter in $parameters - } else { - $parameters[$data_store] .= $line; + } else { + $parameters[$data_store] .= $line; + } } $info = stream_get_meta_data($this->socket); }while ($line != "\r\n" && $info['timed_out'] == false ); @@ -548,7 +555,7 @@ class srvinterface { } } - $result = $this->astQuery($query."\r\n"); + $result = $this->astQuery($query."\r\n",$rawdata); if ($result["Response"] == "Success") { if ($rawdata) { @@ -567,6 +574,7 @@ class srvinterface { } } + */ /* function t_get_meta_data() { global $amp_conf; @@ -580,7 +588,7 @@ class srvinterface { // fputs ($fp,"Secret: secret\r\n"); fputs ($fp,"Secret: ".$amp_conf[AMPMGRPASS]."\r\n"); fputs ($fp,"Events: on\r\n\r\n"); - + fputs ($fp,"Action: SCCPConfigMetaData\r\n"); fputs ($fp,"\r\n"); @@ -590,16 +598,19 @@ class srvinterface { fputs ($fp,"Action: SCCPConfigMetaData\r\n"); fputs ($fp,"Segment: general\r\n"); + fputs ($fp,"ListResult: yes\r\n"); fputs ($fp,"Option: fallback\r\n"); fputs ($fp,"\r\n"); fputs ($fp,"Action: SCCPConfigMetaData\r\n"); fputs ($fp,"Segment: device\r\n"); + fputs ($fp,"ListResult: freepbx\r\n"); fputs ($fp,"\r\n"); fputs ($fp,"Action: SCCPConfigMetaData\r\n"); fputs ($fp,"Segment: device\r\n"); fputs ($fp,"Option: dtmfmode\r\n"); + fputs ($fp,"ListResult: yes\r\n"); fputs ($fp,"\r\n"); fputs ($fp,"Action: logoff\r\n\r\n"); @@ -618,7 +629,7 @@ class srvinterface { return $resp; } - - */ +*/ + } diff --git a/assets/js/sccp_manager.js b/assets/js/sccp_manager.js index 54811a3..8d29366 100644 --- a/assets/js/sccp_manager.js +++ b/assets/js/sccp_manager.js @@ -602,6 +602,14 @@ $(document).ready(function () { data.message.forEach(function (entry) { fpbxToast(entry, 'error', 'error'); }); + } else { + if (data.message) { + alert(data.message); + } else { + if (data) { + alert(data); + } + } } } } diff --git a/conf/SEP0000000000.cnf.xml_7937_template b/conf/SEP0000000000.cnf.xml_7937_template new file mode 100644 index 0000000..1ac90c0 --- /dev/null +++ b/conf/SEP0000000000.cnf.xml_7937_template @@ -0,0 +1,178 @@ + + + true + SCCP + + + 2 + true + 1 + + 2012c + tzupdater.jar + + 000000 + Off + Disabled + false + + 0 + Default + + CMLocal + M/D/Y + Greenwich Standard Time + Etc/GMT + + + Default + true + + + + asterisk + + asterisk + + 2000 + 5060 + 5061 + + 2427 + 2428 + + + asterisk + + + + + + Disable + Disable + false + + 2000 + + 2000 + + 2000 + + 5060 + + 5060 + + 5060 + false + + 120 + + + + true + 3 + + apps37sccp.1-4-4-0 + + 0 + 0 + 1 + + 0 + + 1396020461-83a09e65-e62e-4db3-9e03-e3d0cdfd7093 + + English_United_States + 1 + en_US + 9.0.0.0(1) + iso-8859-1 + + United_States + + United_States + 64 + 9.0.0.0(1) + + 0 + http://asterisk:8080/ccmcip/authenticate.jsp + http://asterisk:8080/ccmcip/xmldirectory.jsp + + http://asterisk:8080/ccmcip/GetTelecasterHelpText.jsp + + + http://asterisk:8080/ccmcip/getservicesmenu.jsp + 96 + 0 + 96 + 1 + 5 + 1 + 0 + 0 + 0 + false + 0 + 0 + 0 + + + 3804 + asterisk + + + + + false + 1 + + + + + *81 + *82 + *83 + *84 + *85 + + + + 2 + + Missed Calls + Application:Cisco/MissedCalls + + + + + Voicemail + Application:Cisco/Voicemail + + + + + Received Calls + Application:Cisco/ReceivedCalls + + + + + Placed Calls + Application:Cisco/PlacedCalls + + + + + Personal Directory + Application:Cisco/PersonalDirectory + + + + + Corporate Directory + Application:Cisco/CorporateDirectory + + + + + diff --git a/install.php b/install.php index db44d88..f45ba5a 100644 --- a/install.php +++ b/install.php @@ -260,7 +260,7 @@ function Get_DB_config($sccp_compatible) { 'softkeyset' => array('def_modify' => "softkeyset") ), 'sccpline' => array( - 'directed_pickup' => array('create' => "enum('on','off') NOT NULL default NULL", 'modify' => "enum('on','off')"), + 'directed_pickup' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"), 'directed_pickup_context' => array('create' => "VARCHAR(100) NULL DEFAULT NULL"), 'pickup_modeanswer' => array('create' => "enum('on','off') NULL default NULL", 'modify' => "enum('on','off')"), 'namedcallgroup' => array('create' => "VARCHAR(100) NULL DEFAULT NULL AFTER `setvar`", 'modify' => "VARCHAR(100)"), diff --git a/views/server.info.php b/views/server.info.php index 59a3e72..0870187 100644 --- a/views/server.info.php +++ b/views/server.info.php @@ -37,14 +37,23 @@ if (!empty($this->sccpvalues['SccpDBmodel'])) { } /* print_r("
Request:
");
- //$asss = $this->extconfigs->validate_init_path($this->sccppath["asterisk"],$this->sccpvalues,$driver_ver);
-
- $asss = $this->sccpvalues;
+// $asss = $this->extconfigs->validate_init_path($this->sccppath["asterisk"],$this->sccpvalues,$driver_ver);
+        global $amp_conf;
+print_r($amp_conf);
+ 
+/*
+ $asss = $this->srvinterface->getеtestChanSCC();
+// $asss = $this->sccpvalues;
  $json = '';
  print_r("
"); print_r($asss); print_r("
"); - + print_r($asss['a']['JSON']); + print_r("
"); + print_r("DIRECT START"); + print_r("
"); + print_r($this->srvinterface->t_get_meta_data()); + print("
"); */ // $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK');