@@ -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 |
@@ -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 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $this->setConnectionService("{$this->moduleUniqueId}_module_db"); |
34 | 34 | } |
35 | 35 | parent::initialize(); |
36 | - $this->initialized=true; |
|
36 | + $this->initialized = true; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function getRepresent($needLink = false): string |
47 | 47 | { |
48 | - if (!$this->initialized){ |
|
48 | + if (!$this->initialized) { |
|
49 | 49 | $this->initialize(); |
50 | 50 | } |
51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | if (isset($this->moduleUniqueId)) { |
57 | 57 | $name = '<i class="puzzle piece icon"></i> ' |
58 | - . $this->t('mo_' . $this->moduleUniqueId); |
|
58 | + . $this->t('mo_'.$this->moduleUniqueId); |
|
59 | 59 | } else { |
60 | 60 | $name = 'Unknown'; |
61 | 61 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $link = $this->getWebInterfaceLink(); |
68 | 68 | |
69 | 69 | $result = $this->t( |
70 | - 'rep' . $this->moduleUniqueId, |
|
70 | + 'rep'.$this->moduleUniqueId, |
|
71 | 71 | [ |
72 | 72 | 'represent' => "<a href='{$link}'>{$name}</a>", |
73 | 73 | ] |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function getWebInterfaceLink(): string |
88 | 88 | { |
89 | - if (!$this->initialized){ |
|
89 | + if (!$this->initialized) { |
|
90 | 90 | $this->initialize(); |
91 | 91 | } |
92 | 92 | if (isset($this->moduleUniqueId)) { |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | return [ |
3 | 3 | /** |
4 | - * Copyright © MIKO LLC - All Rights Reserved |
|
5 | - * Unauthorized copying of this file, via any medium is strictly prohibited |
|
6 | - * Proprietary and confidential |
|
7 | - * Written by Alexey Portnov, 8 2020 |
|
8 | - */ |
|
4 | + * Copyright © MIKO LLC - All Rights Reserved |
|
5 | + * Unauthorized copying of this file, via any medium is strictly prohibited |
|
6 | + * Proprietary and confidential |
|
7 | + * Written by Alexey Portnov, 8 2020 |
|
8 | + */ |
|
9 | 9 | 'January' => 'January', |
10 | 10 | 'February' => 'February', |
11 | 11 | 'March' => 'March', |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $conf .= $this->generateGeneral(); |
31 | 31 | $conf .= $this->generateProviders(); |
32 | 32 | |
33 | - Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/iax.conf', $conf); |
|
34 | - file_put_contents($this->config->path('asterisk.astetcdir') . '/iaxprov.conf', "[default]\ncodec=alaw\n"); |
|
33 | + Util::fileWriteContent($this->config->path('asterisk.astetcdir').'/iax.conf', $conf); |
|
34 | + file_put_contents($this->config->path('asterisk.astetcdir').'/iaxprov.conf', "[default]\ncodec=alaw\n"); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | private function getProviders(): array |
42 | 42 | { |
43 | - $data_providers =[]; |
|
43 | + $data_providers = []; |
|
44 | 44 | // Получим настройки всех аккаунтов. |
45 | - $arrIaxProviders = Iax::find("disabled IS NULL OR disabled = '0'"); |
|
45 | + $arrIaxProviders = Iax::find("disabled IS NULL OR disabled = '0'"); |
|
46 | 46 | foreach ($arrIaxProviders as $peer) { |
47 | 47 | /** @var \MikoPBX\Common\Models\Iax $peer */ |
48 | 48 | $arr_data = $peer->toArray(); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'conditions'=>'disabled="0"', |
57 | 57 | 'order' => 'type, priority', |
58 | 58 | ]; |
59 | - $codecs = Codecs::find($filter); |
|
59 | + $codecs = Codecs::find($filter); |
|
60 | 60 | foreach ($codecs as $ob_codec) { |
61 | 61 | $arr_data['codecs'][] = $ob_codec->name; |
62 | 62 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | private function generateGeneral(): string |
93 | 93 | { |
94 | 94 | $iax_port = (trim($this->generalSettings['IAXPort']) !== '') ? $this->generalSettings['IAXPort'] : '4569'; |
95 | - $conf = '[general]' . "\n"; |
|
95 | + $conf = '[general]'."\n"; |
|
96 | 96 | // $conf .= "context=public-direct-dial \n"; |
97 | 97 | $conf .= "bindport={$iax_port}\n"; |
98 | 98 | $conf .= "bindaddr=0.0.0.0\n"; |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | $secret = (trim($provider['secret']) == '') ? '' : ":{$provider['secret']}"; |
153 | 153 | $host = $provider['host']; |
154 | 154 | // $port = (trim($provider['port']) =='')?'':":{$provider['port']}"; |
155 | - $port = ''; |
|
155 | + $port = ''; |
|
156 | 156 | $reg_strings .= "register => {$user}{$secret}@{$host}{$port} \n"; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - return $reg_strings . "\n" . $prov_config; |
|
160 | + return $reg_strings."\n".$prov_config; |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | } |