@@ -33,7 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | $di->setShared( |
35 | 35 | self::SERVICE_NAME, |
36 | - function () { |
|
36 | + function() { |
|
37 | 37 | $viewsDir = appPath('src/AdminCabinet/Views'); |
38 | 38 | $view = new View(); |
39 | 39 | $view->setViewsDir($viewsDir); |
@@ -33,7 +33,8 @@ |
||
33 | 33 | { |
34 | 34 | $di->setShared( |
35 | 35 | self::SERVICE_NAME, |
36 | - function () { |
|
36 | + function () |
|
37 | + { |
|
37 | 38 | $viewsDir = appPath('src/AdminCabinet/Views'); |
38 | 39 | $view = new View(); |
39 | 40 | $view->setViewsDir($viewsDir); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $phpSessionDir = $di->getShared('config')->path('www.phpSessionDir'); |
35 | 35 | $di->setShared( |
36 | 36 | self::SERVICE_NAME, |
37 | - function () use ($phpSessionDir) { |
|
37 | + function() use ($phpSessionDir) { |
|
38 | 38 | $session = new SessionManager(); |
39 | 39 | $files = new SessionAdapter( |
40 | 40 | [ |
@@ -34,7 +34,8 @@ |
||
34 | 34 | $phpSessionDir = $di->getShared('config')->path('www.phpSessionDir'); |
35 | 35 | $di->setShared( |
36 | 36 | self::SERVICE_NAME, |
37 | - function () use ($phpSessionDir) { |
|
37 | + function () use ($phpSessionDir) |
|
38 | + { |
|
38 | 39 | $session = new SessionManager(); |
39 | 40 | $files = new SessionAdapter( |
40 | 41 | [ |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $di->setShared( |
37 | 37 | self::SERVICE_NAME, |
38 | - function () { |
|
38 | + function() { |
|
39 | 39 | $eventsManager = new EventsManager(); |
40 | 40 | |
41 | 41 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * Handle exceptions and not-found exceptions using NotFoundPlugin |
54 | 54 | */ |
55 | - if (! class_exists(PrettyPageHandler::class)) { |
|
55 | + if (!class_exists(PrettyPageHandler::class)) { |
|
56 | 56 | $eventsManager->attach( |
57 | 57 | 'dispatch:beforeException', |
58 | 58 | new NotFoundPlugin() |
@@ -35,7 +35,8 @@ |
||
35 | 35 | { |
36 | 36 | $di->setShared( |
37 | 37 | self::SERVICE_NAME, |
38 | - function () { |
|
38 | + function () |
|
39 | + { |
|
39 | 40 | $eventsManager = new EventsManager(); |
40 | 41 | |
41 | 42 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | $appConfig = $di->getShared('config')->adminApplication; |
32 | 32 | $di->setShared( |
33 | 33 | self::SERVICE_NAME, |
34 | - function () use ($view, $di, $appConfig) { |
|
35 | - $voltCacheDir = $appConfig->voltCacheDir . '/'; |
|
34 | + function() use ($view, $di, $appConfig) { |
|
35 | + $voltCacheDir = $appConfig->voltCacheDir.'/'; |
|
36 | 36 | $volt = new VoltEngine($view, $di); |
37 | 37 | $volt->setOptions( |
38 | 38 | [ |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | $compiler->addFunction('in_array', 'in_array'); |
45 | 45 | |
46 | 46 | if ($appConfig->debugMode === true) { |
47 | - $cacheFiles = glob($appConfig->voltCacheDir . '/*.php'); |
|
48 | - if ($cacheFiles!==false){ |
|
47 | + $cacheFiles = glob($appConfig->voltCacheDir.'/*.php'); |
|
48 | + if ($cacheFiles !== false) { |
|
49 | 49 | array_map( |
50 | 50 | 'unlink', |
51 | 51 | $cacheFiles |
@@ -31,7 +31,8 @@ |
||
31 | 31 | $appConfig = $di->getShared('config')->adminApplication; |
32 | 32 | $di->setShared( |
33 | 33 | self::SERVICE_NAME, |
34 | - function () use ($view, $di, $appConfig) { |
|
34 | + function () use ($view, $di, $appConfig) |
|
35 | + { |
|
35 | 36 | $voltCacheDir = $appConfig->voltCacheDir . '/'; |
36 | 37 | $volt = new VoltEngine($view, $di); |
37 | 38 | $volt->setOptions( |
@@ -31,12 +31,12 @@ |
||
31 | 31 | { |
32 | 32 | $di->setShared( |
33 | 33 | self::SERVICE_NAME, |
34 | - function () use ($di){ |
|
34 | + function() use ($di){ |
|
35 | 35 | $roSession = $di->getShared('sessionRO'); |
36 | 36 | if ($roSession !== null && array_key_exists( |
37 | 37 | 'WebAdminLanguage', |
38 | 38 | $roSession |
39 | - ) && ! empty($roSession['WebAdminLanguage'])) { |
|
39 | + ) && !empty($roSession['WebAdminLanguage'])) { |
|
40 | 40 | $language = $roSession['WebAdminLanguage']; |
41 | 41 | } elseif (array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) { |
42 | 42 | $ls = new LanguageSelector(); |
@@ -31,7 +31,8 @@ |
||
31 | 31 | { |
32 | 32 | $di->setShared( |
33 | 33 | self::SERVICE_NAME, |
34 | - function () use ($di){ |
|
34 | + function () use ($di) |
|
35 | + { |
|
35 | 36 | $roSession = $di->getShared('sessionRO'); |
36 | 37 | if ($roSession !== null && array_key_exists( |
37 | 38 | 'WebAdminLanguage', |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $q_conf .= "\n"; |
87 | 87 | } |
88 | 88 | |
89 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/queues.conf', $q_conf); |
|
89 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/queues.conf', $q_conf); |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | // Генерация внутреннего номерного плана. |
141 | 141 | $conf = "[queue_agent_answer]\n"; |
142 | 142 | $conf .= "exten => s,1,NoOp(--- Answer Queue ---)\n\t"; |
143 | - $conf .= 'same => n,Gosub(queue_answer,${EXTEN},1)' . "\n\t"; |
|
143 | + $conf .= 'same => n,Gosub(queue_answer,${EXTEN},1)'."\n\t"; |
|
144 | 144 | $conf .= "same => n,Return()\n\n"; |
145 | 145 | |
146 | 146 | return $conf; |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | $conf = ''; |
171 | 171 | $db_data = $this->getQueueData(); |
172 | 172 | foreach ($db_data as $queue) { |
173 | - $conf .= 'exten => _' . $queue['extension'] . ',1,Set(__ISTRANSFER=transfer_)' . " \n\t"; |
|
174 | - $conf .= 'same => n,Goto(internal,${EXTEN},1)' . " \n"; |
|
173 | + $conf .= 'exten => _'.$queue['extension'].',1,Set(__ISTRANSFER=transfer_)'." \n\t"; |
|
174 | + $conf .= 'same => n,Goto(internal,${EXTEN},1)'." \n"; |
|
175 | 175 | } |
176 | 176 | $conf .= "\n"; |
177 | 177 | |
@@ -190,36 +190,36 @@ discard block |
||
190 | 190 | $queue_ext_conf = ''; |
191 | 191 | $db_data = $this->getQueueData(); |
192 | 192 | foreach ($db_data as $queue) { |
193 | - $calleridPrefix = preg_replace('/[^a-zA-Zа-яА-Я0-9 ]/ui', '', $queue['callerid_prefix']??''); |
|
193 | + $calleridPrefix = preg_replace('/[^a-zA-Zа-яА-Я0-9 ]/ui', '', $queue['callerid_prefix'] ?? ''); |
|
194 | 194 | |
195 | 195 | $queue_ext_conf .= "exten => {$queue['extension']},1,NoOp(--- Start Queue ---) \n\t"; |
196 | 196 | $queue_ext_conf .= "same => n,Answer() \n\t"; |
197 | - $queue_ext_conf .= 'same => n,Set(__QUEUE_SRC_CHAN=${CHANNEL})' . "\n\t"; |
|
198 | - $queue_ext_conf .= 'same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))' . "\n\t"; |
|
199 | - $queue_ext_conf .= 'same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)' . "\n\t"; |
|
200 | - $queue_ext_conf .= 'same => n,Gosub(queue_start,${EXTEN},1)' . "\n\t"; |
|
197 | + $queue_ext_conf .= 'same => n,Set(__QUEUE_SRC_CHAN=${CHANNEL})'."\n\t"; |
|
198 | + $queue_ext_conf .= 'same => n,ExecIf($["${CHANNEL(channeltype)}" == "Local"]?Gosub(set_orign_chan,s,1))'."\n\t"; |
|
199 | + $queue_ext_conf .= 'same => n,Set(CHANNEL(hangup_handler_wipe)=hangup_handler,s,1)'."\n\t"; |
|
200 | + $queue_ext_conf .= 'same => n,Gosub(queue_start,${EXTEN},1)'."\n\t"; |
|
201 | 201 | |
202 | 202 | $options = ''; |
203 | 203 | if (isset($queue['caller_hear']) && $queue['caller_hear'] === 'ringing') { |
204 | 204 | $options .= 'r'; // Установить КПВ (гудки) вместо Музыки на Удержании для ожидающих в очереди |
205 | 205 | } |
206 | - $ringlength = (trim($queue['timeout_to_redirect_to_extension']) == '') ? 300 : $queue['timeout_to_redirect_to_extension']; |
|
207 | - if(!empty($calleridPrefix)){ |
|
206 | + $ringlength = (trim($queue['timeout_to_redirect_to_extension']) == '') ? 300 : $queue['timeout_to_redirect_to_extension']; |
|
207 | + if (!empty($calleridPrefix)) { |
|
208 | 208 | $queue_ext_conf .= "same => n,Set(CALLERID(name)={$calleridPrefix}:".'${CALLERID(name)}'.") \n\t"; |
209 | 209 | } |
210 | 210 | |
211 | 211 | $queue_ext_conf .= "same => n,Queue({$queue['uniqid']},CkT{$options},,,{$ringlength},,,queue_agent_answer) \n\t"; |
212 | 212 | // Оповестим о завершении работы очереди. |
213 | - $queue_ext_conf .= 'same => n,Gosub(queue_end,${EXTEN},1)' . "\n\t"; |
|
213 | + $queue_ext_conf .= 'same => n,Gosub(queue_end,${EXTEN},1)'."\n\t"; |
|
214 | 214 | |
215 | 215 | if (trim($queue['timeout_extension']) !== '') { |
216 | 216 | // Если по таймауту не ответили, то выполним переадресацию. |
217 | - $queue_ext_conf .= 'same => n,ExecIf($["${QUEUESTATUS}" == "TIMEOUT"]?Goto(internal,' . $queue['timeout_extension'] . ',1))' . " \n\t"; |
|
217 | + $queue_ext_conf .= 'same => n,ExecIf($["${QUEUESTATUS}" == "TIMEOUT"]?Goto(internal,'.$queue['timeout_extension'].',1))'." \n\t"; |
|
218 | 218 | } |
219 | 219 | if (trim($queue['redirect_to_extension_if_empty']) !== '') { |
220 | 220 | // Если пустая очередь, то выполним переадресацию. |
221 | - $exp = '$["${QUEUESTATUS}" == "JOINEMPTY" || "${QUEUESTATUS}" == "LEAVEEMPTY" ]'; |
|
222 | - $queue_ext_conf .= 'same => n,ExecIf(' . $exp . '?Goto(internal,' . $queue['redirect_to_extension_if_empty'] . ',1))' . " \n\t"; |
|
221 | + $exp = '$["${QUEUESTATUS}" == "JOINEMPTY" || "${QUEUESTATUS}" == "LEAVEEMPTY" ]'; |
|
222 | + $queue_ext_conf .= 'same => n,ExecIf('.$exp.'?Goto(internal,'.$queue['redirect_to_extension_if_empty'].',1))'." \n\t"; |
|
223 | 223 | } |
224 | 224 | $queue_ext_conf .= "\n"; |
225 | 225 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public static function queueReload(): void |
234 | 234 | { |
235 | - $queue = new self(); |
|
235 | + $queue = new self(); |
|
236 | 236 | $queue->generateConfig(); |
237 | 237 | $out = []; |
238 | 238 | $asteriskPath = Util::which('asterisk'); |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | $orign_chan = $agi->get_variable("orign_chan", true); |
33 | 33 | $id = $agi->get_variable("pt1c_UNIQUEID", true); |
34 | 34 | $IS_ORGNT = $agi->get_variable("IS_ORGNT", true); |
35 | - if ($id == '' || ! empty($QUEUE_SRC_CHAN)) { |
|
35 | + if ($id == '' || !empty($QUEUE_SRC_CHAN)) { |
|
36 | 36 | // Если это вызов на агента очереди !empty($QUEUE_SRC_CHAN). |
37 | 37 | // Если это новый вызов $id == ''. |
38 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
38 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
39 | 39 | } |
40 | 40 | // Канал, AGI скрипта. |
41 | 41 | $channel = $agi->request['agi_channel']; |
42 | - $is_local = ! (stripos($channel, 'local/') === false); |
|
42 | + $is_local = !(stripos($channel, 'local/') === false); |
|
43 | 43 | if ($QUEUE_SRC_CHAN != '' && $is_local) { |
44 | 44 | // Это LOCAL, Переопределим на исходный. |
45 | 45 | $channel = $QUEUE_SRC_CHAN; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | $data['action'] = "$action"; |
57 | - if ( ! empty($IS_ORGNT)) { |
|
57 | + if (!empty($IS_ORGNT)) { |
|
58 | 58 | $dst_num = $agi->request['agi_callerid']; |
59 | 59 | $src_num = $agi->request['agi_extension']; |
60 | 60 | $data['dialstatus'] = 'ORIGINATE'; |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $num = substr($agi->request['agi_channel'], $p_start, $p_end); |
66 | 66 | |
67 | 67 | $p_start = strpos($agi->request['agi_channel'], ';'); |
68 | - $dst_chan = substr($agi->request['agi_channel'], 0, $p_start) . ';1'; |
|
68 | + $dst_chan = substr($agi->request['agi_channel'], 0, $p_start).';1'; |
|
69 | 69 | |
70 | - $id = substr($agi->request['agi_uniqueid'], 0, 16) . '_' . $num . '_' . $IS_ORGNT; |
|
70 | + $id = substr($agi->request['agi_uniqueid'], 0, 16).'_'.$num.'_'.$IS_ORGNT; |
|
71 | 71 | $data['dst_chan'] = $dst_chan; |
72 | 72 | } else { |
73 | 73 | $src_num = $agi->request['agi_callerid']; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $data['agi_channel'] = $agi->request['agi_channel']; |
85 | 85 | $data['did'] = $agi->get_variable("FROM_DID", true); |
86 | 86 | $data['from_account'] = $from_account; |
87 | - $data['IS_ORGNT'] = ! empty($IS_ORGNT); |
|
87 | + $data['IS_ORGNT'] = !empty($IS_ORGNT); |
|
88 | 88 | |
89 | 89 | $agi->set_variable("__pt1c_UNIQUEID", "$id"); |
90 | 90 | |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | $IS_ORGNT = $agi->get_variable("IS_ORGNT", true); |
118 | - if ( ! empty($IS_ORGNT)) { |
|
118 | + if (!empty($IS_ORGNT)) { |
|
119 | 119 | // Вероятно необходимо переопределить искать по двум ID. |
120 | 120 | // Применимо только для Originate, когда в качестве звонящего используем два канала |
121 | 121 | // мобильный и внутренний номер. |
122 | 122 | $peer_mobile = $agi->get_variable("peer_mobile", true); |
123 | - if ( ! empty($peer_mobile) && stripos($id, $peer_mobile) === false) { |
|
124 | - $id = substr($agi->request['agi_uniqueid'], 0, 16) . '_' . $peer_mobile . '_' . $IS_ORGNT; |
|
123 | + if (!empty($peer_mobile) && stripos($id, $peer_mobile) === false) { |
|
124 | + $id = substr($agi->request['agi_uniqueid'], 0, 16).'_'.$peer_mobile.'_'.$IS_ORGNT; |
|
125 | 125 | $data['org_id'] = $id; |
126 | 126 | } |
127 | 127 | } |
@@ -154,22 +154,22 @@ discard block |
||
154 | 154 | $data['BRIDGEPEER'] = $agi->get_variable("FROM_CHAN", true); |
155 | 155 | |
156 | 156 | $IS_ORGNT = $agi->get_variable("IS_ORGNT", true); |
157 | - if ( ! empty($IS_ORGNT)) { |
|
157 | + if (!empty($IS_ORGNT)) { |
|
158 | 158 | // Вероятно необходимо переопределить ID. |
159 | 159 | // Применимо только для Originate, когда в качестве звонящего используем два канала |
160 | 160 | // мобильный и внутренний номер. |
161 | 161 | $peer_mobile = $agi->get_variable("peer_mobile", true); |
162 | - if ( ! empty($peer_mobile) && stripos($id, $peer_mobile) === false) { |
|
163 | - $id = substr($agi->request['agi_uniqueid'], 0, 16) . '_' . $peer_mobile . '_' . $IS_ORGNT; |
|
162 | + if (!empty($peer_mobile) && stripos($id, $peer_mobile) === false) { |
|
163 | + $id = substr($agi->request['agi_uniqueid'], 0, 16).'_'.$peer_mobile.'_'.$IS_ORGNT; |
|
164 | 164 | $data['org_id'] = $id; |
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
168 | - if ( ! empty($data['ENDCALLONANSWER'])) { |
|
168 | + if (!empty($data['ENDCALLONANSWER'])) { |
|
169 | 169 | $agi->set_variable("__ENDCALLONANSWER", ""); |
170 | 170 | } |
171 | 171 | |
172 | - $PICKUPEER = trim('' . $agi->get_variable("PICKUPEER", true)); |
|
172 | + $PICKUPEER = trim(''.$agi->get_variable("PICKUPEER", true)); |
|
173 | 173 | $data['dnid'] = $agi->request['agi_dnid']; |
174 | 174 | $mikoPBXConfig = new MikoPBXConfig(); |
175 | 175 | $pickupexten = $mikoPBXConfig->getGeneralSettings('PickupExten'); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | // Очищаем переменную канала. Больше не требуется. |
185 | 185 | $agi->set_variable("PICKUPEER", ""); |
186 | 186 | $data['old_id'] = $id; |
187 | - $data['id'] = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
187 | + $data['id'] = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
188 | 188 | } |
189 | 189 | $agi->set_variable("__pt1c_UNIQUEID", "$id"); |
190 | 190 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $data['linkedid'] = $agi->get_variable("CDR(linkedid)", true); |
212 | 212 | $data['did'] = $agi->get_variable("FROM_DID", true); |
213 | 213 | |
214 | - $data['agi_threadid'] = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
214 | + $data['agi_threadid'] = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
215 | 215 | |
216 | 216 | return $data; |
217 | 217 | } |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | function Event_transfer_dial($agi, $action) |
228 | 228 | { |
229 | 229 | $now = Util::getNowDate(); |
230 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
230 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
231 | 231 | |
232 | 232 | // Пытаемся определить канал. |
233 | 233 | $TRANSFERERNAME = $agi->get_variable("TRANSFERERNAME", true); |
234 | 234 | $QUEUE_SRC_CHAN = $agi->get_variable("QUEUE_SRC_CHAN", true); |
235 | - $is_local = ! (stripos($TRANSFERERNAME, 'local/') === false); |
|
235 | + $is_local = !(stripos($TRANSFERERNAME, 'local/') === false); |
|
236 | 236 | if ($QUEUE_SRC_CHAN != '' && $is_local) { |
237 | 237 | // Это LOCAL, Переопределим на исходный. |
238 | 238 | $channel = $QUEUE_SRC_CHAN; |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | |
248 | 248 | $data = []; |
249 | 249 | $data['action'] = "$action"; |
250 | - $data['agi_channel'] = $channel;// $agi->request['agi_channel']; |
|
250 | + $data['agi_channel'] = $channel; // $agi->request['agi_channel']; |
|
251 | 251 | $data['linkedid'] = $agi->get_variable("CDR(linkedid)", true); |
252 | 252 | $data['src_chan'] = $channel; |
253 | 253 | $data['did'] = $agi->get_variable("FROM_DID", true); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $data['did'] = $agi->get_variable("FROM_DID", true); |
322 | 322 | $data['action'] = "$action"; |
323 | 323 | $data['agi_channel'] = $agi->request['agi_channel']; |
324 | - $data['agi_threadid'] = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
324 | + $data['agi_threadid'] = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
325 | 325 | |
326 | 326 | $pos = stripos($data['agi_channel'], 'local/'); |
327 | 327 | if ($pos === false) { |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $data = []; |
351 | 351 | $data['action'] = "$action"; |
352 | 352 | $data['did'] = $agi->get_variable("FROM_DID", true); |
353 | - $data['agi_threadid'] = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
353 | + $data['agi_threadid'] = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
354 | 354 | |
355 | 355 | $data['linkedid'] = $agi->get_variable("CDR(linkedid)", true); |
356 | 356 | $data['dialstatus'] = $agi->get_variable("DIALSTATUS", true); |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $agi->set_variable("pt1c_PARK_CHAN", $park_row['ParkeeChannel']); |
386 | 386 | |
387 | 387 | // Сбор данных для генерации CDR. |
388 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
388 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
389 | 389 | $channel = $agi->request['agi_channel']; |
390 | 390 | $agi->set_variable("__pt1c_UNIQUEID", "$id"); |
391 | 391 | $data = []; |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $data['src_chan'] = $channel; |
404 | 404 | $data['src_num'] = $agi->request['agi_callerid']; |
405 | 405 | $data['dst_num'] = $agi->request['agi_extension']; |
406 | - $data['dst_chan'] = 'Park:' . $agi->request['agi_extension']; |
|
406 | + $data['dst_chan'] = 'Park:'.$agi->request['agi_extension']; |
|
407 | 407 | } elseif (true === $park_row['pt1c_is_dst']) { |
408 | 408 | $data['src_chan'] = $channel; |
409 | 409 | $data['dst_chan'] = $park_row['ParkeeChannel']; |
@@ -419,11 +419,11 @@ discard block |
||
419 | 419 | if (trim($park_row['ParkingDuration']) !== '') { |
420 | 420 | $time_start = date("Y-m-d H:i:s", time() - 1 * ($park_row['ParkingDuration'])); |
421 | 421 | $data_parking = [ |
422 | - 'UNIQUEID' => $id . '_' . Util::generateRandomString(3), |
|
422 | + 'UNIQUEID' => $id.'_'.Util::generateRandomString(3), |
|
423 | 423 | 'src_chan' => $park_row['ParkeeChannel'], |
424 | 424 | 'src_num' => $park_row['ParkeeCallerIDNum'], |
425 | 425 | 'dst_num' => $park_row['ParkingSpace'], |
426 | - 'dst_chan' => 'Park:' . $park_row['ParkingSpace'], |
|
426 | + 'dst_chan' => 'Park:'.$park_row['ParkingSpace'], |
|
427 | 427 | 'start' => $time_start, |
428 | 428 | 'answer' => $time_start, |
429 | 429 | 'endtime' => $now, |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | function Event_unpark_call_timeout($agi, $action) |
449 | 449 | { |
450 | 450 | $now = Util::getNowDate(); |
451 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
451 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
452 | 452 | // PARKER=SIP/206 |
453 | 453 | $PARKING_DURATION = $agi->get_variable("PARKING_DURATION", true); |
454 | 454 | $PARKING_DURATION = ($PARKING_DURATION == '') ? 45 : $PARKING_DURATION; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | 'src_chan' => $agi->request['agi_channel'], // $agi->get_variable("PARKER", true), // ??? |
461 | 461 | 'src_num' => $agi->request['agi_callerid'], |
462 | 462 | 'dst_num' => $PARKING_SPACE, |
463 | - 'dst_chan' => 'Park:' . $PARKING_SPACE, |
|
463 | + 'dst_chan' => 'Park:'.$PARKING_SPACE, |
|
464 | 464 | 'start' => $time_start, |
465 | 465 | 'answer' => $time_start, |
466 | 466 | 'endtime' => $now, |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | ]; |
473 | 473 | |
474 | 474 | |
475 | - $id2 = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
475 | + $id2 = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
476 | 476 | $agi->set_variable("__pt1c_UNIQUEID", "$id2"); |
477 | 477 | |
478 | 478 | return $data; |
@@ -493,8 +493,8 @@ discard block |
||
493 | 493 | $id = $agi->get_variable("pt1c_UNIQUEID", true); |
494 | 494 | $ISTRANSFER = $agi->get_variable("ISTRANSFER", true); |
495 | 495 | |
496 | - if (empty($id) || ! empty($ISTRANSFER)) { |
|
497 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
496 | + if (empty($id) || !empty($ISTRANSFER)) { |
|
497 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
498 | 498 | $time_start = $now; |
499 | 499 | } |
500 | 500 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | // 'src_chan' => $agi->request['agi_channel'], |
504 | 504 | // 'src_num' => $agi->request['agi_callerid'], |
505 | 505 | 'dst_num' => $agi->request['agi_extension'], |
506 | - 'dst_chan' => 'Queue:' . $agi->request['agi_extension'], |
|
506 | + 'dst_chan' => 'Queue:'.$agi->request['agi_extension'], |
|
507 | 507 | // 'answer' => $time_start, |
508 | 508 | // 'end' => $now, |
509 | 509 | 'did' => $agi->get_variable("FROM_DID", true), |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | 'UNIQUEID' => $id, |
512 | 512 | 'linkedid' => $agi->get_variable("CDR(linkedid)", true), |
513 | 513 | ]; |
514 | - if ( ! empty($time_start)) { |
|
514 | + if (!empty($time_start)) { |
|
515 | 515 | $data['src_chan'] = $agi->get_variable("QUEUE_SRC_CHAN", true); |
516 | 516 | $data['src_num'] = $agi->request['agi_callerid']; |
517 | 517 | $data['start'] = $time_start; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | $data['transfer'] = '0'; |
520 | 520 | $agi->set_variable("__pt1c_q_UNIQUEID", "$id"); |
521 | 521 | } |
522 | - if ( ! empty($ISTRANSFER)) { |
|
522 | + if (!empty($ISTRANSFER)) { |
|
523 | 523 | $data['transfer'] = '1'; |
524 | 524 | } else { |
525 | 525 | $data['transfer'] = '0'; |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | |
591 | 591 | $is_conf = ($agi->get_variable('CALLERID(num)', true) === 'Conference_Room'); |
592 | 592 | $not_local = (stripos($agi->request['agi_channel'], 'local/') === false); |
593 | - if ($not_local && ! $is_conf) { |
|
593 | + if ($not_local && !$is_conf) { |
|
594 | 594 | $am = Util::getAstManager(); |
595 | 595 | $res = $am->meetMeCollectInfo($exten, ['conf_1c']); |
596 | 596 | $callid = $agi->request['agi_callerid']; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } |
629 | 629 | |
630 | 630 | if (empty($id)) { |
631 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
631 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
632 | 632 | } |
633 | 633 | |
634 | 634 | $recordingfile = CdrDb::MeetMeSetRecFilename($id); |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | 'src_chan' => $agi->request['agi_channel'], |
638 | 638 | 'src_num' => $src_num, |
639 | 639 | 'dst_num' => $dst_num, |
640 | - 'dst_chan' => 'MeetMe:' . $mikoidconf, |
|
640 | + 'dst_chan' => 'MeetMe:'.$mikoidconf, |
|
641 | 641 | 'start' => $time_start, |
642 | 642 | 'answer' => $time_start, |
643 | 643 | 'recordingfile' => "{$recordingfile}.mp3", |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | $lamePath = Util::which('lame'); |
680 | 680 | $nicePath = Util::which('nice'); |
681 | 681 | $chmodPath = Util::which('chmod'); |
682 | - $command = "{$nicePath} -n 19 {$lamePath} -b 32 --silent \"{$recordingfile}.wav\" \"{$recordingfile}.mp3\" && {$chmodPath} o+r \"{$recordingfile}.mp3\""; |
|
682 | + $command = "{$nicePath} -n 19 {$lamePath} -b 32 --silent \"{$recordingfile}.wav\" \"{$recordingfile}.mp3\" && {$chmodPath} o+r \"{$recordingfile}.mp3\""; |
|
683 | 683 | Util::mwExecBg($command); |
684 | 684 | |
685 | 685 | return $data; |
@@ -695,14 +695,14 @@ discard block |
||
695 | 695 | */ |
696 | 696 | function Event_dial_app($agi, $action) |
697 | 697 | { |
698 | - $id = $agi->request['agi_uniqueid'] . '_' . Util::generateRandomString(); |
|
698 | + $id = $agi->request['agi_uniqueid'].'_'.Util::generateRandomString(); |
|
699 | 699 | $extension = $agi->get_variable("APPEXTEN", true); |
700 | 700 | if (empty($extension)) { |
701 | 701 | $extension = $agi->request['agi_extension']; |
702 | 702 | } |
703 | 703 | |
704 | 704 | $data = Event_dial($agi, $action); |
705 | - $data['dst_chan'] = 'App:' . $extension; |
|
705 | + $data['dst_chan'] = 'App:'.$extension; |
|
706 | 706 | $data['dst_num'] = $extension; |
707 | 707 | $data['is_app'] = 1; |
708 | 708 | $data['UNIQUEID'] = $id; |
@@ -743,5 +743,5 @@ discard block |
||
743 | 743 | $result = $func_name($agi, $action); |
744 | 744 | // Оповещение без задержек. |
745 | 745 | $data = base64_encode(json_encode($result)); |
746 | - $agi->exec("UserEvent", "CdrConnector,AgiData:" . base64_encode(json_encode($result))); |
|
746 | + $agi->exec("UserEvent", "CdrConnector,AgiData:".base64_encode(json_encode($result))); |
|
747 | 747 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public static function LogEvent($data): void |
27 | 27 | { |
28 | 28 | if (is_file('/tmp/debug')) { |
29 | - file_put_contents('/tmp/dial_log', $data . "\n", FILE_APPEND); |
|
29 | + file_put_contents('/tmp/dial_log', $data."\n", FILE_APPEND); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $dbname = $di->getShared('config')->path('cdrDatabase.dbfile'); |
46 | 46 | } else { |
47 | 47 | $id = (int) str_replace('mikopbx-', '', $id); |
48 | - $dbname = 'cdr/' . date("Y/m/d/H/", $id) . $id . ".db"; |
|
48 | + $dbname = 'cdr/'.date("Y/m/d/H/", $id).$id.".db"; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $dbname; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $date = CallEventsLogs::maximum( |
70 | 70 | ['linkedid = "'.$row_cdr->linkedid.'"', 'column' => 'eventtime'] |
71 | 71 | ); |
72 | - if ( ! $row_cdr->endtime) { |
|
72 | + if (!$row_cdr->endtime) { |
|
73 | 73 | if ($date) { |
74 | 74 | $row_cdr->endtime = $date; |
75 | 75 | } elseif ($row_cdr->answer) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // e.g. 10.0.2.56/21 = 10.0.0.0 |
41 | 41 | public function cidr2network($ip, $cidr) |
42 | 42 | { |
43 | - return long2ip((ip2long($ip)) & ((-1 << (32 - (int)$cidr)))); |
|
43 | + return long2ip((ip2long($ip)) & ((-1 << (32 - (int) $cidr)))); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | // convert netmask to cidr |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $netmask = explode(".", $netmask); |
52 | 52 | |
53 | 53 | foreach ($netmask as $octect) { |
54 | - $bits += strlen(str_replace("0", "", decbin((int)$octect))); |
|
54 | + $bits += strlen(str_replace("0", "", decbin((int) $octect))); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | return $bits; |