@@ -14,7 +14,7 @@ |
||
| 14 | 14 | $di = new Cli(); |
| 15 | 15 | |
| 16 | 16 | // Register classes, namespaces, additional libraries with lazzy load |
| 17 | -require_once __DIR__ . '/../../../src/Common/Config/ClassLoader.php'; |
|
| 17 | +require_once __DIR__.'/../../../src/Common/Config/ClassLoader.php'; |
|
| 18 | 18 | |
| 19 | 19 | // Initialize sentry error logger |
| 20 | 20 | $errorLogger = new SentryErrorLogger('pbx-core-workers'); |
@@ -20,15 +20,15 @@ |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function afterSave():void { |
| 23 | - $work_completed = (string)$this->work_completed; |
|
| 24 | - if( $work_completed === '1'){ |
|
| 23 | + $work_completed = (string) $this->work_completed; |
|
| 24 | + if ($work_completed === '1') { |
|
| 25 | 25 | $newCdr = new CallDetailRecords(); |
| 26 | 26 | $vars = $this->toArray(); |
| 27 | - foreach ($vars as $key => $value){ |
|
| 28 | - if( 'id' === $key){ |
|
| 27 | + foreach ($vars as $key => $value) { |
|
| 28 | + if ('id' === $key) { |
|
| 29 | 29 | continue; |
| 30 | 30 | } |
| 31 | - if(property_exists($newCdr, $key)){ |
|
| 31 | + if (property_exists($newCdr, $key)) { |
|
| 32 | 32 | $newCdr->writeAttribute($key, $value); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $res = new PBXApiResult(); |
| 27 | 27 | $res->processor = __METHOD__; |
| 28 | - $peers = []; |
|
| 28 | + $peers = []; |
|
| 29 | 29 | $providers = Iax::find(); |
| 30 | 30 | foreach ($providers as $provider) { |
| 31 | 31 | $peers[] = [ |
@@ -84,13 +84,13 @@ discard block |
||
| 84 | 84 | $range = explode('-', $range[0]); |
| 85 | 85 | if ($range[0] === '') { |
| 86 | 86 | $end = $filesize - 1; |
| 87 | - $start = $end - (int)$range[0]; |
|
| 87 | + $start = $end - (int) $range[0]; |
|
| 88 | 88 | } elseif ($range[1] === '') { |
| 89 | - $start = (int)$range[0]; |
|
| 89 | + $start = (int) $range[0]; |
|
| 90 | 90 | $end = $filesize - 1; |
| 91 | 91 | } else { |
| 92 | - $start = (int)$range[0]; |
|
| 93 | - $end = (int)$range[1]; |
|
| 92 | + $start = (int) $range[0]; |
|
| 93 | + $end = (int) $range[1]; |
|
| 94 | 94 | // if ($end >= $filesize || (! $start && (! $end || $end == ($filesize - 1)))){ |
| 95 | 95 | // $partial = false; |
| 96 | 96 | // } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $length = $end - $start + 1; |
| 99 | 99 | |
| 100 | 100 | $this->response->resetHeaders(); |
| 101 | - if ( ! $fp = fopen($filename, 'rb')) { |
|
| 101 | + if (!$fp = fopen($filename, 'rb')) { |
|
| 102 | 102 | $this->sendError(500); |
| 103 | 103 | } else { |
| 104 | 104 | $this->response->setRawHeader('HTTP/1.1 206 Partial Content'); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $content = ''; |
| 112 | 112 | while ($length) { |
| 113 | 113 | set_time_limit(0); |
| 114 | - $read = ($length > 8192) ? 8192 : $length; |
|
| 114 | + $read = ($length > 8192) ? 8192 : $length; |
|
| 115 | 115 | $length -= $read; |
| 116 | 116 | $content .= fread($fp, $read); |
| 117 | 117 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | $this->response->setHeader('Server', 'nginx'); |
| 129 | 129 | |
| 130 | - $is_download = ! empty($this->request->get('download')); |
|
| 130 | + $is_download = !empty($this->request->get('download')); |
|
| 131 | 131 | if ($is_download) { |
| 132 | 132 | $new_filename = $this->request->get('filename'); |
| 133 | 133 | if (empty($new_filename)) { |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | $this->response->setHeader( |
| 138 | 138 | 'Content-Disposition', |
| 139 | - "attachment; filename*=UTF-8''" . basename($new_filename) |
|
| 139 | + "attachment; filename*=UTF-8''".basename($new_filename) |
|
| 140 | 140 | ); |
| 141 | 141 | } |
| 142 | 142 | $this->response->sendRaw(); |
@@ -60,11 +60,11 @@ |
||
| 60 | 60 | $ntpdPath = Util::which('ntpd'); |
| 61 | 61 | $shPath = Util::which('sh'); |
| 62 | 62 | if ($restart_night === '1') { |
| 63 | - $mast_have[] = '0 1 * * * ' . $cron_user . $asteriskPath . ' -rx"core restart now" > /dev/null 2> /dev/null' . "\n"; |
|
| 63 | + $mast_have[] = '0 1 * * * '.$cron_user.$asteriskPath.' -rx"core restart now" > /dev/null 2> /dev/null'."\n"; |
|
| 64 | 64 | } |
| 65 | - $mast_have[] = '*/5 * * * * ' . $cron_user . $ntpdPath . ' -q > /dev/null 2> /dev/null' . "\n"; |
|
| 66 | - $mast_have[] = '*/6 * * * * ' . $cron_user . "{$shPath} {$workersPath}/Cron/cleaner_download_links.sh > /dev/null 2> /dev/null\n"; |
|
| 67 | - $mast_have[] = '*/1 * * * * ' . $cron_user . "{$WorkerSafeScripts}\n"; |
|
| 65 | + $mast_have[] = '*/5 * * * * '.$cron_user.$ntpdPath.' -q > /dev/null 2> /dev/null'."\n"; |
|
| 66 | + $mast_have[] = '*/6 * * * * '.$cron_user."{$shPath} {$workersPath}/Cron/cleaner_download_links.sh > /dev/null 2> /dev/null\n"; |
|
| 67 | + $mast_have[] = '*/1 * * * * '.$cron_user."{$WorkerSafeScripts}\n"; |
|
| 68 | 68 | |
| 69 | 69 | $tasks = []; |
| 70 | 70 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | . "vmsvc.level = none\n"; |
| 42 | 42 | |
| 43 | 43 | $dirVM = '/etc/vmware-tools'; |
| 44 | - if(!file_exists($dirVM)){ |
|
| 44 | + if (!file_exists($dirVM)) { |
|
| 45 | 45 | Util::mwMkdir($dirVM); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -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) { |
@@ -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 |
@@ -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 | |