1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* MikoPBX - free phone system for small business |
4
|
|
|
* Copyright (C) 2017-2020 Alexey Portnov and Nikolay Beketov |
5
|
|
|
* |
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
7
|
|
|
* it under the terms of the GNU General Public License as published by |
8
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
9
|
|
|
* (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
17
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace MikoPBX\Core\Asterisk\Configs; |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
use MikoPBX\Core\System\Processes; |
24
|
|
|
use MikoPBX\Core\System\Util; |
25
|
|
|
|
26
|
|
|
class H323Conf extends CoreConfigClass |
27
|
|
|
{ |
28
|
|
|
protected string $description = 'ooh323.conf'; |
29
|
|
|
public const MODULE_NAME = 'chan_ooh323.so'; |
30
|
|
|
|
31
|
|
|
protected function generateConfigProtected(): void |
32
|
|
|
{ |
33
|
|
|
$conf = "[general]" . PHP_EOL. |
34
|
|
|
'port=1720'. PHP_EOL. |
35
|
|
|
"bindaddr=0.0.0.0".PHP_EOL. |
36
|
|
|
"gatekeeper = DISABLE".PHP_EOL. |
37
|
|
|
"context=public-direct-dial".PHP_EOL. |
38
|
|
|
"disallow=all".PHP_EOL. |
39
|
|
|
"allow=ulaw".PHP_EOL. |
40
|
|
|
"allow=gsm".PHP_EOL. |
41
|
|
|
"dtmfmode=rfc2833".PHP_EOL. |
42
|
|
|
"directmedia=no".PHP_EOL. |
43
|
|
|
"directrtpsetup=no".PHP_EOL. |
44
|
|
|
PHP_EOL; |
45
|
|
|
|
46
|
|
|
Util::fileWriteContent($this->config->path('asterisk.astetcdir') . '/'. $this->description, $conf); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public static function reload():void |
50
|
|
|
{ |
51
|
|
|
$h323 = new H323Conf(); |
52
|
|
|
$h323->generateConfig(); |
53
|
|
|
|
54
|
|
|
$asteriskPath = Util::which('asterisk'); |
55
|
|
|
Processes::mwExec("{$asteriskPath} -rx 'module reload ".self::MODULE_NAME."'"); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Генератор modules.conf |
60
|
|
|
* |
61
|
|
|
* @return string |
62
|
|
|
*/ |
63
|
|
|
public function generateModulesConf(): string |
64
|
|
|
{ |
65
|
|
|
return 'load => '.self::MODULE_NAME.PHP_EOL; |
66
|
|
|
} |
67
|
|
|
} |