-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#782 Поправил генерацию iax2.conf. Поправил настройки сетевого экрана…
… для IAX.
- Loading branch information
boffart
committed
Aug 28, 2024
1 parent
b8f91d9
commit 6e6a3cb
Showing
5 changed files
with
154 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/Core/System/Upgrade/Releases/UpdateConfigsUpToVer2024v2v10.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
/* | ||
* MikoPBX - free phone system for small business | ||
* Copyright © 2017-2023 Alexey Portnov and Nikolay Beketov | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with this program. | ||
* If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace MikoPBX\Core\System\Upgrade\Releases; | ||
|
||
use MikoPBX\Common\Models\FirewallRules; | ||
use MikoPBX\Common\Models\NetworkFilters; | ||
use MikoPBX\Common\Models\PbxSettings; | ||
use MikoPBX\Common\Models\PbxSettingsConstants; | ||
use MikoPBX\Core\System\Upgrade\UpgradeSystemConfigInterface; | ||
use Phalcon\Di\Injectable; | ||
|
||
class UpdateConfigsUpToVer2024v2v10 extends Injectable implements UpgradeSystemConfigInterface | ||
{ | ||
public const PBX_VERSION = '2024.2.10'; | ||
|
||
/** | ||
* Class constructor. | ||
*/ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
/** | ||
* https://github.com/mikopbx/Core/issues/782 | ||
*/ | ||
public function processUpdate(): void | ||
{ | ||
$colName = PbxSettingsConstants::IAX_PORT; | ||
$iax_port = PbxSettings::getValueByKey(PbxSettingsConstants::IAX_PORT); | ||
$nets = NetworkFilters::find(['columns' => 'id']); | ||
foreach ($nets as $net){ | ||
$filter = [ | ||
"portFromKey='$colName' AND networkfilterid='$net->id'", | ||
'columns' => 'id' | ||
]; | ||
$rule = FirewallRules::findFirst($filter); | ||
if($rule){ | ||
continue; | ||
} | ||
$rule = new FirewallRules(); | ||
foreach ($rule->toArray() as $key => $value){ | ||
$rule->$key = $value; | ||
} | ||
$rule->networkfilterid = $net->id; | ||
$rule->action = 'block'; | ||
$rule->portfrom = $iax_port; | ||
$rule->portto = $iax_port; | ||
$rule->protocol = 'udp'; | ||
$rule->portFromKey = $colName; | ||
$rule->portToKey = $colName; | ||
$rule->category = 'IAX'; | ||
$rule->save(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters