@@ -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); |
@@ -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) |
@@ -19,12 +19,12 @@ |
||
| 19 | 19 | public function start($argv): void |
| 20 | 20 | { |
| 21 | 21 | $settings_file = trim($argv[1]); |
| 22 | - if ( ! file_exists($settings_file)) { |
|
| 22 | + if (!file_exists($settings_file)) { |
|
| 23 | 23 | Util::sysLogMsg("WorkerMakeLogFilesArchive", 'File with settings not found'); |
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | $file_data = json_decode(file_get_contents($settings_file), true); |
| 27 | - if ( ! isset($file_data['result_file'])) { |
|
| 27 | + if (!isset($file_data['result_file'])) { |
|
| 28 | 28 | Util::sysLogMsg("WorkerMakeLogFilesArchive", 'Wrong settings'); |
| 29 | 29 | return; |
| 30 | 30 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | SentrySdk::init()->bindClient($client); |
| 67 | 67 | |
| 68 | 68 | SentrySdk::getCurrentHub()->configureScope( |
| 69 | - function (Scope $scope): void { |
|
| 69 | + function(Scope $scope): void { |
|
| 70 | 70 | if (isset($this->email)) { |
| 71 | 71 | $scope->setUser(['id' => $this->email], true); |
| 72 | 72 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | if (($list = strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']))) { |
| 21 | 21 | if (preg_match_all('/([a-z]{1,8}(?:-[a-z]{1,8})?)(?:;q=([0-9.]+))?/', $list, $list)) { |
| 22 | 22 | $language = array_combine($list[1], $list[2]); |
| 23 | - if (is_array($language)){ |
|
| 23 | + if (is_array($language)) { |
|
| 24 | 24 | foreach ($language as $n => $v) { |
| 25 | 25 | $this->language[$n] = $v ? $v : 1; |
| 26 | 26 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $managedCache = $this->di->get('managedCache'); |
| 29 | 29 | $lastLogRotate = $managedCache->get('lastCoreWorkerLogRotateProcessing'); |
| 30 | - if ($lastLogRotate===null){ |
|
| 30 | + if ($lastLogRotate === null) { |
|
| 31 | 31 | //System Logs |
| 32 | 32 | NatsConf::logRotate(); |
| 33 | 33 | PHPConf::rotateLog(); |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function logRotate(string $moduleUniqid): void |
| 51 | 51 | { |
| 52 | - $logPath = System::getLogDir() . '/' . $moduleUniqid . '/'; |
|
| 53 | - if ( ! file_exists($logPath)) { |
|
| 52 | + $logPath = System::getLogDir().'/'.$moduleUniqid.'/'; |
|
| 53 | + if (!file_exists($logPath)) { |
|
| 54 | 54 | return; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $results = glob($logPath . '*.log', GLOB_NOSORT); |
|
| 57 | + $results = glob($logPath.'*.log', GLOB_NOSORT); |
|
| 58 | 58 | $textConfig = ''; |
| 59 | 59 | foreach ($results as $file) { |
| 60 | - $textConfig .= $file . ' { |
|
| 60 | + $textConfig .= $file.' { |
|
| 61 | 61 | start 0 |
| 62 | 62 | rotate 9 |
| 63 | 63 | size 10M |
@@ -32,8 +32,8 @@ |
||
| 32 | 32 | $this->add($filenames); |
| 33 | 33 | |
| 34 | 34 | $this->add(new Text('filter', ['value' => ''])); |
| 35 | - $this->add(new Numeric('lines', ['value' => '500'])); |
|
| 36 | - $this->add(new Numeric('offset', ['value' => '0'])); |
|
| 35 | + $this->add(new Numeric('lines', ['value' => '500'])); |
|
| 36 | + $this->add(new Numeric('offset', ['value' => '0'])); |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | \ No newline at end of file |