@@ -86,7 +86,7 @@ |
||
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | foreach ($peers as &$peer) { |
89 | - if(!empty($peer['id'])){ |
|
89 | + if (!empty($peer['id'])) { |
|
90 | 90 | continue; |
91 | 91 | } |
92 | 92 | if ($peer['host'] !== $provider->host || $peer['username'] !== $provider->username) { |
@@ -54,20 +54,20 @@ |
||
54 | 54 | $this->config = $this->di->getShared('config'); |
55 | 55 | $modulesDir = $this->config->path('core.modulesDir'); |
56 | 56 | |
57 | - if (empty($this->moduleUniqueId)){ |
|
57 | + if (empty($this->moduleUniqueId)) { |
|
58 | 58 | // Get child class parameters and define module Dir and UniqueID |
59 | 59 | $reflector = new ReflectionClassAlias(static::class); |
60 | 60 | $partsOfNameSpace = explode('\\', $reflector->getNamespaceName()); |
61 | - if (count($partsOfNameSpace)===3 && $partsOfNameSpace[0]==='Modules'){ |
|
61 | + if (count($partsOfNameSpace) === 3 && $partsOfNameSpace[0] === 'Modules') { |
|
62 | 62 | $this->moduleUniqueId = $partsOfNameSpace[1]; |
63 | - $this->moduleDir = $modulesDir.'/'.$this->moduleUniqueId; |
|
63 | + $this->moduleDir = $modulesDir.'/'.$this->moduleUniqueId; |
|
64 | 64 | } |
65 | 65 | } else { |
66 | - $this->moduleDir = "{$modulesDir}{$this->moduleUniqueId}"; |
|
66 | + $this->moduleDir = "{$modulesDir}{$this->moduleUniqueId}"; |
|
67 | 67 | } |
68 | 68 | |
69 | - $className = basename(str_replace('\\', '/', static::class)); |
|
70 | - $this->logger = new Logger($className, $this->moduleUniqueId); |
|
69 | + $className = basename(str_replace('\\', '/', static::class)); |
|
70 | + $this->logger = new Logger($className, $this->moduleUniqueId); |
|
71 | 71 | |
72 | 72 | } |
73 | 73 | } |
74 | 74 | \ No newline at end of file |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * Request result |
20 | 20 | * @var bool |
21 | 21 | */ |
22 | - public bool $success=false; |
|
22 | + public bool $success = false; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Array of result fields |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | |
49 | 49 | public function __construct() |
50 | 50 | { |
51 | - $this->success= false; |
|
51 | + $this->success = false; |
|
52 | 52 | $this->data = []; |
53 | 53 | $this->messages = []; |
54 | - $this->function =''; |
|
54 | + $this->function = ''; |
|
55 | 55 | $this->processor = ''; |
56 | 56 | } |
57 | 57 |
@@ -90,7 +90,7 @@ |
||
90 | 90 | * |
91 | 91 | * @return bool результат удаления |
92 | 92 | */ |
93 | - public function unInstallFiles(bool $keepSettings = false);//: bool Пока мешает удалять и обновлять старые модули, раскоменитровать после релиза 2020.5; |
|
93 | + public function unInstallFiles(bool $keepSettings = false); //: bool Пока мешает удалять и обновлять старые модули, раскоменитровать после релиза 2020.5; |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * Returns error messages |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | public function configure() |
32 | 32 | { |
33 | 33 | $lofFile = '/var/log/lastlog'; |
34 | - if(!file_exists($lofFile)){ |
|
34 | + if (!file_exists($lofFile)) { |
|
35 | 35 | file_put_contents($lofFile, ''); |
36 | 36 | } |
37 | 37 | $dropbear_dir = '/etc/dropbear'; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $dropbearkeyPath = Util::which('dropbearkey'); |
47 | 47 | $dropbearPath = Util::which('dropbear'); |
48 | 48 | foreach ($keytypes as $keytype => $db_key) { |
49 | - $res_keyfilepath = "{$dropbear_dir}/dropbear_" . $keytype . "_host_key"; |
|
49 | + $res_keyfilepath = "{$dropbear_dir}/dropbear_".$keytype."_host_key"; |
|
50 | 50 | $key = $this->mikoPBXConfig->getGeneralSettings($db_key); |
51 | 51 | $key = (isset($key) && is_string($key)) ? trim($key) : ""; |
52 | 52 | if (strlen($key) > 100) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | file_put_contents($res_keyfilepath, base64_decode($key)); |
55 | 55 | } |
56 | 56 | // If key not exists, we will generate and store new one into file and database |
57 | - if ( ! file_exists($res_keyfilepath)) { |
|
57 | + if (!file_exists($res_keyfilepath)) { |
|
58 | 58 | // Generation |
59 | 59 | Util::mwExec("{$dropbearkeyPath} -t $keytype -f $res_keyfilepath"); |
60 | 60 | // Storing |
@@ -24,7 +24,8 @@ |
||
24 | 24 | * ResParkingConf constructor. |
25 | 25 | * |
26 | 26 | */ |
27 | - public function __construct(){ |
|
27 | + public function __construct() |
|
28 | + { |
|
28 | 29 | parent::__construct(); |
29 | 30 | // Вызов "getSettings" приемлем, так как идет работа с инициализированной переменной generalSettings. |
30 | 31 | $this->getSettings(); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * ResParkingConf constructor. |
25 | 25 | * |
26 | 26 | */ |
27 | - public function __construct(){ |
|
27 | + public function __construct() { |
|
28 | 28 | parent::__construct(); |
29 | 29 | // Вызов "getSettings" приемлем, так как идет работа с инициализированной переменной generalSettings. |
30 | 30 | $this->getSettings(); |
@@ -33,18 +33,18 @@ discard block |
||
33 | 33 | protected function generateConfigProtected(): void |
34 | 34 | { |
35 | 35 | // Генерация конфигурационных файлов. |
36 | - $conf = "[general] \n" . |
|
37 | - "parkeddynamic = yes \n\n" . |
|
38 | - "[default] \n" . |
|
39 | - "context => parked-calls \n" . |
|
40 | - "parkedcallreparking = caller\n" . |
|
41 | - "parkedcalltransfers = caller\n" . |
|
42 | - "parkext => {$this->ParkingExt} \n" . |
|
43 | - "findslot => next\n" . |
|
44 | - "comebacktoorigin=no\n" . |
|
45 | - "comebackcontext = parked-calls-timeout\n" . |
|
36 | + $conf = "[general] \n". |
|
37 | + "parkeddynamic = yes \n\n". |
|
38 | + "[default] \n". |
|
39 | + "context => parked-calls \n". |
|
40 | + "parkedcallreparking = caller\n". |
|
41 | + "parkedcalltransfers = caller\n". |
|
42 | + "parkext => {$this->ParkingExt} \n". |
|
43 | + "findslot => next\n". |
|
44 | + "comebacktoorigin=no\n". |
|
45 | + "comebackcontext = parked-calls-timeout\n". |
|
46 | 46 | "parkpos => {$this->ParkingStartSlot}-{$this->ParkingEndSlot} \n\n"; |
47 | - file_put_contents($this->config->path('asterisk.astetcdir') . '/res_parking.conf', $conf); |
|
47 | + file_put_contents($this->config->path('asterisk.astetcdir').'/res_parking.conf', $conf); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | public function getSettings(): void |
83 | 83 | { |
84 | 84 | $this->ParkingExt = $this->generalSettings['PBXCallParkingExt']; |
85 | - $this->ParkingStartSlot = (int)$this->generalSettings['PBXCallParkingStartSlot']; |
|
86 | - $this->ParkingEndSlot = (int)$this->generalSettings['PBXCallParkingEndSlot']; |
|
85 | + $this->ParkingStartSlot = (int) $this->generalSettings['PBXCallParkingStartSlot']; |
|
86 | + $this->ParkingEndSlot = (int) $this->generalSettings['PBXCallParkingEndSlot']; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | public function getIncludeInternalTransfer(): string |
105 | 105 | { |
106 | 106 | // Генерация внутреннего номерного плана. |
107 | - return 'exten => ' . $this->ParkingExt . ',1,Goto(parked-calls,${EXTEN},1)' . "\n"; |
|
107 | + return 'exten => '.$this->ParkingExt.',1,Goto(parked-calls,${EXTEN},1)'."\n"; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -118,16 +118,16 @@ discard block |
||
118 | 118 | $conf = ''; |
119 | 119 | $conf .= "[parked-calls]\n"; |
120 | 120 | $conf .= "exten => _X!,1,AGI(cdr_connector.php,unpark_call)\n\t"; |
121 | - $conf .= 'same => n,ExecIf($["${pt1c_PARK_CHAN}x" == "x"]?Hangup())' . "\n\t"; |
|
122 | - $conf .= 'same => n,Bridge(${pt1c_PARK_CHAN},kKTt)' . "\n\t"; |
|
123 | - $conf .= 'same => n,Hangup()' . "\n\n"; |
|
121 | + $conf .= 'same => n,ExecIf($["${pt1c_PARK_CHAN}x" == "x"]?Hangup())'."\n\t"; |
|
122 | + $conf .= 'same => n,Bridge(${pt1c_PARK_CHAN},kKTt)'."\n\t"; |
|
123 | + $conf .= 'same => n,Hangup()'."\n\n"; |
|
124 | 124 | |
125 | 125 | $conf .= "[parked-calls-timeout]\n"; |
126 | 126 | $conf .= "exten => s,1,NoOp(This is all that happens to parked calls if they time out.)\n\t"; |
127 | - $conf .= 'same => n,Set(FROM_PEER=${EMPTYVAR})' . "\n\t"; |
|
128 | - $conf .= 'same => n,AGI(cdr_connector.php,unpark_call_timeout)' . "\n\t"; |
|
129 | - $conf .= 'same => n,Goto(internal,${CUT(PARKER,/,2)},1)' . "\n\t"; |
|
130 | - $conf .= 'same => n,Hangup()' . "\n\n"; |
|
127 | + $conf .= 'same => n,Set(FROM_PEER=${EMPTYVAR})'."\n\t"; |
|
128 | + $conf .= 'same => n,AGI(cdr_connector.php,unpark_call_timeout)'."\n\t"; |
|
129 | + $conf .= 'same => n,Goto(internal,${CUT(PARKER,/,2)},1)'."\n\t"; |
|
130 | + $conf .= 'same => n,Hangup()'."\n\n"; |
|
131 | 131 | |
132 | 132 | return $conf; |
133 | 133 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | $conf = ''; |
143 | 143 | for ($ext = $this->ParkingStartSlot; $ext <= $this->ParkingEndSlot; $ext++) { |
144 | - $conf .= 'exten => ' . $ext . ',1,Goto(parked-calls,${EXTEN},1)' . "\n"; |
|
144 | + $conf .= 'exten => '.$ext.',1,Goto(parked-calls,${EXTEN},1)'."\n"; |
|
145 | 145 | } |
146 | 146 | $conf .= "\n"; |
147 | 147 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | protected function generateConfigProtected(): void |
21 | 21 | { |
22 | - $logDir = System::getLogDir() . '/asterisk/'; |
|
22 | + $logDir = System::getLogDir().'/asterisk/'; |
|
23 | 23 | Util::mwMkdir($logDir); |
24 | 24 | $conf = "[general]\n"; |
25 | 25 | $conf .= "queue_log = no\n"; |
@@ -33,6 +33,6 @@ discard block |
||
33 | 33 | $conf .= "{$logDir}verbose => verbose(3),dtmf,fax\n"; |
34 | 34 | $conf .= "\n"; |
35 | 35 | |
36 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/logger.conf', $conf); |
|
36 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/logger.conf', $conf); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | |
15 | 15 | class WorkerRemoveOldRecords extends WorkerBase |
16 | 16 | { |
17 | - protected int $maxProc=1; |
|
17 | + protected int $maxProc = 1; |
|
18 | 18 | |
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 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return; |
91 | 91 | } |
92 | 92 | $max_size = 2; |
93 | - $log_dir = System::getLogDir() . '/asterisk/'; |
|
93 | + $log_dir = System::getLogDir().'/asterisk/'; |
|
94 | 94 | $text_config = "{$log_dir}{$f_name} { |
95 | 95 | nocreate |
96 | 96 | nocopytruncate |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | {$asteriskPath} -rx 'logger reload' > /dev/null 2> /dev/null |
106 | 106 | endscript |
107 | 107 | }"; |
108 | - $varEtcDir = $di->getShared('config')->path('core.varEtcDir'); |
|
109 | - $path_conf = $varEtcDir . '/asterisk_logrotate_' . $f_name . '.conf'; |
|
108 | + $varEtcDir = $di->getShared('config')->path('core.varEtcDir'); |
|
109 | + $path_conf = $varEtcDir.'/asterisk_logrotate_'.$f_name.'.conf'; |
|
110 | 110 | file_put_contents($path_conf, $text_config); |
111 | 111 | $mb10 = $max_size * 1024 * 1024; |
112 | 112 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | public static function checkCodec($name, $desc, $type): void |
204 | 204 | { |
205 | - $codec = Codecs::findFirst('name="' . $name . '"'); |
|
205 | + $codec = Codecs::findFirst('name="'.$name.'"'); |
|
206 | 206 | if ($codec === null) { |
207 | 207 | /** @var \MikoPBX\Common\Models\Codecs $codec_g722 */ |
208 | 208 | $codec = new Codecs(); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public static function sipReload():void |
220 | 220 | { |
221 | - $di = Di::getDefault(); |
|
221 | + $di = Di::getDefault(); |
|
222 | 222 | if ($di === null) { |
223 | 223 | return; |
224 | 224 | } |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | $exthostname = trim($if_data['exthostname']); |
240 | 240 | } |
241 | 241 | } |
242 | - $old_hash = ''; |
|
242 | + $old_hash = ''; |
|
243 | 243 | $varEtcDir = $di->getShared('config')->path('core.varEtcDir'); |
244 | - if (file_exists($varEtcDir . '/topology_hash')) { |
|
245 | - $old_hash = file_get_contents($varEtcDir . '/topology_hash'); |
|
244 | + if (file_exists($varEtcDir.'/topology_hash')) { |
|
245 | + $old_hash = file_get_contents($varEtcDir.'/topology_hash'); |
|
246 | 246 | } |
247 | - $now_hadh = md5($topology . $exthostname . $extipaddr); |
|
247 | + $now_hadh = md5($topology.$exthostname.$extipaddr); |
|
248 | 248 | |
249 | 249 | $sip = new SIPConf(); |
250 | 250 | $sip->generateConfig(); |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public static function iaxReload(): void |
273 | 273 | { |
274 | - $iax = new IAXConf(); |
|
274 | + $iax = new IAXConf(); |
|
275 | 275 | $iax->generateConfig(); |
276 | 276 | $asteriskPath = Util::which('asterisk'); |
277 | 277 | Util::mwExec("{$asteriskPath} -rx 'iax2 reload'"); |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | 'result' => 'ERROR', |
323 | 323 | ]; |
324 | 324 | |
325 | - if ( ! $this->di->getShared('registry')->booting) { |
|
325 | + if (!$this->di->getShared('registry')->booting) { |
|
326 | 326 | $this->stop(); |
327 | 327 | } |
328 | 328 | /** |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | // Создание базы данных истории звонков. |
339 | 339 | /** @var \Phalcon\Db\Adapter\Pdo\Sqlite $connection */ |
340 | 340 | $connection = $this->di->get('dbCDR'); |
341 | - if ( ! $connection->tableExists('cdr')) { |
|
341 | + if (!$connection->tableExists('cdr')) { |
|
342 | 342 | RegisterDIServices::recreateDBConnections(); |
343 | 343 | } else { |
344 | 344 | CdrDb::checkDb(); |