feat(system): add RTP Timeout and RTP Hold Timeout directly in System Settings form

This commit is contained in:
sorcier committed 2026-11-06 01:47:02 +01:00
1 parent c1805c9076
commit fa8af27e46
3 files changed
+32

No files matched your search

+14
View File
@@ -1717,6 +1717,8 @@ try {
$local_net = trim((string)($payload['local_net'] ?? '192.168.1.0/24')); $local_net = trim((string)($payload['local_net'] ?? '192.168.1.0/24'));
$udp_port = max(1024, min(65535, (int)($payload['udp_port'] ?? 5060))); $udp_port = max(1024, min(65535, (int)($payload['udp_port'] ?? 5060)));
$tls_port = max(1024, min(65535, (int)($payload['tls_port'] ?? 5061))); $tls_port = max(1024, min(65535, (int)($payload['tls_port'] ?? 5061)));
$rtpTimeout = max(5, (int)($payload['rtp_timeout'] ?? 30));
$rtpHoldTimeout = max(0, (int)($payload['rtp_timeout_hold'] ?? 0));
$letsencrypt_domain = trim((string)($payload['letsencrypt_domain'] ?? '')); $letsencrypt_domain = trim((string)($payload['letsencrypt_domain'] ?? ''));
$ami_host = trim((string)($payload['ami_host'] ?? '127.0.0.1')); $ami_host = trim((string)($payload['ami_host'] ?? '127.0.0.1'));
$ami_port = max(1, min(65535, (int)($payload['ami_port'] ?? 5038))); $ami_port = max(1, min(65535, (int)($payload['ami_port'] ?? 5038)));
@@ -1738,6 +1740,8 @@ try {
local_net = :local_net, local_net = :local_net,
udp_port = :udp_port, udp_port = :udp_port,
tls_port = :tls_port, tls_port = :tls_port,
rtp_timeout = :rtp_timeout,
rtp_timeout_hold = :rtp_timeout_hold,
letsencrypt_domain = :le_domain, letsencrypt_domain = :le_domain,
ami_host = :ami_host, ami_host = :ami_host,
ami_port = :ami_port, ami_port = :ami_port,
@@ -1756,6 +1760,8 @@ try {
':local_net' => $local_net, ':local_net' => $local_net,
':udp_port' => $udp_port, ':udp_port' => $udp_port,
':tls_port' => $tls_port, ':tls_port' => $tls_port,
':rtp_timeout' => $rtpTimeout,
':rtp_timeout_hold' => $rtpHoldTimeout,
':le_domain' => $letsencrypt_domain, ':le_domain' => $letsencrypt_domain,
':ami_host' => $ami_host, ':ami_host' => $ami_host,
':ami_port' => $ami_port, ':ami_port' => $ami_port,
@@ -1767,6 +1773,14 @@ try {
]); ]);
SystemChecker::ensureAsteriskIncludes(); SystemChecker::ensureAsteriskIncludes();
$generator->writeAllConfigs();
try {
$ami = AmiClient::fromDatabase($db);
$ami->reloadModule('res_pjsip.so');
$ami->reloadModule('res_rtp_asterisk.so');
} catch (\Throwable $e) {
// Ignore reload error if Asterisk is not running
}
if (!empty($payload['new_admin_password'])) { if (!empty($payload['new_admin_password'])) {
$newPass = (string)$payload['new_admin_password']; $newPass = (string)$payload['new_admin_password'];
+6
View File
@@ -3477,6 +3477,12 @@ function renderSettingsAndDiagnostics() {
form.elements['external_ip'].value = s.external_ip || ''; form.elements['external_ip'].value = s.external_ip || '';
form.elements['udp_port'].value = s.udp_port || 5060; form.elements['udp_port'].value = s.udp_port || 5060;
form.elements['tls_port'].value = s.tls_port || 5061; form.elements['tls_port'].value = s.tls_port || 5061;
if (form.elements['rtp_timeout']) {
form.elements['rtp_timeout'].value = (s.rtp_timeout !== undefined && s.rtp_timeout !== null) ? s.rtp_timeout : 30;
}
if (form.elements['rtp_timeout_hold']) {
form.elements['rtp_timeout_hold'].value = (s.rtp_timeout_hold !== undefined && s.rtp_timeout_hold !== null) ? s.rtp_timeout_hold : 0;
}
form.elements['ami_host'].value = s.ami_host || '127.0.0.1'; form.elements['ami_host'].value = s.ami_host || '127.0.0.1';
form.elements['ami_port'].value = s.ami_port || 5038; form.elements['ami_port'].value = s.ami_port || 5038;
form.elements['ami_user'].value = s.ami_user || 'pbxgui'; form.elements['ami_user'].value = s.ami_user || 'pbxgui';
+12
View File
@@ -1702,6 +1702,18 @@ $isDevEnv = file_exists(__DIR__ . '/../.dev')
<input type="number" name="tls_port" required <input type="number" name="tls_port" required
class="w-full px-3 py-2 rounded-lg bg-anthracite-950 border border-anthracite-700 text-sm text-white"> class="w-full px-3 py-2 rounded-lg bg-anthracite-950 border border-anthracite-700 text-sm text-white">
</div> </div>
<div>
<label class="block text-xs font-medium text-slate-200 mb-1">RTP Timeout (secondes)</label>
<input type="number" name="rtp_timeout" min="5" max="300" value="30"
class="w-full px-3 py-2 rounded-lg bg-anthracite-950 border border-anthracite-700 text-sm text-white font-mono">
<p class="text-[11px] text-slate-400 mt-1">Coupure si aucun flux voix n'est reçu (défaut : 30s).</p>
</div>
<div>
<label class="block text-xs font-medium text-slate-200 mb-1">RTP Hold Timeout (Mise en attente)</label>
<input type="number" name="rtp_timeout_hold" min="0" max="3600" value="0"
class="w-full px-3 py-2 rounded-lg bg-anthracite-950 border border-anthracite-700 text-sm text-white font-mono">
<p class="text-[11px] text-slate-400 mt-1">Délai max d'un appel en attente sans RTP (0 = illimité / désactivé).</p>
</div>
<div class="sm:col-span-2"> <div class="sm:col-span-2">
<label class="block text-xs font-medium text-slate-200 mb-1">Langue des invites & annonces vocales (Asterisk)</label> <label class="block text-xs font-medium text-slate-200 mb-1">Langue des invites & annonces vocales (Asterisk)</label>
<select name="system_language" class="w-full px-3 py-2 rounded-lg bg-anthracite-950 border border-anthracite-700 text-sm text-white focus:ring-2 focus:ring-indigo-500"> <select name="system_language" class="w-full px-3 py-2 rounded-lg bg-anthracite-950 border border-anthracite-700 text-sm text-white focus:ring-2 focus:ring-indigo-500">