@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | string $processor, |
28 | 28 | string $actionName, |
29 | 29 | $payload = null, |
30 | - string $modulename='', |
|
30 | + string $modulename = '', |
|
31 | 31 | int $maxTimeout = 10, |
32 | 32 | int $priority = Pheanstalk::DEFAULT_PRIORITY |
33 | 33 | ): void |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | 'data' => $payload, |
38 | 38 | 'action' => $actionName |
39 | 39 | ]; |
40 | - if ($processor==='modules'){ |
|
40 | + if ($processor === 'modules') { |
|
41 | 41 | $requestMessage['module'] = $modulename; |
42 | 42 | } |
43 | 43 | try { |
44 | 44 | $message = json_encode($requestMessage, JSON_THROW_ON_ERROR); |
45 | - $response = $this->di->getShared('beanstalkConnectionWorkerAPI')->request($message, $maxTimeout, $priority); |
|
45 | + $response = $this->di->getShared('beanstalkConnectionWorkerAPI')->request($message, $maxTimeout, $priority); |
|
46 | 46 | if ($response !== false) { |
47 | 47 | $response = json_decode($response, true, 512, JSON_THROW_ON_ERROR); |
48 | 48 | $this->response->setPayloadSuccess($response); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $this |
66 | 66 | ->response |
67 | - ->setPayloadError($this->response->getHttpCodeDescription($code) . ' ' . $description) |
|
67 | + ->setPayloadError($this->response->getHttpCodeDescription($code).' '.$description) |
|
68 | 68 | ->setStatusCode($code); |
69 | 69 | } |
70 | 70 | } |
71 | 71 | \ No newline at end of file |
@@ -33,7 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | $di->setShared( |
35 | 35 | self::SERVICE_NAME, |
36 | - function () { |
|
36 | + function() { |
|
37 | 37 | return new BeanstalkClient(WorkerApiCommands::class); |
38 | 38 | } |
39 | 39 | ); |
@@ -33,7 +33,8 @@ |
||
33 | 33 | { |
34 | 34 | $di->setShared( |
35 | 35 | self::SERVICE_NAME, |
36 | - function () { |
|
36 | + function () |
|
37 | + { |
|
37 | 38 | return new BeanstalkClient(WorkerApiCommands::class); |
38 | 39 | } |
39 | 40 | ); |
@@ -143,11 +143,11 @@ |
||
143 | 143 | { |
144 | 144 | return [ |
145 | 145 | 'system' => [ |
146 | - 'enableModule', |
|
147 | - 'disableModule', |
|
148 | - 'uninstallModule', |
|
149 | - 'installNewModule', |
|
150 | - 'restoreDefaultSettings', |
|
146 | + 'enableModule', |
|
147 | + 'disableModule', |
|
148 | + 'uninstallModule', |
|
149 | + 'installNewModule', |
|
150 | + 'restoreDefaultSettings', |
|
151 | 151 | ], |
152 | 152 | ]; |
153 | 153 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | while ($this->needRestart === false) { |
57 | 57 | $beanstalk->wait(); |
58 | 58 | } |
59 | - if ($this->needRestart){ |
|
59 | + if ($this->needRestart) { |
|
60 | 60 | Processes::restartAllWorkers(); |
61 | 61 | } |
62 | 62 | } |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | $res->messages[] = "Unknown processor - {$processor} in prepareAnswer"; |
103 | 103 | } |
104 | 104 | } catch (Throwable $exception) { |
105 | - $res->messages[] = 'Exception on WorkerApiCommands - ' . $exception->getMessage(); |
|
106 | - $request = []; |
|
105 | + $res->messages[] = 'Exception on WorkerApiCommands - '.$exception->getMessage(); |
|
106 | + $request = []; |
|
107 | 107 | } finally { |
108 | 108 | $message->reply(json_encode($res->getResult())); |
109 | 109 | if ($res->success) { |
@@ -21,27 +21,27 @@ |
||
21 | 21 | |
22 | 22 | $lang = $this->generalSettings['PBXLanguage']; |
23 | 23 | |
24 | - $conf = "[directories]\n" . |
|
25 | - "astetcdir => {$this->config->path('asterisk.astetcdir')}\n" . |
|
26 | - "astagidir => {$this->config->path('asterisk.astagidir')}\n" . |
|
27 | - "astkeydir => /etc/asterisk\n" . |
|
28 | - "astrundir => /var/asterisk/run\n" . |
|
29 | - "astmoddir => {$this->config->path('asterisk.astmoddir')}\n" . |
|
30 | - "astvarlibdir => {$this->config->path('asterisk.astvarlibdir')}\n" . |
|
31 | - "astdbdir => {$this->config->path('asterisk.astdbdir')}\n" . |
|
32 | - "astlogdir => {$this->config->path('asterisk.astlogdir')}\n" . |
|
33 | - "astspooldir => {$this->config->path('asterisk.astspooldir')}\n" . |
|
34 | - "\n" . |
|
35 | - "\n" . |
|
36 | - "[options]\n" . |
|
37 | - "verbose = 0\n" . |
|
38 | - "debug = 0\n" . |
|
39 | - "dumpcore = no\n" . |
|
40 | - "transcode_via_sln = no\n" . |
|
41 | - "hideconnect = yes\n" . |
|
42 | - "defaultlanguage = {$lang}\n" . |
|
24 | + $conf = "[directories]\n". |
|
25 | + "astetcdir => {$this->config->path('asterisk.astetcdir')}\n". |
|
26 | + "astagidir => {$this->config->path('asterisk.astagidir')}\n". |
|
27 | + "astkeydir => /etc/asterisk\n". |
|
28 | + "astrundir => /var/asterisk/run\n". |
|
29 | + "astmoddir => {$this->config->path('asterisk.astmoddir')}\n". |
|
30 | + "astvarlibdir => {$this->config->path('asterisk.astvarlibdir')}\n". |
|
31 | + "astdbdir => {$this->config->path('asterisk.astdbdir')}\n". |
|
32 | + "astlogdir => {$this->config->path('asterisk.astlogdir')}\n". |
|
33 | + "astspooldir => {$this->config->path('asterisk.astspooldir')}\n". |
|
34 | + "\n". |
|
35 | + "\n". |
|
36 | + "[options]\n". |
|
37 | + "verbose = 0\n". |
|
38 | + "debug = 0\n". |
|
39 | + "dumpcore = no\n". |
|
40 | + "transcode_via_sln = no\n". |
|
41 | + "hideconnect = yes\n". |
|
42 | + "defaultlanguage = {$lang}\n". |
|
43 | 43 | "systemname = mikopbx\n"; |
44 | 44 | |
45 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/asterisk.conf', $conf); |
|
45 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/asterisk.conf', $conf); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | \ No newline at end of file |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $this->setChannelsData(); |
48 | 48 | if (is_array($data) && isset($data['infos'])) { |
49 | 49 | foreach ($data['infos'] as $channel_data) { |
50 | - $url = 'http://localhost/pbxcore/api/long/pub?id=' . $channel_data['channel']; |
|
50 | + $url = 'http://localhost/pbxcore/api/long/pub?id='.$channel_data['channel']; |
|
51 | 51 | |
52 | 52 | $data_for_send = $this->execFunction($channel_data['channel']); |
53 | 53 | if ($data_for_send) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $this->postData($url, "$data_for_send\n"); |
56 | 56 | } |
57 | 57 | |
58 | - if ( ! isset($COMMON_CNANNELS[$channel_data['channel']])) { |
|
58 | + if (!isset($COMMON_CNANNELS[$channel_data['channel']])) { |
|
59 | 59 | continue; |
60 | 60 | } |
61 | 61 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | private function execFunction($channel, $common_chan = null) |
133 | 133 | { |
134 | 134 | clearstatcache(); |
135 | - if ( ! $this->checkAction($channel, $common_chan)) { |
|
135 | + if (!$this->checkAction($channel, $common_chan)) { |
|
136 | 136 | return ''; |
137 | 137 | } |
138 | 138 | $data_for_send = null; |
@@ -163,18 +163,18 @@ discard block |
||
163 | 163 | */ |
164 | 164 | private function checkAction($channel, $common_chan = null) |
165 | 165 | { |
166 | - if ( ! $common_chan) { |
|
166 | + if (!$common_chan) { |
|
167 | 167 | $actions = $GLOBALS['ACTIONS']; |
168 | 168 | } else { |
169 | 169 | $actions = $GLOBALS['COMMON_CNANNELS'][$common_chan]; |
170 | 170 | } |
171 | 171 | |
172 | 172 | $enable = false; |
173 | - if ( ! $actions) { |
|
173 | + if (!$actions) { |
|
174 | 174 | return $enable; |
175 | 175 | } |
176 | 176 | // $data = null; |
177 | - $now = time(); |
|
177 | + $now = time(); |
|
178 | 178 | |
179 | 179 | $action_data = $actions[$channel] ?? null; |
180 | 180 | if ($action_data !== null) { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $tmpArray = []; |
50 | 50 | foreach ($data as $call) { |
51 | 51 | $keyHash = $call['email'].$call['start'].$call['from_number'].$call['to_number']; |
52 | - if(in_array($keyHash, $tmpArray, true)){ |
|
52 | + if (in_array($keyHash, $tmpArray, true)) { |
|
53 | 53 | continue; |
54 | 54 | } |
55 | 55 | $tmpArray[] = $keyHash; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * 'language' |
58 | 58 | * 'is_internal' |
59 | 59 | */ |
60 | - if ( ! isset($emails[$call['email']])) { |
|
60 | + if (!isset($emails[$call['email']])) { |
|
61 | 61 | $emails[$call['email']] = ''; |
62 | 62 | } |
63 | 63 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | // Start worker process |
109 | 109 | $workerClassname = WorkerNotifyByEmail::class; |
110 | -$action = $argv[1]??''; |
|
110 | +$action = $argv[1] ?? ''; |
|
111 | 111 | if ($action === 'start') { |
112 | 112 | cli_set_process_title($workerClassname); |
113 | 113 | while (true) { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function start($argv): void |
20 | 20 | { |
21 | 21 | $varEtcDir = $this->di->getShared('config')->path('core.varEtcDir'); |
22 | - $filename = "{$varEtcDir}/storage_device"; |
|
22 | + $filename = "{$varEtcDir}/storage_device"; |
|
23 | 23 | if (file_exists($filename)) { |
24 | 24 | $mount_point = file_get_contents($filename); |
25 | 25 | } else { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $out |
55 | 55 | ); |
56 | 56 | foreach ($out as $dir_info) { |
57 | - if ( ! is_dir($dir_info)) { |
|
57 | + if (!is_dir($dir_info)) { |
|
58 | 58 | echo 'error'; |
59 | 59 | continue; |
60 | 60 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $killallPath = Util::which('killall'); |
29 | 29 | |
30 | - return self::mwExec($killallPath . ' ' . escapeshellarg($procName)); |
|
30 | + return self::mwExec($killallPath.' '.escapeshellarg($procName)); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | $currentProcCount = count($processes); |
137 | 137 | |
138 | - if ( ! class_exists($className)) { |
|
138 | + if (!class_exists($className)) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | $workerObject = new $className(); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $countProc4Kill = $neededProcCount - $currentProcCount; |
178 | 178 | // Send SIGUSR1 command to them |
179 | 179 | while ($countProc4Kill >= 0) { |
180 | - if ( ! isset($processes[$countProc4Kill])) { |
|
180 | + if (!isset($processes[$countProc4Kill])) { |
|
181 | 181 | break; |
182 | 182 | } |
183 | 183 | // Kill old processes with timeout, maybe it is soft restart and worker die without any help |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | |
208 | 208 | $name = addslashes($name); |
209 | 209 | $filter_cmd = ''; |
210 | - if ( ! empty($exclude)) { |
|
211 | - $filter_cmd = "| $path_grep -v " . escapeshellarg($exclude); |
|
210 | + if (!empty($exclude)) { |
|
211 | + $filter_cmd = "| $path_grep -v ".escapeshellarg($exclude); |
|
212 | 212 | } |
213 | 213 | $out = []; |
214 | 214 | self::mwExec( |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $rmPath = Util::which('rm'); |
234 | 234 | $sleepPath = Util::which('sleep'); |
235 | 235 | if ($sleep_time > 0) { |
236 | - $filename = '/tmp/' . time() . '_noop.sh'; |
|
236 | + $filename = '/tmp/'.time().'_noop.sh'; |
|
237 | 237 | file_put_contents($filename, "{$sleepPath} {$sleep_time}; {$command}; {$rmPath} -rf {$filename}"); |
238 | 238 | $noop_command = "{$nohupPath} {$shPath} {$filename} > {$out_file} 2>&1 &"; |
239 | 239 | } else { |
@@ -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('PBXFeaturePickupExten'); |
@@ -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("CHANNEL(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("CHANNEL(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("CHANNEL(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("CHANNEL(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 | Processes::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 | } |