@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $moduleModelClass = "MikoPBX\\Common\\Models\\{$className}"; |
60 | 60 | try { |
61 | 61 | $this->createUpdateDbTableByAnnotations($moduleModelClass); |
62 | - } catch (Throwable $exception){ |
|
62 | + } catch (Throwable $exception) { |
|
63 | 63 | Util::echoWithSyslog('Errors within update table '.$className.' '.$exception->getMessage()); |
64 | 64 | } |
65 | 65 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $result = true; |
80 | 80 | if ( |
81 | - ! class_exists($modelClassName) |
|
81 | + !class_exists($modelClassName) |
|
82 | 82 | || count(get_class_vars($modelClassName)) === 0) { |
83 | 83 | return true; |
84 | 84 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | 'isNumeric' => false, |
119 | 119 | 'primary' => false, |
120 | 120 | ]; |
121 | - $previousAttribute = $attribute; |
|
121 | + $previousAttribute = $attribute; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | // Set data types |
@@ -226,8 +226,8 @@ discard block |
||
226 | 226 | |
227 | 227 | $connectionService->begin(); |
228 | 228 | |
229 | - if ( ! $connectionService->tableExists($tableName)) { |
|
230 | - Util::echoWithSyslog(' - UpdateDatabase: Create new table: ' . $tableName . ' '); |
|
229 | + if (!$connectionService->tableExists($tableName)) { |
|
230 | + Util::echoWithSyslog(' - UpdateDatabase: Create new table: '.$tableName.' '); |
|
231 | 231 | $result = $connectionService->createTable($tableName, '', $columnsNew); |
232 | 232 | Util::echoGreenDone(); |
233 | 233 | } else { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $currentColumnsArr = $connectionService->describeColumns($tableName, ''); |
236 | 236 | |
237 | 237 | if ($this->isTableStructureNotEqual($currentColumnsArr, $columns)) { |
238 | - Util::echoWithSyslog(' - UpdateDatabase: Upgrade table: ' . $tableName . ' '); |
|
238 | + Util::echoWithSyslog(' - UpdateDatabase: Upgrade table: '.$tableName.' '); |
|
239 | 239 | // Create new table and copy all data |
240 | 240 | $currentStateColumnList = []; |
241 | 241 | $oldColNames = []; // Старые названия колонок |
@@ -325,13 +325,13 @@ discard block |
||
325 | 325 | if ($oldField->$compared_setting() !== $newField->$compared_setting()) { |
326 | 326 | // Sqlite transform "1" to ""1"" in default settings, but it is normal |
327 | 327 | if ($compared_setting === 'getDefault' |
328 | - && $oldField->$compared_setting() === '"' . $newField->$compared_setting() . '"') { |
|
328 | + && $oldField->$compared_setting() === '"'.$newField->$compared_setting().'"') { |
|
329 | 329 | continue; |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Description for "length" is integer, but table structure store it as string |
333 | 333 | if ($compared_setting === 'getSize' |
334 | - && (string)$oldField->$compared_setting() === (string)$newField->$compared_setting()) { |
|
334 | + && (string) $oldField->$compared_setting() === (string) $newField->$compared_setting()) { |
|
335 | 335 | continue; |
336 | 336 | } |
337 | 337 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | // Drop not exist indexes |
360 | 360 | foreach ($currentIndexes as $indexName => $currentIndex) { |
361 | 361 | if (stripos($indexName, 'sqlite_autoindex') === false |
362 | - && ! array_key_exists($indexName, $indexes) |
|
362 | + && !array_key_exists($indexName, $indexes) |
|
363 | 363 | ) { |
364 | 364 | Util::echoWithSyslog(" - UpdateDatabase: Delete index: {$indexName} "); |
365 | 365 | $result = $result + $connectionService->dropIndex($tableName, '', $indexName); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | if (file_exists('/etc/TZ')) { |
176 | 176 | $origin_tz = file_get_contents("/etc/TZ"); |
177 | 177 | } |
178 | - if ($origin_tz !== $db_tz){ |
|
178 | + if ($origin_tz !== $db_tz) { |
|
179 | 179 | self::timezoneConfigure(); |
180 | 180 | } |
181 | 181 | $origin_tz = $db_tz; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | if ($timezone) { |
247 | 247 | $zone_file = "/usr/share/zoneinfo/{$timezone}"; |
248 | - if ( ! file_exists($zone_file)) { |
|
248 | + if (!file_exists($zone_file)) { |
|
249 | 249 | return; |
250 | 250 | } |
251 | 251 | $cpPath = Util::which('cp'); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | try { |
284 | 284 | /** @var \MikoPBX\Modules\Config\ConfigClass $appClass */ |
285 | 285 | $appClass->onAfterPbxStarted(); |
286 | - }catch (Throwable $e){ |
|
286 | + } catch (Throwable $e) { |
|
287 | 287 | Util::sysLogMsg('onAfterPbxStarted', $e->getMessage()); |
288 | 288 | } |
289 | 289 | } |
@@ -283,7 +283,7 @@ |
||
283 | 283 | try { |
284 | 284 | /** @var \MikoPBX\Modules\Config\ConfigClass $appClass */ |
285 | 285 | $appClass->onAfterPbxStarted(); |
286 | - }catch (Throwable $e){ |
|
286 | + } catch (Throwable $e){ |
|
287 | 287 | Util::sysLogMsg('onAfterPbxStarted', $e->getMessage()); |
288 | 288 | } |
289 | 289 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $freeExtension = '2200100'; |
113 | 113 | for ($i = 100; ; $i++) { |
114 | 114 | $freeExtension = "2200{$i}"; |
115 | - if ( ! in_array(['number' => $freeExtension], $result, false)) { |
|
115 | + if (!in_array(['number' => $freeExtension], $result, false)) { |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | } |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | $relatedModel = $relation->getReferencedModel(); |
422 | 422 | $referencedFields = is_array($referencedFields) ? $referencedFields : [$referencedFields]; |
423 | 423 | foreach ($referencedFields as $referencedField) { |
424 | - $parameters = [ |
|
425 | - 'conditions' => $referencedField . '= :oldNumber:', |
|
424 | + $parameters = [ |
|
425 | + 'conditions' => $referencedField.'= :oldNumber:', |
|
426 | 426 | 'bind' => ['oldNumber' => $snapShotData['number']], |
427 | 427 | ]; |
428 | 428 | $relatedRecords = call_user_func([$relatedModel, 'find'], $parameters); |
@@ -476,8 +476,8 @@ discard block |
||
476 | 476 | $relatedModel = $relation->getReferencedModel(); |
477 | 477 | $referencedFields = is_array($referencedFields) ? $referencedFields : [$referencedFields]; |
478 | 478 | foreach ($referencedFields as $referencedField) { |
479 | - $parameters = [ |
|
480 | - 'conditions' => $referencedField . '= :Number:', |
|
479 | + $parameters = [ |
|
480 | + 'conditions' => $referencedField.'= :Number:', |
|
481 | 481 | 'bind' => ['Number' => $this->number], |
482 | 482 | ]; |
483 | 483 | $relatedRecords = call_user_func([$relatedModel, 'find'], $parameters); |
@@ -50,10 +50,10 @@ |
||
50 | 50 | { |
51 | 51 | $di->setShared( |
52 | 52 | self::SERVICE_NAME, |
53 | - function () { |
|
53 | + function() { |
|
54 | 54 | try { |
55 | 55 | return new License('http://127.0.0.1:8223'); |
56 | - } catch (Throwable $exception){ |
|
56 | + } catch (Throwable $exception) { |
|
57 | 57 | Util::sysLogMsg(__CLASS__, $exception); |
58 | 58 | } |
59 | 59 | return null; |
@@ -50,7 +50,8 @@ |
||
50 | 50 | { |
51 | 51 | $di->setShared( |
52 | 52 | self::SERVICE_NAME, |
53 | - function () { |
|
53 | + function () |
|
54 | + { |
|
54 | 55 | try { |
55 | 56 | return new License('http://127.0.0.1:8223'); |
56 | 57 | } catch (Throwable $exception){ |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // IncomingRoutingTable', |
47 | 47 | // OutgoingRoutingTable', |
48 | 48 | ]; |
49 | - $results = [[]]; |
|
49 | + $results = [[]]; |
|
50 | 50 | foreach ($arrClasses as $itemClass) { |
51 | 51 | $records = call_user_func([$itemClass, 'find']); |
52 | 52 | $categoryItems = []; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | 'typeLocalized' => $this->translation->_("ex_dropdownCategory_{$type}"), |
91 | 91 | 'sorter' => $clearedRepresent, |
92 | 92 | ]; |
93 | - $items[] = $result; |
|
93 | + $items[] = $result; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $elements = $this->elements; |
104 | 104 | |
105 | 105 | $items[] = [ |
106 | - 'name' => $elements->getIconByController('incoming-routes') . ' ' . $this->translation->_( |
|
106 | + 'name' => $elements->getIconByController('incoming-routes').' '.$this->translation->_( |
|
107 | 107 | 'mm_IncomingRoutes' |
108 | 108 | ), |
109 | 109 | 'value' => $this->url->get('incoming-routes'), |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | 'sorter' => strip_tags($this->translation->_('mm_IncomingRoutes')), |
113 | 113 | ]; |
114 | 114 | $items[] = [ |
115 | - 'name' => $elements->getIconByController('outbound-routes') . ' ' . $this->translation->_( |
|
115 | + 'name' => $elements->getIconByController('outbound-routes').' '.$this->translation->_( |
|
116 | 116 | 'mm_OutboundRoutes' |
117 | 117 | ), |
118 | 118 | 'value' => $this->url->get('outbound-routes'), |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'sorter' => strip_tags($this->translation->_('mm_OutboundRoutes')), |
122 | 122 | ]; |
123 | 123 | $items[] = [ |
124 | - 'name' => $elements->getIconByController('general-settings') . ' ' . $this->translation->_( |
|
124 | + 'name' => $elements->getIconByController('general-settings').' '.$this->translation->_( |
|
125 | 125 | 'mm_GeneralSettings' |
126 | 126 | ), |
127 | 127 | 'value' => $this->url->get('general-settings/modify'), |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | 'sorter' => strip_tags($this->translation->_('mm_GeneralSettings')), |
131 | 131 | ]; |
132 | 132 | $items[] = [ |
133 | - 'name' => $elements->getIconByController('time-settings') . ' ' . $this->translation->_( |
|
133 | + 'name' => $elements->getIconByController('time-settings').' '.$this->translation->_( |
|
134 | 134 | 'mm_SystemClock' |
135 | 135 | ), |
136 | 136 | 'value' => $this->url->get('time-settings/modify'), |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | 'sorter' => strip_tags($this->translation->_('mm_SystemClock')), |
140 | 140 | ]; |
141 | 141 | $items[] = [ |
142 | - 'name' => $elements->getIconByController('network') . ' ' . $this->translation->_('mm_Network'), |
|
142 | + 'name' => $elements->getIconByController('network').' '.$this->translation->_('mm_Network'), |
|
143 | 143 | 'value' => $this->url->get('network/modify/'), |
144 | 144 | 'type' => 'MENUITEMS', |
145 | 145 | 'typeLocalized' => $this->translation->_('ex_dropdownCategory_MENUITEMS'), |
146 | 146 | 'sorter' => strip_tags($this->translation->_('mm_Network')), |
147 | 147 | ]; |
148 | 148 | $items[] = [ |
149 | - 'name' => $elements->getIconByController('mail-settings') . ' ' . $this->translation->_( |
|
149 | + 'name' => $elements->getIconByController('mail-settings').' '.$this->translation->_( |
|
150 | 150 | 'mm_MailSettings' |
151 | 151 | ), |
152 | 152 | 'value' => $this->url->get('mail-settings/modify'), |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | 'sorter' => strip_tags($this->translation->_('mm_MailSettings')), |
156 | 156 | ]; |
157 | 157 | $items[] = [ |
158 | - 'name' => $elements->getIconByController('call-detail-records') . ' ' . $this->translation->_( |
|
158 | + 'name' => $elements->getIconByController('call-detail-records').' '.$this->translation->_( |
|
159 | 159 | 'mm_CallDetailRecords' |
160 | 160 | ), |
161 | 161 | 'value' => $this->url->get('call-detail-records'), |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | 'sorter' => strip_tags($this->translation->_('mm_CallDetailRecords')), |
165 | 165 | ]; |
166 | 166 | $items[] = [ |
167 | - 'name' => $elements->getIconByController('sound-files') . ' ' . $this->translation->_( |
|
167 | + 'name' => $elements->getIconByController('sound-files').' '.$this->translation->_( |
|
168 | 168 | 'mm_SoundFiles' |
169 | 169 | ), |
170 | 170 | 'value' => $this->url->get('sound-files'), |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | ]; |
175 | 175 | |
176 | 176 | $items[] = [ |
177 | - 'name' => $elements->getIconByController('licensing') . ' ' . $this->translation->_( |
|
177 | + 'name' => $elements->getIconByController('licensing').' '.$this->translation->_( |
|
178 | 178 | 'mm_Licensing' |
179 | 179 | ), |
180 | 180 | 'value' => $this->url->get('licensing/modify/'), |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | ]; |
185 | 185 | |
186 | 186 | $items[] = [ |
187 | - 'name' => $elements->getIconByController('pbx-extension-modules') . ' ' . $this->translation->_( |
|
187 | + 'name' => $elements->getIconByController('pbx-extension-modules').' '.$this->translation->_( |
|
188 | 188 | 'BreadcrumbPbxExtensionModules' |
189 | 189 | ), |
190 | 190 | 'value' => $this->url->get('pbx-extension-modules'), |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | ]; |
195 | 195 | |
196 | 196 | $items[] = [ |
197 | - 'name' => $elements->getIconByController('system-diagnostic') . ' ' . $this->translation->_( |
|
197 | + 'name' => $elements->getIconByController('system-diagnostic').' '.$this->translation->_( |
|
198 | 198 | 'mm_SystemDiagnostic' |
199 | 199 | ), |
200 | 200 | 'value' => $this->url->get('system-diagnostic'), |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | ]; |
205 | 205 | |
206 | 206 | $items[] = [ |
207 | - 'name' => $elements->getIconByController('fail2-ban') . ' ' . $this->translation->_( |
|
207 | + 'name' => $elements->getIconByController('fail2-ban').' '.$this->translation->_( |
|
208 | 208 | 'mm_BruteForceProtection' |
209 | 209 | ), |
210 | 210 | 'value' => $this->url->get('fail2-ban'), |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | 'sorter' => strip_tags($this->translation->_('mm_BruteForceProtection')), |
214 | 214 | ]; |
215 | 215 | $items[] = [ |
216 | - 'name' => $elements->getIconByController('update') . ' ' . $this->translation->_( |
|
216 | + 'name' => $elements->getIconByController('update').' '.$this->translation->_( |
|
217 | 217 | 'mm_UpdateSystem' |
218 | 218 | ), |
219 | 219 | 'value' => $this->url->get('update'), |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | public function indexAction(): void |
16 | 16 | { |
17 | - $this->view->form = new SystemDiagnosticForm(); |
|
17 | + $this->view->form = new SystemDiagnosticForm(); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 |
@@ -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 (Throwable $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 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | { |
91 | 91 | if(isset($this->mixMonitorChannels[$channel])){ |
92 | 92 | unset($this->mixMonitorChannels[$channel]); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | if ($this->record_calls) { |
@@ -1319,7 +1319,8 @@ discard block |
||
1319 | 1319 | * |
1320 | 1320 | * @return bool |
1321 | 1321 | */ |
1322 | - private function filterNotValid($filter){ |
|
1322 | + private function filterNotValid($filter) |
|
1323 | + { |
|
1323 | 1324 | $haveErrors = false; |
1324 | 1325 | if(isset($filter['bind'])){ |
1325 | 1326 | if(is_array($filter)){ |
@@ -1328,7 +1329,7 @@ discard block |
||
1328 | 1329 | $haveErrors = true; |
1329 | 1330 | } |
1330 | 1331 | } |
1331 | - }else{ |
|
1332 | + } else{ |
|
1332 | 1333 | $haveErrors = true; |
1333 | 1334 | } |
1334 | 1335 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function MixMonitor($channel, $file_name = null, $sub_dir = null, $full_name = null): string |
36 | 36 | { |
37 | - $resFile = $this->mixMonitorChannels[$channel]??''; |
|
38 | - if($resFile !== ''){ |
|
37 | + $resFile = $this->mixMonitorChannels[$channel] ?? ''; |
|
38 | + if ($resFile !== '') { |
|
39 | 39 | return $resFile; |
40 | 40 | } |
41 | 41 | $resFile = ''; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | if ($this->record_calls) { |
44 | 44 | [$f, $options] = $this->setMonitorFilenameOptions($full_name, $sub_dir, $file_name); |
45 | 45 | $arr = $this->am->GetChannels(false); |
46 | - if(!in_array($channel, $arr, true)){ |
|
46 | + if (!in_array($channel, $arr, true)) { |
|
47 | 47 | return ''; |
48 | 48 | } |
49 | 49 | $srcFile = "{$f}.wav"; |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function StopMixMonitor($channel): void |
87 | 87 | { |
88 | - if(isset($this->mixMonitorChannels[$channel])){ |
|
88 | + if (isset($this->mixMonitorChannels[$channel])) { |
|
89 | 89 | unset($this->mixMonitorChannels[$channel]); |
90 | - }else{ |
|
90 | + } else { |
|
91 | 91 | return; |
92 | 92 | } |
93 | 93 | if ($this->record_calls) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | foreach ($m_data as $row) { |
126 | 126 | $row->writeAttribute('endtime', $data['start']); |
127 | 127 | $res = $row->update(); |
128 | - if ( ! $res) { |
|
128 | + if (!$res) { |
|
129 | 129 | Util::sysLogMsg('Action_app_end', implode(' ', $row->getMessages())); |
130 | 130 | } |
131 | 131 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // мобильный и внутренний номер. |
145 | 145 | $filter = [ |
146 | 146 | '(UNIQUEID=:UNIQUEID: OR UNIQUEID=:org_id:) AND endtime = ""', |
147 | - 'bind' => ['UNIQUEID' => $data['UNIQUEID'], 'org_id' => $data['org_id'],], |
|
147 | + 'bind' => ['UNIQUEID' => $data['UNIQUEID'], 'org_id' => $data['org_id'], ], |
|
148 | 148 | ]; |
149 | 149 | } else { |
150 | 150 | $filter = [ |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | /** @var CallDetailRecordsTmp $row */ |
161 | 161 | $m_data = CallDetailRecordsTmp::find($filter); |
162 | 162 | foreach ($m_data as $row) { |
163 | - if ( ! is_object($row)) { |
|
163 | + if (!is_object($row)) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | /// |
167 | 167 | // Проверим, если более одного канала SIP/256 при входящем. |
168 | 168 | $column_chan_name = ('ORIGINATE' === $row->dialstatus) ? 'src_chan' : 'dst_chan'; |
169 | 169 | |
170 | - if ( ! empty($row->$column_chan_name) && $data['dst_chan'] !== $row->$column_chan_name) { |
|
170 | + if (!empty($row->$column_chan_name) && $data['dst_chan'] !== $row->$column_chan_name) { |
|
171 | 171 | if ($row_create) { |
172 | 172 | continue; |
173 | 173 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $new_row->writeAttribute($attribute, $value); |
182 | 182 | } |
183 | 183 | $new_row->writeAttribute($column_chan_name, $data['dst_chan']); |
184 | - $new_row->writeAttribute('UNIQUEID', $data['UNIQUEID'] . '_' . $data['dst_chan']); |
|
184 | + $new_row->writeAttribute('UNIQUEID', $data['UNIQUEID'].'_'.$data['dst_chan']); |
|
185 | 185 | // Подмена $row; |
186 | 186 | $row = $new_row; |
187 | 187 | $row_create = true; |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | $row->writeAttribute('dst_chan', $data['dst_chan']); |
198 | 198 | } |
199 | 199 | |
200 | - if (isset($data['to_account']) && ! empty($data['to_account'])) { |
|
200 | + if (isset($data['to_account']) && !empty($data['to_account'])) { |
|
201 | 201 | $row->writeAttribute($account_col, $data['to_account']); |
202 | 202 | } |
203 | - if (isset($data['dst_call_id']) && ! empty($data['dst_call_id'])) { |
|
203 | + if (isset($data['dst_call_id']) && !empty($data['dst_call_id'])) { |
|
204 | 204 | $row->writeAttribute('dst_call_id', $data['dst_call_id']); |
205 | 205 | } |
206 | 206 | $res = $row->save(); |
207 | - if ( ! $res) { |
|
207 | + if (!$res) { |
|
208 | 208 | Util::sysLogMsg('Action_dial_create_chan', implode(' ', $row->getMessages())); |
209 | 209 | } |
210 | 210 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | // Событие возникает, когда мы пытаемся перехватить вызов на соседний телефон. |
225 | 225 | $filter = [ |
226 | 226 | 'UNIQUEID=:UNIQUEID:', |
227 | - 'bind' => ['UNIQUEID' => $data['old_id'],], |
|
227 | + 'bind' => ['UNIQUEID' => $data['old_id'], ], |
|
228 | 228 | ]; |
229 | 229 | /** @var CallDetailRecordsTmp $m_data */ |
230 | 230 | $m_data = CallDetailRecordsTmp::find($filter); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $new_data['dst_chan'] = $data['agi_channel']; |
239 | 239 | $new_data['dst_num'] = $data['dst_num']; |
240 | 240 | $new_data['UNIQUEID'] = $data['id']; |
241 | - $new_data['recordingfile'] = $this->MixMonitor($new_data['dst_chan'], 'pickup_'.$new_data['UNIQUEID']); |
|
241 | + $new_data['recordingfile'] = $this->MixMonitor($new_data['dst_chan'], 'pickup_'.$new_data['UNIQUEID']); |
|
242 | 242 | |
243 | 243 | unset($new_data['id'], $new_data['end']); |
244 | 244 | self::insertDataToDbM($new_data); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $this->am->UserEvent('CdrConnector', ['AgiData' => $AgiData]); |
251 | 251 | } |
252 | 252 | } else { |
253 | - if ( ! empty($data['ENDCALLONANSWER'])) { |
|
253 | + if (!empty($data['ENDCALLONANSWER'])) { |
|
254 | 254 | // Переменная ENDCALLONANSWER устанавливается при начале работы умной маршуртизации. |
255 | 255 | // Как только произошел ответ на вызов, отметим вызов на приложение как завершенный. |
256 | 256 | $filter = [ |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $row->writeAttribute('endtime', $data['answer']); |
268 | 268 | $row->writeAttribute('is_app', 1); |
269 | 269 | $res = $row->save(); |
270 | - if ( ! $res) { |
|
270 | + if (!$res) { |
|
271 | 271 | Util::sysLogMsg('ENDCALLONANSWER', implode(' ', $row->getMessages())); |
272 | 272 | } |
273 | 273 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | '(UNIQUEID=:UNIQUEID: OR UNIQUEID=:UNIQUEID_CHAN:) AND answer = "" AND endtime = ""', |
290 | 290 | 'bind' => [ |
291 | 291 | 'UNIQUEID' => $data['id'], |
292 | - 'UNIQUEID_CHAN' => $data['id'] . '_' . $data['agi_channel'], |
|
292 | + 'UNIQUEID_CHAN' => $data['id'].'_'.$data['agi_channel'], |
|
293 | 293 | ], |
294 | 294 | ]; |
295 | 295 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | continue; |
303 | 303 | } |
304 | 304 | // Найдем все прочие CDR по данному originate и отметим как завершенные. |
305 | - $filter = [ |
|
305 | + $filter = [ |
|
306 | 306 | 'linkedid=:linkedid: AND endtime <> "" AND src_chan <> :src_chan:', |
307 | 307 | 'bind' => [ |
308 | 308 | 'linkedid' => $row->linkedid, |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $orgn_row->writeAttribute('endtime', $data['answer']); |
317 | 317 | } |
318 | 318 | $orgn_row->writeAttribute('dst_chan', ''); |
319 | - $orgn_row->writeAttribute('UNIQUEID', $data['id'] . '_' . $orgn_row->src_chan); |
|
319 | + $orgn_row->writeAttribute('UNIQUEID', $data['id'].'_'.$orgn_row->src_chan); |
|
320 | 320 | $orgn_row->update(); |
321 | 321 | } |
322 | 322 | |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | $row->writeAttribute('answer', $data['answer']); |
331 | - $recFile = $data['recordingfile']??''; |
|
332 | - if(!empty($recFile)){ |
|
331 | + $recFile = $data['recordingfile'] ?? ''; |
|
332 | + if (!empty($recFile)) { |
|
333 | 333 | $this->mixMonitorChannels[$data['agi_channel']] = $recFile; |
334 | 334 | $row->writeAttribute('recordingfile', $recFile); |
335 | 335 | } |
336 | 336 | $res = $row->save(); |
337 | - if ( !$res) { |
|
337 | + if (!$res) { |
|
338 | 338 | Util::sysLogMsg('Action_dial_answer', implode(' ', $row->getMessages())); |
339 | 339 | } |
340 | 340 | } |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | $this->hangupChanCheckSipTrtansfer($data, $channels); |
361 | 361 | |
362 | 362 | // Очистим память. |
363 | - if(isset($this->checkChanHangupTransfer[$data['agi_channel']])){ |
|
363 | + if (isset($this->checkChanHangupTransfer[$data['agi_channel']])) { |
|
364 | 364 | unset($this->checkChanHangupTransfer[$data['agi_channel']]); |
365 | 365 | } |
366 | - if(isset($this->mixMonitorChannels[$data['agi_channel']])){ |
|
366 | + if (isset($this->mixMonitorChannels[$data['agi_channel']])) { |
|
367 | 367 | unset($this->mixMonitorChannels[$data['agi_channel']]); |
368 | 368 | } |
369 | 369 | } |
@@ -375,24 +375,24 @@ discard block |
||
375 | 375 | */ |
376 | 376 | private function hangupChanCheckSipTrtansfer($data, $channels):void{ |
377 | 377 | $not_local = (stripos($data['agi_channel'], 'local/') === false); |
378 | - if($not_local === false || $data['OLD_LINKEDID'] !== $data['linkedid']) { |
|
378 | + if ($not_local === false || $data['OLD_LINKEDID'] !== $data['linkedid']) { |
|
379 | 379 | return; |
380 | 380 | } |
381 | 381 | $active_chans = $this->am->GetChannels(false); |
382 | 382 | // Намек на SIP трансфер. |
383 | 383 | foreach ($channels as $data_chan) { |
384 | - if ( ! in_array($data_chan['chan'], $active_chans, true)) { |
|
384 | + if (!in_array($data_chan['chan'], $active_chans, true)) { |
|
385 | 385 | // Вызов уже завершен. Не интересно. |
386 | 386 | continue; |
387 | 387 | } |
388 | 388 | $BRIDGEPEER = $this->am->GetVar($data_chan['chan'], 'BRIDGEPEER', null, false); |
389 | - if ( ! in_array($BRIDGEPEER, $active_chans, true) || !is_string($BRIDGEPEER)) { |
|
389 | + if (!in_array($BRIDGEPEER, $active_chans, true) || !is_string($BRIDGEPEER)) { |
|
390 | 390 | // Вызов уже завершен. Не интересно. |
391 | 391 | continue; |
392 | 392 | } |
393 | 393 | |
394 | 394 | $linkedid = $this->am->GetVar($data_chan['chan'], 'CHANNEL(linkedid)', null, false); |
395 | - if ( empty($linkedid) || $linkedid === $data['linkedid']) { |
|
395 | + if (empty($linkedid) || $linkedid === $data['linkedid']) { |
|
396 | 396 | continue; |
397 | 397 | } |
398 | 398 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $n_data['start'] = date('Y-m-d H:i:s'); |
406 | 406 | $n_data['answer'] = date('Y-m-d H:i:s'); |
407 | 407 | $n_data['linkedid'] = $linkedid; |
408 | - $n_data['UNIQUEID'] = $data['linkedid'] . Util::generateRandomString(); |
|
408 | + $n_data['UNIQUEID'] = $data['linkedid'].Util::generateRandomString(); |
|
409 | 409 | $n_data['transfer'] = '0'; |
410 | 410 | $n_data['recordingfile'] = $this->MixMonitor($n_data['dst_chan'], $n_data['UNIQUEID']); |
411 | 411 | $n_data['did'] = $data_chan['did']; |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @param array $channels |
438 | 438 | */ |
439 | 439 | private function hangupChanEndCalls(array $data, array &$transfer_calls, array &$channels):void{ |
440 | - $filter = [ |
|
440 | + $filter = [ |
|
441 | 441 | 'linkedid=:linkedid: AND endtime = "" AND (src_chan=:src_chan: OR dst_chan=:dst_chan:)', |
442 | 442 | 'bind' => [ |
443 | 443 | 'linkedid' => $data['linkedid'], |
@@ -454,8 +454,8 @@ discard block |
||
454 | 454 | } |
455 | 455 | if ($row->dialstatus === 'ORIGINATE') { |
456 | 456 | $row->writeAttribute('dialstatus', ''); |
457 | - if($row->answer === ''){ |
|
458 | - $newId = $row->linkedid.'_'.$row->src_num.'_'.substr($row->src_chan, strpos($row->src_chan,'-') +1); |
|
457 | + if ($row->answer === '') { |
|
458 | + $newId = $row->linkedid.'_'.$row->src_num.'_'.substr($row->src_chan, strpos($row->src_chan, '-') + 1); |
|
459 | 459 | $row->writeAttribute('UNIQUEID', $newId); |
460 | 460 | } |
461 | 461 | } |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $row->writeAttribute('dialstatus', $data['dialstatus']); |
469 | 469 | } |
470 | 470 | $res = $row->update(); |
471 | - if ( ! $res) { |
|
471 | + if (!$res) { |
|
472 | 472 | Util::sysLogMsg('Action_hangup_chan', implode(' ', $row->getMessages())); |
473 | 473 | } |
474 | 474 | |
@@ -500,14 +500,14 @@ discard block |
||
500 | 500 | */ |
501 | 501 | public function Action_CreateRowTransfer($action, $data, $calls_data = null): void |
502 | 502 | { |
503 | - if( isset($this->checkChanHangupTransfer[$data['agi_channel']]) ) { |
|
503 | + if (isset($this->checkChanHangupTransfer[$data['agi_channel']])) { |
|
504 | 504 | return; |
505 | 505 | } |
506 | 506 | |
507 | 507 | $this->checkChanHangupTransfer[$data['agi_channel']] = $action; |
508 | 508 | |
509 | 509 | if (null === $calls_data) { |
510 | - $filter = [ |
|
510 | + $filter = [ |
|
511 | 511 | 'linkedid=:linkedid: AND endtime = "" AND transfer=1 AND (src_chan=:chan: OR dst_chan=:chan:)', |
512 | 512 | 'bind' => [ |
513 | 513 | 'linkedid' => $data['linkedid'], |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | $insert_data[$fname_chan] = $row_data['dst_chan']; |
530 | 530 | $insert_data[$fname_num] = $row_data['dst_num']; |
531 | 531 | } else { |
532 | - $fname_chan = ! isset($insert_data['src_chan']) ? 'src_chan' : 'dst_chan'; |
|
533 | - $fname_num = ! isset($insert_data['src_num']) ? 'src_num' : 'dst_num'; |
|
532 | + $fname_chan = !isset($insert_data['src_chan']) ? 'src_chan' : 'dst_chan'; |
|
533 | + $fname_num = !isset($insert_data['src_num']) ? 'src_num' : 'dst_num'; |
|
534 | 534 | |
535 | 535 | $insert_data[$fname_chan] = $row_data['src_chan']; |
536 | 536 | $insert_data[$fname_num] = $row_data['src_num']; |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | $this->StopMixMonitor($insert_data['dst_chan']); |
542 | 542 | $recordingfile = $this->MixMonitor( |
543 | 543 | $insert_data['dst_chan'], |
544 | - 'transfer_' . $insert_data['src_num'] . '_' . $insert_data['dst_num'] . '_' . $data['linkedid'] |
|
544 | + 'transfer_'.$insert_data['src_num'].'_'.$insert_data['dst_num'].'_'.$data['linkedid'] |
|
545 | 545 | ); |
546 | 546 | // |
547 | 547 | $insert_data['action'] = "{$action}_end_trasfer"; |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | $this->am->UserEvent('CdrConnector', ['AgiData' => $AgiData]); |
563 | 563 | |
564 | 564 | self::insertDataToDbM($insert_data); |
565 | - } elseif (empty($calls_data[0]['answer']) && count($calls_data) === 1 && ! empty($calls_data[0]['recordingfile'])) { |
|
565 | + } elseif (empty($calls_data[0]['answer']) && count($calls_data) === 1 && !empty($calls_data[0]['recordingfile'])) { |
|
566 | 566 | // Возобновление записи разговора при срыве переадресации. |
567 | 567 | $row_data = $calls_data[0]; |
568 | 568 | $chan = ($data['agi_channel'] === $row_data['src_chan']) ? $row_data['dst_chan'] : $row_data['src_chan']; |
@@ -578,12 +578,12 @@ discard block |
||
578 | 578 | /** @var CallDetailRecordsTmp $row */ |
579 | 579 | $not_ended_cdr = null; |
580 | 580 | $transferNotComplete = false; |
581 | - foreach ($cdr as $row){ |
|
582 | - if($row->transfer === '1' && ($row->src_chan === $chan || $row->dst_chan === $chan) ){ |
|
581 | + foreach ($cdr as $row) { |
|
582 | + if ($row->transfer === '1' && ($row->src_chan === $chan || $row->dst_chan === $chan)) { |
|
583 | 583 | $not_ended_cdr = $row; |
584 | 584 | } |
585 | - if($row->answer === '' && $row->endtime === '' |
|
586 | - && ($row->src_chan === $chan || $row->dst_chan === $chan) ){ |
|
585 | + if ($row->answer === '' && $row->endtime === '' |
|
586 | + && ($row->src_chan === $chan || $row->dst_chan === $chan)) { |
|
587 | 587 | $transferNotComplete = true; |
588 | 588 | } |
589 | 589 | } |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | */ |
662 | 662 | public function Action_transfer_dial_create_chan($data): void |
663 | 663 | { |
664 | - $filter = [ |
|
664 | + $filter = [ |
|
665 | 665 | 'UNIQUEID=:UNIQUEID: AND endtime = "" AND answer = ""', |
666 | 666 | 'bind' => [ |
667 | 667 | 'UNIQUEID' => $data['transfer_UNIQUEID'], |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | foreach ($m_data as $row) { |
675 | 675 | /// |
676 | 676 | // Проверим, если более одного канала SIP/256 при входящем. |
677 | - if ( ! empty($row->dst_chan) && $data['dst_chan'] !== $row->dst_chan) { |
|
677 | + if (!empty($row->dst_chan) && $data['dst_chan'] !== $row->dst_chan) { |
|
678 | 678 | if ($row_create) { |
679 | 679 | continue; |
680 | 680 | } |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | $new_row->writeAttribute($attribute, $value); |
689 | 689 | } |
690 | 690 | $new_row->writeAttribute('dst_chan', $data['dst_chan']); |
691 | - $new_row->writeAttribute('UNIQUEID', $data['transfer_UNIQUEID'] . '_' . $data['dst_chan']); |
|
691 | + $new_row->writeAttribute('UNIQUEID', $data['transfer_UNIQUEID'].'_'.$data['dst_chan']); |
|
692 | 692 | // $new_row->save(); |
693 | 693 | // Подмена $row; |
694 | 694 | $row = $new_row; |
@@ -700,11 +700,11 @@ discard block |
||
700 | 700 | |
701 | 701 | $row->writeAttribute('dst_chan', $data['dst_chan']); |
702 | 702 | $row->writeAttribute('recordingfile', $data['recordingfile']); |
703 | - if (isset($data['dst_call_id']) && ! empty($data['dst_call_id'])) { |
|
703 | + if (isset($data['dst_call_id']) && !empty($data['dst_call_id'])) { |
|
704 | 704 | $row->writeAttribute('dst_call_id', $data['dst_call_id']); |
705 | 705 | } |
706 | 706 | $res = $row->save(); |
707 | - if ( ! $res) { |
|
707 | + if (!$res) { |
|
708 | 708 | Util::sysLogMsg('Action_transfer_dial_create_chan', implode(' ', $row->getMessages())); |
709 | 709 | } |
710 | 710 | } |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | '(UNIQUEID=:UNIQUEID: OR UNIQUEID=:UNIQUEID_CHAN:) AND answer = "" AND endtime = ""', |
722 | 722 | 'bind' => [ |
723 | 723 | 'UNIQUEID' => $data['transfer_UNIQUEID'], |
724 | - 'UNIQUEID_CHAN' => $data['transfer_UNIQUEID'] . '_' . $data['agi_channel'], |
|
724 | + 'UNIQUEID_CHAN' => $data['transfer_UNIQUEID'].'_'.$data['agi_channel'], |
|
725 | 725 | ], |
726 | 726 | ]; |
727 | 727 | |
@@ -730,13 +730,13 @@ discard block |
||
730 | 730 | $m_data = CallDetailRecordsTmp::find($filter); |
731 | 731 | foreach ($m_data as $row) { |
732 | 732 | $row->writeAttribute('answer', $data['answer']); |
733 | - $recFile = $data['recordingfile']??''; |
|
734 | - if(!empty($recFile)){ |
|
733 | + $recFile = $data['recordingfile'] ?? ''; |
|
734 | + if (!empty($recFile)) { |
|
735 | 735 | $this->mixMonitorChannels[$data['agi_channel']] = $recFile; |
736 | 736 | $row->writeAttribute('recordingfile', $recFile); |
737 | 737 | } |
738 | 738 | $res = $row->save(); |
739 | - if ( !$res) { |
|
739 | + if (!$res) { |
|
740 | 740 | Util::sysLogMsg('Action_transfer_dial_answer', implode(' ', $row->getMessages())); |
741 | 741 | } |
742 | 742 | } |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | // Завершим вызов в CDR. |
771 | 771 | $row->writeAttribute('endtime', $data['end']); |
772 | 772 | $row->writeAttribute('transfer', 0); |
773 | - if ( ! $row->save()) { |
|
773 | + if (!$row->save()) { |
|
774 | 774 | Util::sysLogMsg('Action_transfer_dial_answer', implode(' ', $row->getMessages())); |
775 | 775 | } |
776 | 776 | } |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | // Ответа не было. Переадресация отменена. |
806 | 806 | $row->writeAttribute('endtime', $data['end']); |
807 | 807 | $row->writeAttribute('transfer', 0); |
808 | - if ( ! $row->save()) { |
|
808 | + if (!$row->save()) { |
|
809 | 809 | Util::sysLogMsg('Action_transfer_dial_answer', implode(' ', $row->getMessages())); |
810 | 810 | } |
811 | 811 | } |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | $this->MixMonitor($row->dst_chan, $info['filename'], $subdir); |
826 | 826 | // Снимем со строк признак переадресации. |
827 | 827 | $row->writeAttribute('transfer', 0); |
828 | - if ( ! $row->save()) { |
|
828 | + if (!$row->save()) { |
|
829 | 829 | Util::sysLogMsg('Action_transfer_dial_answer', implode(' ', $row->getMessages())); |
830 | 830 | } |
831 | 831 | } |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | |
902 | 902 | $f_list = $m_data->toArray(); |
903 | 903 | foreach ($data as $attribute => $value) { |
904 | - if ( ! array_key_exists($attribute, $f_list)) { |
|
904 | + if (!array_key_exists($attribute, $f_list)) { |
|
905 | 905 | continue; |
906 | 906 | } |
907 | 907 | $m_data->writeAttribute($attribute, $value); |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | $row->writeAttribute('answer', $data['answer']); |
973 | 973 | $row->writeAttribute('endtime', $data['answer']); |
974 | 974 | $res = $row->save(); |
975 | - if ( ! $res) { |
|
975 | + if (!$res) { |
|
976 | 976 | Util::sysLogMsg('Action_queue_answer', implode(' ', $row->getMessages())); |
977 | 977 | } |
978 | 978 | } |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | $row->writeAttribute('dialstatus', $data['dialstatus']); |
1002 | 1002 | } |
1003 | 1003 | $res = $row->save(); |
1004 | - if ( ! $res) { |
|
1004 | + if (!$res) { |
|
1005 | 1005 | Util::sysLogMsg('Action_queue_end', implode(' ', $row->getMessages())); |
1006 | 1006 | } |
1007 | 1007 | } |
@@ -1031,11 +1031,11 @@ discard block |
||
1031 | 1031 | if ($dest_chan === $row->dst_chan) { |
1032 | 1032 | $is_local = (stripos($data['src_chan'], 'local/') !== false); |
1033 | 1033 | $is_stored_local = (stripos($row->src_chan, 'local/') !== false); |
1034 | - if ($row->UNIQUEID === $data['UNIQUEID'] && $is_local && ! $is_stored_local) { |
|
1034 | + if ($row->UNIQUEID === $data['UNIQUEID'] && $is_local && !$is_stored_local) { |
|
1035 | 1035 | $data['src_chan'] = $row->src_chan; |
1036 | 1036 | } |
1037 | 1037 | if (file_exists($row->recordingfile) || file_exists( |
1038 | - Util::trimExtensionForFile($row->recordingfile) . '.wav' |
|
1038 | + Util::trimExtensionForFile($row->recordingfile).'.wav' |
|
1039 | 1039 | )) { |
1040 | 1040 | // Переопределим путь к файлу записи разговора. Для конферецнии файл один. |
1041 | 1041 | $recordingfile = $row->recordingfile; |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | // Подменим ID на идентификатор конференции. |
1048 | 1048 | $row->writeAttribute('linkedid', $data['meetme_id']); |
1049 | 1049 | $res = $row->save(); |
1050 | - if ( ! $res) { |
|
1050 | + if (!$res) { |
|
1051 | 1051 | Util::sysLogMsg('Action_hangup_chan_meetme', implode(' ', $row->getMessages())); |
1052 | 1052 | } |
1053 | 1053 | } |
@@ -1064,11 +1064,11 @@ discard block |
||
1064 | 1064 | $row->writeAttribute('transfer', 0); |
1065 | 1065 | $row->writeAttribute('linkedid', $data['meetme_id']); |
1066 | 1066 | |
1067 | - if ( ! empty($recordingfile)) { |
|
1067 | + if (!empty($recordingfile)) { |
|
1068 | 1068 | $row->writeAttribute('recordingfile', $recordingfile); |
1069 | 1069 | } |
1070 | 1070 | $res = $row->save(); |
1071 | - if ( ! $res) { |
|
1071 | + if (!$res) { |
|
1072 | 1072 | Util::sysLogMsg('Action_hangup_chan_meetme', implode(' ', $row->getMessages())); |
1073 | 1073 | } |
1074 | 1074 | } |
@@ -1107,9 +1107,9 @@ discard block |
||
1107 | 1107 | */ |
1108 | 1108 | public function callEventsWorker($tube): void |
1109 | 1109 | { |
1110 | - $data = json_decode($tube->getBody(), true); |
|
1111 | - $funcName = "Action_".$data['action']??''; |
|
1112 | - if ( method_exists($this, $funcName) ) { |
|
1110 | + $data = json_decode($tube->getBody(), true); |
|
1111 | + $funcName = "Action_".$data['action'] ?? ''; |
|
1112 | + if (method_exists($this, $funcName)) { |
|
1113 | 1113 | $this->$funcName($data); |
1114 | 1114 | } |
1115 | 1115 | $tube->reply(json_encode(true)); |
@@ -1139,14 +1139,14 @@ discard block |
||
1139 | 1139 | public function updateDataInDbM($data): bool |
1140 | 1140 | { |
1141 | 1141 | if (empty($data['UNIQUEID'])) { |
1142 | - Util::sysLogMsg(__FUNCTION__, 'UNIQUEID is empty ' . json_encode($data)); |
|
1142 | + Util::sysLogMsg(__FUNCTION__, 'UNIQUEID is empty '.json_encode($data)); |
|
1143 | 1143 | |
1144 | 1144 | return false; |
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | $filter = [ |
1148 | 1148 | "UNIQUEID=:id:", |
1149 | - 'bind' => ['id' => $data['UNIQUEID'],], |
|
1149 | + 'bind' => ['id' => $data['UNIQUEID'], ], |
|
1150 | 1150 | ]; |
1151 | 1151 | /** @var CallDetailRecordsTmp $m_data */ |
1152 | 1152 | $m_data = CallDetailRecordsTmp::findFirst($filter); |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | } |
1156 | 1156 | $f_list = $m_data->toArray(); |
1157 | 1157 | foreach ($data as $attribute => $value) { |
1158 | - if ( ! array_key_exists($attribute, $f_list)) { |
|
1158 | + if (!array_key_exists($attribute, $f_list)) { |
|
1159 | 1159 | continue; |
1160 | 1160 | } |
1161 | 1161 | if ('UNIQUEID' === $attribute) { |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | $m_data->writeAttribute($attribute, $value); |
1165 | 1165 | } |
1166 | 1166 | $res = $m_data->save(); |
1167 | - if ( ! $res) { |
|
1167 | + if (!$res) { |
|
1168 | 1168 | Util::sysLogMsg(__FUNCTION__, implode(' ', $m_data->getMessages())); |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1203,7 +1203,7 @@ discard block |
||
1203 | 1203 | public static function insertDataToDbM($data): bool |
1204 | 1204 | { |
1205 | 1205 | if (empty($data['UNIQUEID'])) { |
1206 | - Util::sysLogMsg(__FUNCTION__, 'UNIQUEID is empty ' . json_encode($data)); |
|
1206 | + Util::sysLogMsg(__FUNCTION__, 'UNIQUEID is empty '.json_encode($data)); |
|
1207 | 1207 | |
1208 | 1208 | return false; |
1209 | 1209 | } |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | } elseif (isset($data['IS_ORGNT']) && $data['IS_ORGNT'] !== false && $data['action'] === 'dial') { |
1226 | 1226 | if (empty($m_data->endtime)) { |
1227 | 1227 | // Если это оригинация dial может прийти дважды. |
1228 | - if(!empty($m_data->src_num) && $m_data->src_num === $data['dst_num']){ |
|
1228 | + if (!empty($m_data->src_num) && $m_data->src_num === $data['dst_num']) { |
|
1229 | 1229 | $m_data->dst_num = $data['src_num']; |
1230 | 1230 | $m_data->save(); |
1231 | 1231 | } |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | $new_m_data->transfer = $data['transfer']; |
1251 | 1251 | |
1252 | 1252 | $res = $new_m_data->save(); |
1253 | - if ( ! $res) { |
|
1253 | + if (!$res) { |
|
1254 | 1254 | Util::sysLogMsg(__FUNCTION__, implode(' ', $m_data->getMessages())); |
1255 | 1255 | } |
1256 | 1256 | |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | |
1260 | 1260 | $f_list = $m_data->toArray(); |
1261 | 1261 | foreach ($data as $attribute => $value) { |
1262 | - if ( ! array_key_exists($attribute, $f_list)) { |
|
1262 | + if (!array_key_exists($attribute, $f_list)) { |
|
1263 | 1263 | continue; |
1264 | 1264 | } |
1265 | 1265 | if ($is_new === false && 'UNIQUEID' === $attribute) { |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | $m_data->writeAttribute($attribute, $value); |
1269 | 1269 | } |
1270 | 1270 | $res = $m_data->save(); |
1271 | - if ( ! $res) { |
|
1271 | + if (!$res) { |
|
1272 | 1272 | Util::sysLogMsg(__FUNCTION__, implode(' ', $m_data->getMessages())); |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1283,12 +1283,12 @@ discard block |
||
1283 | 1283 | $q = $tube->getBody(); |
1284 | 1284 | $filter = json_decode($q, true); |
1285 | 1285 | |
1286 | - if($this->filterNotValid($filter)){ |
|
1286 | + if ($this->filterNotValid($filter)) { |
|
1287 | 1287 | $tube->reply('[]'); |
1288 | 1288 | return; |
1289 | 1289 | } |
1290 | 1290 | |
1291 | - $res = null; |
|
1291 | + $res = null; |
|
1292 | 1292 | try { |
1293 | 1293 | if (isset($filter['miko_tmp_db'])) { |
1294 | 1294 | $res = CallDetailRecordsTmp::find($filter); |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | } |
1308 | 1308 | $filter['add_pack_query']['bind'][$filter['columns']] = $arr; |
1309 | 1309 | |
1310 | - if($this->filterNotValid($filter['add_pack_query'])){ |
|
1310 | + if ($this->filterNotValid($filter['add_pack_query'])) { |
|
1311 | 1311 | $tube->reply('[]'); |
1312 | 1312 | return; |
1313 | 1313 | } |
@@ -1323,7 +1323,7 @@ discard block |
||
1323 | 1323 | if (isset($filter['miko_result_in_file'])) { |
1324 | 1324 | $di = Di::getDefault(); |
1325 | 1325 | $dirsConfig = $di->getShared('config'); |
1326 | - $filename = $dirsConfig->path('core.tempDir') . '/' . md5(microtime(true)); |
|
1326 | + $filename = $dirsConfig->path('core.tempDir').'/'.md5(microtime(true)); |
|
1327 | 1327 | file_put_contents($filename, $res_data); |
1328 | 1328 | Util::addRegularWWWRights($filename); |
1329 | 1329 | $res_data = json_encode($filename); |
@@ -1339,16 +1339,16 @@ discard block |
||
1339 | 1339 | * |
1340 | 1340 | * @return bool |
1341 | 1341 | */ |
1342 | - private function filterNotValid($filter){ |
|
1342 | + private function filterNotValid($filter) { |
|
1343 | 1343 | $haveErrors = false; |
1344 | - if(isset($filter['bind'])){ |
|
1345 | - if(is_array($filter)){ |
|
1344 | + if (isset($filter['bind'])) { |
|
1345 | + if (is_array($filter)) { |
|
1346 | 1346 | foreach ($filter['bind'] as $bindValue) { |
1347 | - if(empty($bindValue)){ |
|
1347 | + if (empty($bindValue)) { |
|
1348 | 1348 | $haveErrors = true; |
1349 | 1349 | } |
1350 | 1350 | } |
1351 | - }else{ |
|
1351 | + } else { |
|
1352 | 1352 | $haveErrors = true; |
1353 | 1353 | } |
1354 | 1354 | } |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | |
1358 | 1358 | public function errorHandler($m): void |
1359 | 1359 | { |
1360 | - Util::sysLogMsg(self::class . '_ERROR', $m); |
|
1360 | + Util::sysLogMsg(self::class.'_ERROR', $m); |
|
1361 | 1361 | } |
1362 | 1362 | } |
1363 | 1363 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $date = CallEventsLogs::maximum( |
50 | 50 | ['linkedid = "'.$row_cdr->linkedid.'"', 'column' => 'eventtime'] |
51 | 51 | ); |
52 | - if ( ! $row_cdr->endtime) { |
|
52 | + if (!$row_cdr->endtime) { |
|
53 | 53 | if ($date) { |
54 | 54 | $row_cdr->endtime = $date; |
55 | 55 | } elseif ($row_cdr->answer) { |