@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | file_put_contents('/etc/iptables/iptables.mikopbx', implode("\n", $arr_command)); |
86 | 86 | file_put_contents( |
87 | 87 | '/etc/iptables/iptables.mikopbx', |
88 | - "\n" . implode("\n", $arr_commands_custom), |
|
88 | + "\n".implode("\n", $arr_commands_custom), |
|
89 | 89 | FILE_APPEND |
90 | 90 | ); |
91 | 91 | file_put_contents( |
92 | 92 | '/etc/iptables/iptables.mikopbx', |
93 | - "\n" . $dropCommand, |
|
93 | + "\n".$dropCommand, |
|
94 | 94 | FILE_APPEND |
95 | 95 | ); |
96 | 96 | $systemctlPath = Util::which('systemctl'); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | $data_port = ''; |
137 | 137 | if (trim($dport) !== '') { |
138 | - $data_port = '--dport ' . $dport; |
|
138 | + $data_port = '--dport '.$dport; |
|
139 | 139 | } |
140 | 140 | $other_data = trim($other_data); |
141 | 141 | |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | continue; |
169 | 169 | } |
170 | 170 | $other_data = "-p {$rule->protocol}"; |
171 | - $other_data .= ($network_filter === null) ? '' : ' -s ' . $network_filter->permit; |
|
171 | + $other_data .= ($network_filter === null) ? '' : ' -s '.$network_filter->permit; |
|
172 | 172 | if ($rule->protocol === 'icmp') { |
173 | - $port = ''; |
|
173 | + $port = ''; |
|
174 | 174 | $other_data .= ' --icmp-type echo-request'; |
175 | 175 | } |
176 | 176 |
@@ -166,7 +166,7 @@ |
||
166 | 166 | } elseif ( |
167 | 167 | 'event' === $type |
168 | 168 | && $parameters['Event'] === 'UserEvent' |
169 | - && "{$pingTube}Pong" === $parameters['UserEvent']) { |
|
169 | + && "{$pingTube}pong" === $parameters['UserEvent']) { |
|
170 | 170 | // Ответ получен. |
171 | 171 | $result = true; |
172 | 172 | break; |
@@ -338,7 +338,8 @@ discard block |
||
338 | 338 | * Читает данные из сокета. Если возникает ошибка возвращает ее. |
339 | 339 | * @return array |
340 | 340 | */ |
341 | - private function getDataFromSocket() { |
|
341 | + private function getDataFromSocket() |
|
342 | + { |
|
342 | 343 | $response = []; |
343 | 344 | if(!is_resource($this->socket)){ |
344 | 345 | $response['error'] = 'Socket not init.'; |
@@ -349,11 +350,11 @@ discard block |
||
349 | 350 | if($resultFgets !== false){ |
350 | 351 | $buffer = trim($resultFgets); |
351 | 352 | $response['data'] = $buffer; |
352 | - }else{ |
|
353 | + } else{ |
|
353 | 354 | $response['error'] = 'Read data error.'; |
354 | 355 | } |
355 | 356 | |
356 | - }catch (\Exception $e){ |
|
357 | + } catch (\Exception $e){ |
|
357 | 358 | $response['error'] = $e->getMessage(); |
358 | 359 | } |
359 | 360 | |
@@ -364,7 +365,8 @@ discard block |
||
364 | 365 | * Читает данные из сокета |
365 | 366 | * @return string |
366 | 367 | */ |
367 | - private function getStringDataFromSocket() { |
|
368 | + private function getStringDataFromSocket() |
|
369 | + { |
|
368 | 370 | $response = $this->getDataFromSocket(); |
369 | 371 | return $response['data'] ?? ''; |
370 | 372 | } |
@@ -384,7 +386,7 @@ discard block |
||
384 | 386 | if($resultWrite === false){ |
385 | 387 | $result = false; |
386 | 388 | } |
387 | - }catch (\Exception $e){ |
|
389 | + } catch (\Exception $e){ |
|
388 | 390 | $result = false; |
389 | 391 | } |
390 | 392 | return $result; |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | public function __construct($config = null, $optconfig = []) |
89 | 89 | { |
90 | 90 | // load config |
91 | - if ( !is_null($config) && file_exists($config)) { |
|
91 | + if (!is_null($config) && file_exists($config)) { |
|
92 | 92 | $arrData = parse_ini_file($config, true); |
93 | - $this->config = ($arrData === false)?[]:$arrData; |
|
93 | + $this->config = ($arrData === false) ? [] : $arrData; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | // If optconfig is specified, stuff vals and vars into 'asmanager' config array. |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // add default values to config for uninitialized values |
102 | - if ( ! isset($this->config['asmanager']['server'])) { |
|
102 | + if (!isset($this->config['asmanager']['server'])) { |
|
103 | 103 | $this->config['asmanager']['server'] = 'localhost'; |
104 | 104 | } |
105 | - if ( ! isset($this->config['asmanager']['port'])) { |
|
105 | + if (!isset($this->config['asmanager']['port'])) { |
|
106 | 106 | $this->config['asmanager']['port'] = 5038; |
107 | 107 | } |
108 | - if ( ! isset($this->config['asmanager']['username'])) { |
|
108 | + if (!isset($this->config['asmanager']['username'])) { |
|
109 | 109 | $this->config['asmanager']['username'] = 'phpagi'; |
110 | 110 | } |
111 | - if ( ! isset($this->config['asmanager']['secret'])) { |
|
111 | + if (!isset($this->config['asmanager']['secret'])) { |
|
112 | 112 | $this->config['asmanager']['secret'] = 'phpagi'; |
113 | 113 | } |
114 | 114 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $req .= "$var: $val\r\n"; |
136 | 136 | } |
137 | 137 | $req .= "\r\n"; |
138 | - if ( ! is_resource($this->socket)) { |
|
138 | + if (!is_resource($this->socket)) { |
|
139 | 139 | return []; |
140 | 140 | } |
141 | 141 | $this->sendDataToSocket($req); |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | do { |
150 | 150 | $type = ''; |
151 | 151 | $parameters = []; |
152 | - if ( ! is_resource($this->socket)) { |
|
152 | + if (!is_resource($this->socket)) { |
|
153 | 153 | return false; |
154 | 154 | } |
155 | 155 | $buffer = $this->getStringDataFromSocket(); |
156 | 156 | while (!empty($buffer)) { |
157 | 157 | $a = strpos($buffer, ':'); |
158 | 158 | if ($a) { |
159 | - if ( ! count($parameters)) { |
|
159 | + if (!count($parameters)) { |
|
160 | 160 | $type = strtolower(substr($buffer, 0, $a)); |
161 | 161 | } |
162 | 162 | $parameters[substr($buffer, 0, $a)] = substr($buffer, $a + 2); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | // Таймаут ожидания. |
180 | 180 | break; |
181 | 181 | } |
182 | - } while ( ! $timeout); |
|
182 | + } while (!$timeout); |
|
183 | 183 | |
184 | 184 | return $result; |
185 | 185 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | */ |
195 | 195 | public function sendRequestTimeout($action, $parameters = []) |
196 | 196 | { |
197 | - if ( ! is_resource($this->socket) && !$this->connectDefault()) { |
|
197 | + if (!is_resource($this->socket) && !$this->connectDefault()) { |
|
198 | 198 | return []; |
199 | 199 | } |
200 | 200 | // Прописываем обязательные поля. |
@@ -207,15 +207,15 @@ discard block |
||
207 | 207 | $req .= "\r\n"; |
208 | 208 | |
209 | 209 | $result = $this->sendDataToSocket($req); |
210 | - if(!$result) { |
|
210 | + if (!$result) { |
|
211 | 211 | usleep(500000); |
212 | - if($this->connectDefault()){ |
|
212 | + if ($this->connectDefault()) { |
|
213 | 213 | $result = $this->sendDataToSocket($req); |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | 217 | $response = []; |
218 | - if($result){ |
|
218 | + if ($result) { |
|
219 | 219 | $response = $this->waitResponse(true); |
220 | 220 | } |
221 | 221 | return $response; |
@@ -244,23 +244,23 @@ discard block |
||
244 | 244 | $parameters = []; |
245 | 245 | $response = []; |
246 | 246 | |
247 | - if(!$this->waitResponseGetInitialData($response)) { |
|
247 | + if (!$this->waitResponseGetInitialData($response)) { |
|
248 | 248 | return $parameters; |
249 | 249 | } |
250 | - $buffer = $response['data']??''; |
|
250 | + $buffer = $response['data'] ?? ''; |
|
251 | 251 | while ($buffer !== '') { |
252 | 252 | $a = strpos($buffer, ':'); |
253 | 253 | if ($a) { |
254 | 254 | $event_text = substr($buffer, $a + 2); |
255 | 255 | $this->waitResponseGetEventType($parameters, $buffer, $a, $type); |
256 | - $this->waitResponseReadFollowsPart($event_text,$parameters); |
|
256 | + $this->waitResponseReadFollowsPart($event_text, $parameters); |
|
257 | 257 | $this->waitResponseReadCompletePart($event_text, $parameters); |
258 | 258 | $parameters[substr($buffer, 0, $a)] = $event_text; |
259 | 259 | } |
260 | 260 | $buffer = $this->getStringDataFromSocket(); |
261 | 261 | } |
262 | 262 | $this->waitResponseProcessResponse($type, $timeout, $allow_timeout, $parameters); |
263 | - } while ($type !== 'response' && ! $timeout); |
|
263 | + } while ($type !== 'response' && !$timeout); |
|
264 | 264 | |
265 | 265 | return $parameters; |
266 | 266 | } |
@@ -271,18 +271,18 @@ discard block |
||
271 | 271 | * @return bool |
272 | 272 | */ |
273 | 273 | private function waitResponseGetInitialData(& $response):bool{ |
274 | - if ( !is_resource($this->socket) && !$this->connectDefault()) { |
|
274 | + if (!is_resource($this->socket) && !$this->connectDefault()) { |
|
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | $result = true; |
278 | 278 | $response = $this->getDataFromSocket(); |
279 | - if(isset($response['error'])) { |
|
279 | + if (isset($response['error'])) { |
|
280 | 280 | usleep(500000); |
281 | - if($this->connectDefault()){ |
|
281 | + if ($this->connectDefault()) { |
|
282 | 282 | $response = $this->getDataFromSocket(); |
283 | 283 | } |
284 | 284 | } |
285 | - if(isset($response['error'])) { |
|
285 | + if (isset($response['error'])) { |
|
286 | 286 | $result = false; |
287 | 287 | } |
288 | 288 | return $result; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @param $type |
318 | 318 | */ |
319 | 319 | private function waitResponseGetEventType($parameters, $buffer, $a, & $type):void{ |
320 | - if ( ! count($parameters)) { |
|
320 | + if (!count($parameters)) { |
|
321 | 321 | $type = strtolower(substr($buffer, 0, $a)); |
322 | 322 | } |
323 | 323 | } |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | * @param $parameters |
329 | 329 | */ |
330 | 330 | private function waitResponseReadFollowsPart($event_text, & $parameters):void{ |
331 | - if ( ($event_text === 'Follows') && !count($parameters)) { |
|
331 | + if (($event_text === 'Follows') && !count($parameters)) { |
|
332 | 332 | // A follows response means there is a miltiline field that follows. |
333 | 333 | $parameters['data'] = ''; |
334 | 334 | $buff = $this->getStringDataFromSocket(); |
335 | 335 | while (strpos($buff, '--END ') !== 0) { |
336 | 336 | $parameters['data'] .= $buff; |
337 | - $buff = $this->getStringDataFromSocket(); |
|
337 | + $buff = $this->getStringDataFromSocket(); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
@@ -360,11 +360,11 @@ discard block |
||
360 | 360 | 'Following are Events for each Outbound registration' => 'OutboundRegistrationDetailComplete', |
361 | 361 | 'A listing of Endpoints follows, presented as EndpointList events' => 'EndpointListComplete' |
362 | 362 | ]; |
363 | - $eventsAsNotArray = [ 'EndpointDetailComplete' ]; |
|
363 | + $eventsAsNotArray = ['EndpointDetailComplete']; |
|
364 | 364 | |
365 | - $endString = $settings[$event_text]??false; |
|
366 | - if($endString !== false){ |
|
367 | - $NotArray = !in_array($endString,$eventsAsNotArray); |
|
365 | + $endString = $settings[$event_text] ?? false; |
|
366 | + if ($endString !== false) { |
|
367 | + $NotArray = !in_array($endString, $eventsAsNotArray); |
|
368 | 368 | $this->waitResponseGetSubData($parameters, $endString, $NotArray); |
369 | 369 | } |
370 | 370 | } |
@@ -375,20 +375,20 @@ discard block |
||
375 | 375 | */ |
376 | 376 | private function getDataFromSocket() { |
377 | 377 | $response = []; |
378 | - if(!is_resource($this->socket)){ |
|
378 | + if (!is_resource($this->socket)) { |
|
379 | 379 | $response['error'] = 'Socket not init.'; |
380 | 380 | return $response; |
381 | 381 | } |
382 | 382 | try { |
383 | 383 | $resultFgets = fgets($this->socket, 4096); |
384 | - if($resultFgets !== false){ |
|
384 | + if ($resultFgets !== false) { |
|
385 | 385 | $buffer = trim($resultFgets); |
386 | 386 | $response['data'] = $buffer; |
387 | - }else{ |
|
387 | + } else { |
|
388 | 388 | $response['error'] = 'Read data error.'; |
389 | 389 | } |
390 | 390 | |
391 | - }catch (\Exception $e){ |
|
391 | + } catch (\Exception $e) { |
|
392 | 392 | $response['error'] = $e->getMessage(); |
393 | 393 | } |
394 | 394 | |
@@ -410,16 +410,16 @@ discard block |
||
410 | 410 | * @return bool |
411 | 411 | */ |
412 | 412 | private function sendDataToSocket($req) : bool{ |
413 | - if(!is_resource($this->socket)){ |
|
413 | + if (!is_resource($this->socket)) { |
|
414 | 414 | return false; |
415 | 415 | } |
416 | 416 | $result = true; |
417 | 417 | try { |
418 | 418 | $resultWrite = fwrite($this->socket, $req); |
419 | - if($resultWrite === false){ |
|
419 | + if ($resultWrite === false) { |
|
420 | 420 | $result = false; |
421 | 421 | } |
422 | - }catch (\Exception $e){ |
|
422 | + } catch (\Exception $e) { |
|
423 | 423 | $result = false; |
424 | 424 | } |
425 | 425 | return $result; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | |
428 | 428 | private function waitResponseGetSubData(&$parameters, $end_string = '', $event_as_array = true): void |
429 | 429 | { |
430 | - if ( ! is_array($parameters)) { |
|
430 | + if (!is_array($parameters)) { |
|
431 | 431 | $parameters = []; |
432 | 432 | } |
433 | 433 | if (empty($end_string)) { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $value = ''; |
440 | 440 | $buff = $this->getStringDataFromSocket().$value; |
441 | 441 | $a_pos = strpos($buff, ':'); |
442 | - if ( ! $a_pos) { |
|
442 | + if (!$a_pos) { |
|
443 | 443 | if (count($m) > 0) { |
444 | 444 | if ($event_as_array) { |
445 | 445 | $parameters['data'][$m['Event']][] = $m; |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | { |
492 | 492 | [$usec, $sec] = explode(" ", microtime()); |
493 | 493 | |
494 | - return ((float)$usec + (float)$sec); |
|
494 | + return ((float) $usec + (float) $sec); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | /** |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | while ($buffer !== '') { |
522 | 522 | $pos = strpos($buffer, ':'); |
523 | 523 | if ($pos) { |
524 | - if ( ! count($parameters)) { |
|
524 | + if (!count($parameters)) { |
|
525 | 525 | $type = strtolower(substr($buffer, 0, $pos)); |
526 | 526 | } |
527 | 527 | $parameters[substr($buffer, 0, $pos)] = substr($buffer, $pos + 2); |
@@ -530,10 +530,10 @@ discard block |
||
530 | 530 | } |
531 | 531 | if ($type === '' && count($this->Ping()) === 0) { |
532 | 532 | $timeout = $allow_timeout; |
533 | - } elseif (stripos($type, 'event')!==false ) { |
|
533 | + } elseif (stripos($type, 'event') !== false) { |
|
534 | 534 | $this->processEvent($parameters); |
535 | 535 | } |
536 | - } while ( ! $timeout); |
|
536 | + } while (!$timeout); |
|
537 | 537 | |
538 | 538 | return $parameters; |
539 | 539 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | if (strpos($server, ':') !== false) { |
573 | 573 | $c = explode(':', $server); |
574 | 574 | $this->server = $c[0]; |
575 | - $this->port = (int)$c[1]; |
|
575 | + $this->port = (int) $c[1]; |
|
576 | 576 | } else { |
577 | 577 | $this->server = $server; |
578 | 578 | $this->port = $this->config['asmanager']['port']; |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | $req .= "$var: $val\r\n"; |
627 | 627 | } |
628 | 628 | $req .= "\r\n"; |
629 | - if ( ! is_resource($this->socket)) { |
|
629 | + if (!is_resource($this->socket)) { |
|
630 | 630 | return []; |
631 | 631 | } |
632 | 632 | $this->sendDataToSocket($req); |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | if (null !== $channels) { |
771 | 771 | foreach ($channels as $chan) { |
772 | 772 | if ($group === true) { |
773 | - if ( ! isset($chan['Linkedid'])) { |
|
773 | + if (!isset($chan['Linkedid'])) { |
|
774 | 774 | continue; |
775 | 775 | } |
776 | 776 | $channels_id[$chan['Linkedid']][] = $chan['Channel']; |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | if ($format) { |
932 | 932 | $parameters['Format'] = $format; |
933 | 933 | } |
934 | - if ( ! is_null($file)) { |
|
934 | + if (!is_null($file)) { |
|
935 | 935 | $parameters['Mix'] = ($mix) ? 'true' : 'false'; |
936 | 936 | } |
937 | 937 | |
@@ -1075,8 +1075,8 @@ discard block |
||
1075 | 1075 | 'ActionID' => $actionid |
1076 | 1076 | ]; |
1077 | 1077 | $keys = array_keys($parameters); |
1078 | - foreach ($keys as $key){ |
|
1079 | - if(empty($parameters[$key])){ |
|
1078 | + foreach ($keys as $key) { |
|
1079 | + if (empty($parameters[$key])) { |
|
1080 | 1080 | unset($parameters[$key]); |
1081 | 1081 | } |
1082 | 1082 | } |
@@ -1348,7 +1348,7 @@ discard block |
||
1348 | 1348 | 'Not in use' => 'OK', |
1349 | 1349 | 'Busy' => 'OK', |
1350 | 1350 | ]; |
1351 | - $state = $state_array[$peer['DeviceState']] ?? 'UNKNOWN'; |
|
1351 | + $state = $state_array[$peer['DeviceState']] ?? 'UNKNOWN'; |
|
1352 | 1352 | |
1353 | 1353 | $peers[] = [ |
1354 | 1354 | 'id' => $peer['ObjectName'], |
@@ -1371,12 +1371,12 @@ discard block |
||
1371 | 1371 | $res = $this->sendRequestTimeout('SIPpeers'); |
1372 | 1372 | if (isset($res['data']) && $res['data'] != null && $res['data']['PeerEntry'] != null) { |
1373 | 1373 | foreach ($res['data']['PeerEntry'] as $peer) { |
1374 | - if ( ! is_numeric($peer['ObjectName'])) { |
|
1374 | + if (!is_numeric($peer['ObjectName'])) { |
|
1375 | 1375 | continue; |
1376 | 1376 | } |
1377 | 1377 | // if ('Unmonitored' == $peer['Status']) continue; |
1378 | 1378 | $arr_status = explode(' ', $peer['Status']); |
1379 | - $peers[] = ['id' => $peer['ObjectName'], 'state' => strtoupper($arr_status[0]),]; |
|
1379 | + $peers[] = ['id' => $peer['ObjectName'], 'state' => strtoupper($arr_status[0]), ]; |
|
1380 | 1380 | } |
1381 | 1381 | } |
1382 | 1382 | |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | if (isset($res['data']['ContactStatusDetail'])) { |
1418 | 1418 | $result = $res['data']['ContactStatusDetail']; |
1419 | 1419 | } |
1420 | - $result['state'] = isset($result['URI']) && ! empty($result['URI']) ? 'OK' : 'UNKNOWN'; |
|
1420 | + $result['state'] = isset($result['URI']) && !empty($result['URI']) ? 'OK' : 'UNKNOWN'; |
|
1421 | 1421 | |
1422 | 1422 | return $result; |
1423 | 1423 | } |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | { |
1442 | 1442 | $result = []; |
1443 | 1443 | $conf_data = $this->MeetmeList($conference); |
1444 | - if ( ! isset($conf_data['data']['MeetmeList'])) { |
|
1444 | + if (!isset($conf_data['data']['MeetmeList'])) { |
|
1445 | 1445 | return $result; |
1446 | 1446 | } |
1447 | 1447 | foreach ($conf_data['data']['MeetmeList'] as $user_data) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $res->success = true; |
64 | 64 | $di = Di::getDefault(); |
65 | 65 | $dirsConfig = $di->getShared('config'); |
66 | - $filenameTmp = $dirsConfig->path('www.downloadCacheDir') . '/' . __FUNCTION__ . '_' . time() . '.txt'; |
|
66 | + $filenameTmp = $dirsConfig->path('www.downloadCacheDir').'/'.__FUNCTION__.'_'.time().'.txt'; |
|
67 | 67 | |
68 | 68 | $content = self::prepareSysyinfoContent(); |
69 | 69 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $content .= self::getAsteriskInfo(); |
98 | 98 | $content .= self::getChangedConfigFiles(); |
99 | 99 | $content .= self::getCorruptedFiles(); |
100 | - $content .= PHP_EOL . PHP_EOL; |
|
100 | + $content .= PHP_EOL.PHP_EOL; |
|
101 | 101 | |
102 | 102 | return $content; |
103 | 103 | } |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | public static function getDate(): string |
111 | 111 | { |
112 | 112 | $content = '───────────────────────────────────────── Date ─────────────────────────────────────────'; |
113 | - $content .= PHP_EOL . PHP_EOL; |
|
113 | + $content .= PHP_EOL.PHP_EOL; |
|
114 | 114 | $datePath = Util::which('date'); |
115 | 115 | $ut = []; |
116 | 116 | Util::mwExec($datePath, $ut); |
117 | - $content .= implode(PHP_EOL, $ut). PHP_EOL; |
|
118 | - $content .= PHP_EOL . PHP_EOL; |
|
117 | + $content .= implode(PHP_EOL, $ut).PHP_EOL; |
|
118 | + $content .= PHP_EOL.PHP_EOL; |
|
119 | 119 | return $content; |
120 | 120 | } |
121 | 121 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | { |
129 | 129 | $version = PbxSettings::getValueByKey('PBXVersion'); |
130 | 130 | $content = '─────────────────────────────────────── PBXVersion ───────────────────────────────────────'; |
131 | - $content .= PHP_EOL . PHP_EOL; |
|
132 | - $content .= $version . PHP_EOL; |
|
133 | - $content .= PHP_EOL . PHP_EOL; |
|
131 | + $content .= PHP_EOL.PHP_EOL; |
|
132 | + $content .= $version.PHP_EOL; |
|
133 | + $content .= PHP_EOL.PHP_EOL; |
|
134 | 134 | return $content; |
135 | 135 | } |
136 | 136 | |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | public static function getUpTime(): string |
143 | 143 | { |
144 | 144 | $content = '───────────────────────────────────────── Uptime ─────────────────────────────────────────'; |
145 | - $content .= PHP_EOL . PHP_EOL; |
|
145 | + $content .= PHP_EOL.PHP_EOL; |
|
146 | 146 | $uptimePath = Util::which('uptime'); |
147 | 147 | $ut = []; |
148 | 148 | Util::mwExec($uptimePath, $ut); |
149 | - $uptime = implode(PHP_EOL, $ut); |
|
150 | - $content .= $uptime . PHP_EOL; |
|
151 | - $content .= PHP_EOL . PHP_EOL; |
|
149 | + $uptime = implode(PHP_EOL, $ut); |
|
150 | + $content .= $uptime.PHP_EOL; |
|
151 | + $content .= PHP_EOL.PHP_EOL; |
|
152 | 152 | return $content; |
153 | 153 | } |
154 | 154 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public static function getCpu(): string |
161 | 161 | { |
162 | 162 | $content = '───────────────────────────────────────── CPU load ───────────────────────────────────────'; |
163 | - $content .= PHP_EOL . PHP_EOL; |
|
163 | + $content .= PHP_EOL.PHP_EOL; |
|
164 | 164 | $ut = []; |
165 | 165 | $grepPath = Util::which('grep'); |
166 | 166 | $mpstatPath = Util::which('mpstat'); |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | $rv = 100; |
173 | 173 | } |
174 | 174 | |
175 | - $content .= round($rv, 2) . PHP_EOL; |
|
176 | - $content .= PHP_EOL . PHP_EOL; |
|
175 | + $content .= round($rv, 2).PHP_EOL; |
|
176 | + $content .= PHP_EOL.PHP_EOL; |
|
177 | 177 | return $content; |
178 | 178 | } |
179 | 179 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | public static function getMemInfo(): string |
186 | 186 | { |
187 | 187 | $content = '───────────────────────────────────────── MemInfo ────────────────────────────────────────'; |
188 | - $content .= PHP_EOL . PHP_EOL; |
|
188 | + $content .= PHP_EOL.PHP_EOL; |
|
189 | 189 | $out = []; |
190 | 190 | $catPath = Util::which('cat'); |
191 | 191 | $grepPath = Util::which('grep'); |
@@ -193,19 +193,19 @@ discard block |
||
193 | 193 | $freePath = Util::which('free'); |
194 | 194 | Util::mwExec("{$catPath} /proc/meminfo | {$grepPath} -C 0 'Inactive:' | {$awkPath} '{print $2}'", $out); |
195 | 195 | $inactive = round((1 * implode($out)) / 1024, 2); |
196 | - $content .= "inactive = {$inactive}" . PHP_EOL; |
|
196 | + $content .= "inactive = {$inactive}".PHP_EOL; |
|
197 | 197 | Util::mwExec("{$catPath} /proc/meminfo | {$grepPath} -C 0 'MemFree:' | {$awkPath} '{print $2}'", $out); |
198 | 198 | $free = round((1 * implode($out)) / 1024, 2); |
199 | - $content .= "free = {$free}" . PHP_EOL; |
|
199 | + $content .= "free = {$free}".PHP_EOL; |
|
200 | 200 | Util::mwExec("{$catPath} /proc/meminfo | {$grepPath} -C 0 'MemTotal:' | {$awkPath} '{print $2}'", $out); |
201 | 201 | $total = round((1 * implode($out)) / 1024, 2); |
202 | - $content .= "total = {$total}" . PHP_EOL . PHP_EOL; |
|
202 | + $content .= "total = {$total}".PHP_EOL.PHP_EOL; |
|
203 | 203 | |
204 | 204 | $content .= '────────────────────────────────────────── Free ─────────────────────────────────────────'; |
205 | - $content .= PHP_EOL . PHP_EOL; |
|
205 | + $content .= PHP_EOL.PHP_EOL; |
|
206 | 206 | Util::mwExec($freePath, $out); |
207 | - $content .= implode(PHP_EOL, $out) . PHP_EOL; |
|
208 | - $content .= PHP_EOL . PHP_EOL; |
|
207 | + $content .= implode(PHP_EOL, $out).PHP_EOL; |
|
208 | + $content .= PHP_EOL.PHP_EOL; |
|
209 | 209 | return $content; |
210 | 210 | } |
211 | 211 | |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | private static function getStorageInfo(): string |
218 | 218 | { |
219 | 219 | $content = '─────────────────────────────────────────── df ───────────────────────────────────────────'; |
220 | - $content .= PHP_EOL . PHP_EOL; |
|
220 | + $content .= PHP_EOL.PHP_EOL; |
|
221 | 221 | $dfPath = Util::which('df'); |
222 | 222 | $out = []; |
223 | 223 | Util::mwExec("{$dfPath} -h", $out); |
224 | 224 | $dfOut = implode(PHP_EOL, $out); |
225 | - $content .= $dfOut . PHP_EOL; |
|
226 | - $content .= PHP_EOL . PHP_EOL; |
|
225 | + $content .= $dfOut.PHP_EOL; |
|
226 | + $content .= PHP_EOL.PHP_EOL; |
|
227 | 227 | return $content; |
228 | 228 | } |
229 | 229 | |
@@ -235,13 +235,13 @@ discard block |
||
235 | 235 | private static function getIfconfigInfo(): string |
236 | 236 | { |
237 | 237 | $content = '─────────────────────────────────────── ifconfig ──────────────────────────────────────'; |
238 | - $content .= PHP_EOL . PHP_EOL; |
|
238 | + $content .= PHP_EOL.PHP_EOL; |
|
239 | 239 | $ifconfigPath = Util::which('ifconfig'); |
240 | 240 | $out = []; |
241 | 241 | Util::mwExec($ifconfigPath, $out); |
242 | 242 | $ifconfigOut = implode(PHP_EOL, $out); |
243 | - $content .= $ifconfigOut . PHP_EOL; |
|
244 | - $content .= PHP_EOL . PHP_EOL; |
|
243 | + $content .= $ifconfigOut.PHP_EOL; |
|
244 | + $content .= PHP_EOL.PHP_EOL; |
|
245 | 245 | return $content; |
246 | 246 | } |
247 | 247 | |
@@ -253,13 +253,13 @@ discard block |
||
253 | 253 | private static function getArpInfo(): string |
254 | 254 | { |
255 | 255 | $content = '─────────────────────────────────────────── arp ──────────────────────────────────────────'; |
256 | - $content .= PHP_EOL . PHP_EOL; |
|
256 | + $content .= PHP_EOL.PHP_EOL; |
|
257 | 257 | $arpPath = Util::which('arp'); |
258 | 258 | $out = []; |
259 | 259 | Util::mwExec($arpPath, $out); |
260 | 260 | $arpOut = implode(PHP_EOL, $out); |
261 | - $content .= $arpOut . PHP_EOL; |
|
262 | - $content .= PHP_EOL . PHP_EOL; |
|
261 | + $content .= $arpOut.PHP_EOL; |
|
262 | + $content .= PHP_EOL.PHP_EOL; |
|
263 | 263 | return $content; |
264 | 264 | } |
265 | 265 | |
@@ -271,13 +271,13 @@ discard block |
||
271 | 271 | private static function getRouteInfo(): string |
272 | 272 | { |
273 | 273 | $content = '────────────────────────────────────────── route ─────────────────────────────────────────'; |
274 | - $content .= PHP_EOL . PHP_EOL; |
|
274 | + $content .= PHP_EOL.PHP_EOL; |
|
275 | 275 | $routePath = Util::which('route'); |
276 | 276 | $out = []; |
277 | 277 | Util::mwExec($routePath, $out); |
278 | 278 | $routeOut = implode(PHP_EOL, $out); |
279 | - $content .= $routeOut . PHP_EOL; |
|
280 | - $content .= PHP_EOL . PHP_EOL; |
|
279 | + $content .= $routeOut.PHP_EOL; |
|
280 | + $content .= PHP_EOL.PHP_EOL; |
|
281 | 281 | return $content; |
282 | 282 | } |
283 | 283 | |
@@ -289,13 +289,13 @@ discard block |
||
289 | 289 | private static function getIptablesInfo(): string |
290 | 290 | { |
291 | 291 | $content = '────────────────────────────────────────── iptables ──────────────────────────────────────'; |
292 | - $content .= PHP_EOL . PHP_EOL; |
|
292 | + $content .= PHP_EOL.PHP_EOL; |
|
293 | 293 | $iptablesPath = Util::which('iptables'); |
294 | 294 | $out = []; |
295 | 295 | Util::mwExec("{$iptablesPath} -S", $out); |
296 | 296 | $iptablesOut = implode(PHP_EOL, $out); |
297 | - $content .= $iptablesOut . PHP_EOL; |
|
298 | - $content .= PHP_EOL . PHP_EOL; |
|
297 | + $content .= $iptablesOut.PHP_EOL; |
|
298 | + $content .= PHP_EOL.PHP_EOL; |
|
299 | 299 | return $content; |
300 | 300 | } |
301 | 301 | |
@@ -307,17 +307,17 @@ discard block |
||
307 | 307 | private static function getPingInfo(): string |
308 | 308 | { |
309 | 309 | $content = '──────────────────────────────────────────── ping ────────────────────────────────────────'; |
310 | - $content .= PHP_EOL . PHP_EOL; |
|
310 | + $content .= PHP_EOL.PHP_EOL; |
|
311 | 311 | $pingPath = Util::which('ping'); |
312 | 312 | $out = []; |
313 | 313 | Util::mwExec("{$pingPath} 8.8.8.8 -w 2", $out); |
314 | 314 | $pingOut = implode(PHP_EOL, $out); |
315 | 315 | Util::mwExec("{$pingPath} ya.ru -w 2", $out); |
316 | 316 | $ping2Out = implode(PHP_EOL, $out); |
317 | - $content .= $pingOut . PHP_EOL; |
|
318 | - $content .= PHP_EOL . PHP_EOL; |
|
319 | - $content .= $ping2Out . PHP_EOL; |
|
320 | - $content .= PHP_EOL . PHP_EOL; |
|
317 | + $content .= $pingOut.PHP_EOL; |
|
318 | + $content .= PHP_EOL.PHP_EOL; |
|
319 | + $content .= $ping2Out.PHP_EOL; |
|
320 | + $content .= PHP_EOL.PHP_EOL; |
|
321 | 321 | return $content; |
322 | 322 | } |
323 | 323 | |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | $opensslPath = Util::which('openssl'); |
332 | 332 | |
333 | 333 | $content = '─────────────────────────────────────── openssl ─────────────────────────────────────────'; |
334 | - $content .= PHP_EOL . PHP_EOL; |
|
334 | + $content .= PHP_EOL.PHP_EOL; |
|
335 | 335 | $out = []; |
336 | 336 | Util::mwExec("{$opensslPath} s_client -connect lic.miko.ru:443", $out); |
337 | 337 | $opensslOut = implode(PHP_EOL, $out); |
338 | - $content .= $opensslOut . PHP_EOL; |
|
339 | - $content .= PHP_EOL . PHP_EOL; |
|
338 | + $content .= $opensslOut.PHP_EOL; |
|
339 | + $content .= PHP_EOL.PHP_EOL; |
|
340 | 340 | return $content; |
341 | 341 | } |
342 | 342 | |
@@ -350,23 +350,23 @@ discard block |
||
350 | 350 | $asteriskPath = Util::which('asterisk'); |
351 | 351 | |
352 | 352 | $content = '────────────────────────────────── asterisk registrations ────────────────────────────────'; |
353 | - $content .= PHP_EOL . PHP_EOL; |
|
353 | + $content .= PHP_EOL.PHP_EOL; |
|
354 | 354 | Util::mwExec("{$asteriskPath} -rx 'pjsip show registrations' ", $out); |
355 | 355 | $asteriskOut = implode(PHP_EOL, $out); |
356 | - $content .= $asteriskOut . PHP_EOL; |
|
356 | + $content .= $asteriskOut.PHP_EOL; |
|
357 | 357 | |
358 | 358 | $content .= '────────────────────────────────── asterisk endpoints ───────────────────────────────────'; |
359 | - $content .= PHP_EOL . PHP_EOL; |
|
359 | + $content .= PHP_EOL.PHP_EOL; |
|
360 | 360 | Util::mwExec("{$asteriskPath} -rx 'pjsip show endpoints' ", $out); |
361 | 361 | $asteriskOut = implode(PHP_EOL, $out); |
362 | - $content .= $asteriskOut . PHP_EOL; |
|
362 | + $content .= $asteriskOut.PHP_EOL; |
|
363 | 363 | |
364 | 364 | $content .= '─────────────────────────────────── asterisk contacts ───────────────────────────────────'; |
365 | - $content .= PHP_EOL . PHP_EOL; |
|
365 | + $content .= PHP_EOL.PHP_EOL; |
|
366 | 366 | Util::mwExec("{$asteriskPath} -rx 'pjsip show contacts' ", $out); |
367 | 367 | $asteriskOut = implode(PHP_EOL, $out); |
368 | - $content .= $asteriskOut . PHP_EOL; |
|
369 | - $content .= PHP_EOL . PHP_EOL; |
|
368 | + $content .= $asteriskOut.PHP_EOL; |
|
369 | + $content .= PHP_EOL.PHP_EOL; |
|
370 | 370 | return $content; |
371 | 371 | } |
372 | 372 | |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | private static function getChangedConfigFiles(): string |
379 | 379 | { |
380 | 380 | $content = '────────────────────────────────── Changed config files ─────────────────────────────────'; |
381 | - $content .= PHP_EOL . PHP_EOL; |
|
381 | + $content .= PHP_EOL.PHP_EOL; |
|
382 | 382 | $files = CustomFiles::find('mode!="none"'); |
383 | 383 | foreach ($files as $file) { |
384 | - $content .= "({$file->mode}){$file->filepath}" . PHP_EOL; |
|
384 | + $content .= "({$file->mode}){$file->filepath}".PHP_EOL; |
|
385 | 385 | } |
386 | - $content .= PHP_EOL . PHP_EOL; |
|
386 | + $content .= PHP_EOL.PHP_EOL; |
|
387 | 387 | return $content; |
388 | 388 | } |
389 | 389 | |
@@ -395,12 +395,12 @@ discard block |
||
395 | 395 | private static function getCorruptedFiles(): string |
396 | 396 | { |
397 | 397 | $content = '──────────────────────────────────── Corrupted files ────────────────────────────────────'; |
398 | - $content .= PHP_EOL . PHP_EOL; |
|
398 | + $content .= PHP_EOL.PHP_EOL; |
|
399 | 399 | $files = Main::checkForCorruptedFiles(); |
400 | 400 | foreach ($files as $file) { |
401 | - $content .= $file . PHP_EOL; |
|
401 | + $content .= $file.PHP_EOL; |
|
402 | 402 | } |
403 | - $content .= PHP_EOL . PHP_EOL; |
|
403 | + $content .= PHP_EOL.PHP_EOL; |
|
404 | 404 | return $content; |
405 | 405 | } |
406 | 406 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $response = json_decode($resultrequest, true); |
439 | 439 | $res->data['ip'] = $response['ip']; |
440 | 440 | } else { |
441 | - $res->messages[] = 'Error format data ' . $resultrequest; |
|
441 | + $res->messages[] = 'Error format data '.$resultrequest; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | return $res; |
@@ -53,10 +53,10 @@ |
||
53 | 53 | if ($response !== false) { |
54 | 54 | $response = json_decode($response, true); |
55 | 55 | $filename = $response['data']['filename'] ?? ''; |
56 | - if ( ! file_exists($filename)) { |
|
56 | + if (!file_exists($filename)) { |
|
57 | 57 | $response['messages'][] = 'System information collected file not found'; |
58 | 58 | } else { |
59 | - $response['data']['content'] = '' . file_get_contents($filename); |
|
59 | + $response['data']['content'] = ''.file_get_contents($filename); |
|
60 | 60 | unlink($filename); |
61 | 61 | } |
62 | 62 | $this->response->setPayloadSuccess($response); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | return [ |
58 | 58 | 'Name' => 'PBX system', |
59 | - 'VirtualHardwareType' => 'REAL',//VMWARE,HYPERV,AWS,AZURE |
|
59 | + 'VirtualHardwareType' => 'REAL', //VMWARE,HYPERV,AWS,AZURE |
|
60 | 60 | 'Description' => '', |
61 | 61 | 'RestartEveryNight' => '0', |
62 | 62 | 'SIPPort' => '5060', |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | 'VoicemailNotificationsEmail' => '[email protected]', |
101 | 101 | 'VoicemailExten' => '*001', |
102 | 102 | 'PBXLanguage' => 'en-en', |
103 | - 'PBXInternalExtensionLength' => '3',// Длина внутреннего номера |
|
103 | + 'PBXInternalExtensionLength' => '3', // Длина внутреннего номера |
|
104 | 104 | 'PBXRecordCalls' => '1', |
105 | 105 | 'PBXSplitAudioThread' => '0', |
106 | 106 | 'PBXCallParkingExt' => '800', |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $result = parent::findFirstByKey($key); |
139 | 139 | if ($result === null || $result->value === null) { |
140 | 140 | $arrOfDefaultValues = self::getDefaultArrayValues(); |
141 | - if ( ! array_key_exists($key, $arrOfDefaultValues)) { |
|
141 | + if (!array_key_exists($key, $arrOfDefaultValues)) { |
|
142 | 142 | return ''; |
143 | 143 | } |
144 | 144 |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | /** @var Sip $sip_peer */ |
28 | 28 | foreach ($db_data as $sip_peer) { |
29 | 29 | $len = strlen($sip_peer['extension']); |
30 | - if(!in_array($len, $arr_lens)){ |
|
30 | + if (!in_array($len, $arr_lens)) { |
|
31 | 31 | $arr_lens[] = $len; |
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | - $db_data = IvrMenu::find()->toArray(); |
|
35 | + $db_data = IvrMenu::find()->toArray(); |
|
36 | 36 | // Генерация внутреннего номерного плана. |
37 | 37 | $conf = ''; |
38 | 38 | foreach ($db_data as $ivr) { |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | } |
49 | 49 | $try_count_ivr = $ivr['number_of_repeat']; |
50 | 50 | $conf .= "[ivr-{$ivr['extension']}] \n"; |
51 | - $conf .= 'exten => s,1,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))' . "\n\t"; |
|
51 | + $conf .= 'exten => s,1,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))'."\n\t"; |
|
52 | 52 | $conf .= "same => n,Set(APPEXTEN={$ivr['extension']})\n\t"; |
53 | - $conf .= 'same => n,Gosub(dial_app,${EXTEN},1)' . "\n\t"; |
|
54 | - $conf .= 'same => n,Answer()' . "\n\t"; |
|
55 | - $conf .= 'same => n,Set(try_count=0); №6' . "\n\t"; |
|
56 | - $conf .= 'same => n,Set(try_count=$[${try_count} + 1])' . "\n\t"; |
|
57 | - $conf .= 'same => n,GotoIf($[${try_count} > ' . $try_count_ivr . ']?internal,' . $ivr['timeout_extension'] . ',1)' . "\n\t"; |
|
53 | + $conf .= 'same => n,Gosub(dial_app,${EXTEN},1)'."\n\t"; |
|
54 | + $conf .= 'same => n,Answer()'."\n\t"; |
|
55 | + $conf .= 'same => n,Set(try_count=0); №6'."\n\t"; |
|
56 | + $conf .= 'same => n,Set(try_count=$[${try_count} + 1])'."\n\t"; |
|
57 | + $conf .= 'same => n,GotoIf($[${try_count} > '.$try_count_ivr.']?internal,'.$ivr['timeout_extension'].',1)'."\n\t"; |
|
58 | 58 | $conf .= "same => n,Set(TIMEOUT(digit)=2) \n\t"; |
59 | 59 | $conf .= "same => n,Background({$audio_message}) \n\t"; |
60 | 60 | if ($timeout_wait_exten > 0) { |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | $conf .= "exten => t,1,Goto(s,6)\n"; |
72 | 72 | |
73 | 73 | if ($ivr['allow_enter_any_internal_extension'] === '1') { |
74 | - foreach ($arr_lens as $len){ |
|
74 | + foreach ($arr_lens as $len) { |
|
75 | 75 | $extension = Util::getExtensionX($len); |
76 | - $conf .= 'exten => _'.$extension.',1,ExecIf($["${DIALPLAN_EXISTS(internal,${EXTEN},1)}" == "0"]?Goto(i,1))' . "\n\t"; |
|
77 | - $conf .= 'same => n,ExecIf($["${PJSIP_ENDPOINT(${EXTEN},auth)}x" == "x"]?Goto(i,1))' . "\n\t"; |
|
78 | - $conf .= 'same => n,Goto(internal,${EXTEN},1)' . "\n"; |
|
76 | + $conf .= 'exten => _'.$extension.',1,ExecIf($["${DIALPLAN_EXISTS(internal,${EXTEN},1)}" == "0"]?Goto(i,1))'."\n\t"; |
|
77 | + $conf .= 'same => n,ExecIf($["${PJSIP_ENDPOINT(${EXTEN},auth)}x" == "x"]?Goto(i,1))'."\n\t"; |
|
78 | + $conf .= 'same => n,Goto(internal,${EXTEN},1)'."\n"; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | public function extensionGenHints(): string |
92 | 92 | { |
93 | 93 | $conf = ''; |
94 | - $db_data = IvrMenu::find()->toArray(); |
|
94 | + $db_data = IvrMenu::find()->toArray(); |
|
95 | 95 | foreach ($db_data as $ivr) { |
96 | 96 | $conf .= "exten => {$ivr['extension']},hint,Custom:{$ivr['extension']} \n"; |
97 | 97 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $time_str = implode($out); |
118 | 118 | preg_match_all('/^\d{2}:\d{2}:\d{2}.?\d{0,2}$/', $time_str, $matches, PREG_SET_ORDER, 0); |
119 | 119 | if (count($matches) > 0) { |
120 | - $data = date_parse($time_str); |
|
120 | + $data = date_parse($time_str); |
|
121 | 121 | $result += $data['minute'] * 60 + $data['second']; |
122 | 122 | } |
123 | 123 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $ivr_ext_conf = ''; |
136 | 136 | $db_data = IvrMenu::find()->toArray(); |
137 | 137 | foreach ($db_data as $ivr) { |
138 | - $ivr_ext_conf .= "exten => {$ivr['extension']},1,Goto(ivr-{$ivr['extension']},s,1)" . "\n"; |
|
138 | + $ivr_ext_conf .= "exten => {$ivr['extension']},1,Goto(ivr-{$ivr['extension']},s,1)"."\n"; |
|
139 | 139 | } |
140 | 140 | $ivr_ext_conf .= "\n"; |
141 | 141 | |
@@ -148,10 +148,10 @@ discard block |
||
148 | 148 | public function extensionGenInternalTransfer(): string |
149 | 149 | { |
150 | 150 | $conf = ''; |
151 | - $db_data = IvrMenu::find()->toArray(); |
|
151 | + $db_data = IvrMenu::find()->toArray(); |
|
152 | 152 | foreach ($db_data as $ivr) { |
153 | - $conf .= 'exten => _' . $ivr['extension'] . ',1,Set(__ISTRANSFER=transfer_)' . " \n\t"; |
|
154 | - $conf .= 'same => n,Goto(internal,${EXTEN},1)' . " \n"; |
|
153 | + $conf .= 'exten => _'.$ivr['extension'].',1,Set(__ISTRANSFER=transfer_)'." \n\t"; |
|
154 | + $conf .= 'same => n,Goto(internal,${EXTEN},1)'." \n"; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | return $conf; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function startSystem(): bool |
28 | 28 | { |
29 | 29 | $this->di->getShared('registry')->booting = true; |
30 | - $storage = new Storage(); |
|
30 | + $storage = new Storage(); |
|
31 | 31 | Util::echoWithSyslog(' - Mount storage disk... '); |
32 | 32 | $storage->saveFstab(); |
33 | 33 | $storage->configure(); |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | Util::echoGreenDone(); |
123 | 123 | |
124 | 124 | Util::echoWithSyslog(' - Configuring Asterisk...'.PHP_EOL); |
125 | - $pbx = new PBX(); |
|
125 | + $pbx = new PBX(); |
|
126 | 126 | $pbx->configure(); |
127 | 127 | |
128 | 128 | Util::echoWithSyslog(' - Start Asterisk... '); |
129 | 129 | $pbx->start(); |
130 | - $system = new System(); |
|
130 | + $system = new System(); |
|
131 | 131 | $system->onAfterPbxStarted(); |
132 | 132 | Util::echoGreenDone(); |
133 | 133 |
@@ -33,17 +33,17 @@ |
||
33 | 33 | * Audio or Video codec |
34 | 34 | * @Column(type="string", nullable=true) |
35 | 35 | */ |
36 | - public ?string $type='audio'; |
|
36 | + public ?string $type = 'audio'; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @Column(type="integer", nullable=true, default="1") |
40 | 40 | */ |
41 | - public ?string $priority='1'; |
|
41 | + public ?string $priority = '1'; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * @Column(type="string", length=1, nullable=true) |
45 | 45 | */ |
46 | - public ?string $disabled='0'; |
|
46 | + public ?string $disabled = '0'; |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @Column(type="string", nullable=true) |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $di = new FactoryDefault(); |
18 | 18 | |
19 | 19 | // Auto-loader configuration |
20 | -require_once __DIR__ . '/../../src/Common/Config/ClassLoader.php'; |
|
20 | +require_once __DIR__.'/../../src/Common/Config/ClassLoader.php'; |
|
21 | 21 | |
22 | 22 | // Attach Sentry error logger |
23 | 23 | $errorLogger = new SentryErrorLogger('pbx-core-rest'); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } catch (Error $e) { |
35 | 35 | $errorLogger->captureException($e); |
36 | 36 | echo $e->getMessage(); |
37 | - Util::sysLogMsg('pbx_core_api', $e->getMessage() ); |
|
37 | + Util::sysLogMsg('pbx_core_api', $e->getMessage()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 |