From e98410202f615cca4cd35457c5e8cb9b966a82a4 Mon Sep 17 00:00:00 2001 From: sorcier Date: Wed, 4 Nov 2026 00:55:53 +0100 Subject: [PATCH] feat(outbound): add voice announcement on trunk congestion & clarify MoH options --- public/assets/app.js | 28 ++++++++++++++++++++++------ public/index.php | 2 +- src/ConfigGenerator.php | 24 +++++++++++++++++++++++- src/Database.php | 2 +- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/public/assets/app.js b/public/assets/app.js index 987232e..0f24c9d 100644 --- a/public/assets/app.js +++ b/public/assets/app.js @@ -2561,14 +2561,30 @@ function openOutboundRouteModal(route = null) { const recMode = route ? route.record_mode : 'dontcare'; form.querySelectorAll('input[name="record_mode"]').forEach(r => r.checked = (r.value === recMode)); - // Destination sur congestion + // Destination sur congestion / Trunks indisponibles const congSel = document.getElementById('ob-congestion-dest-select'); if (congSel) { - congSel.innerHTML = ` - - - + const curCong = route ? route.congestion_dest : 'all-circuits-busy'; + let congOpts = ` + + `; + const annSounds = (appState.sounds || []).filter(s => s.usage_type !== 'moh'); + if (annSounds.length > 0) { + annSounds.forEach(s => { + const val = `sound-${s.id}`; + congOpts += ``; + }); + } + congOpts += ` + + + + + + + `; + congSel.innerHTML = congOpts; } // Musique d'attente (MOH) @@ -2576,7 +2592,7 @@ function openOutboundRouteModal(route = null) { if (mohSel) { const curMoh = route ? (route.moh_class || 'default') : 'default'; const mohSounds = (appState.sounds || []).filter(s => s.usage_type === 'moh'); - let mohOpts = ``; + let mohOpts = ``; mohSounds.forEach(s => { const sSlug = slugifyTrunkName(s.site_category || 'global'); const cName = (sSlug === 'global' || sSlug === 'default') ? 'default' : `moh-${sSlug}`; diff --git a/public/index.php b/public/index.php index 455ec44..06a9660 100644 --- a/public/index.php +++ b/public/index.php @@ -3102,7 +3102,7 @@ $currentUser = Auth::getUsername();
- +
diff --git a/src/ConfigGenerator.php b/src/ConfigGenerator.php index f5c8143..16dc99d 100644 --- a/src/ConfigGenerator.php +++ b/src/ConfigGenerator.php @@ -1240,6 +1240,24 @@ class ConfigGenerator $lines[] = " same => n,Congestion(20)"; $lines[] = " same => n,Hangup()"; $lines[] = ""; + $lines[] = "exten => all-circuits-busy,1,NoOp(Terminate Call: Message vocal toutes les lignes sont occupees)"; + $lines[] = " same => n,Answer()"; + $lines[] = " same => n,Playback(all-circuits-busy-now)"; + $lines[] = " same => n,Congestion(10)"; + $lines[] = " same => n,Hangup()"; + $lines[] = ""; + $lines[] = "exten => _play-custom-.,1,NoOp(Terminate Call: Lecture annonce personnalisee \${EXTEN:12})"; + $lines[] = " same => n,Answer()"; + $lines[] = " same => n,Playback(custom/\${EXTEN:12})"; + $lines[] = " same => n,Congestion(10)"; + $lines[] = " same => n,Hangup()"; + $lines[] = ""; + $lines[] = "exten => _play-.,1,NoOp(Terminate Call: Lecture annonce systeme \${EXTEN:5})"; + $lines[] = " same => n,Answer()"; + $lines[] = " same => n,Playback(\${EXTEN:5})"; + $lines[] = " same => n,Congestion(10)"; + $lines[] = " same => n,Hangup()"; + $lines[] = ""; $lines[] = "exten => zapateller,1,NoOp(Terminate Call: Tonalite SIT Anti-Robot)"; $lines[] = " same => n,Answer()"; $lines[] = " same => n,Zapateller()"; @@ -2130,6 +2148,9 @@ class ConfigGenerator if ($dest === 'congestion' || $dest === 'terminate-congestion') { return 'Goto(app-terminate,congestion,1)'; } + if ($dest === 'all-circuits-busy' || $dest === 'voice-all-circuits-busy') { + return 'Goto(app-terminate,all-circuits-busy,1)'; + } if ($dest === 'zapateller' || $dest === 'terminate-zapateller') { return 'Goto(app-terminate,zapateller,1)'; } @@ -2160,7 +2181,8 @@ class ConfigGenerator if (str_starts_with($dest, 'sound-')) { $snd = $this->resolveSoundFile(substr($dest, 6)); if ($snd !== '') { - return "Playback({$snd})"; + $safeTarget = str_replace('/', '-', $snd); + return "Goto(app-terminate,play-{$safeTarget},1)"; } return 'Goto(app-terminate,hangup,1)'; } diff --git a/src/Database.php b/src/Database.php index 576305f..cfd3f25 100644 --- a/src/Database.php +++ b/src/Database.php @@ -639,7 +639,7 @@ class Database ':agroups' => json_encode($grps), ':aexts' => json_encode($exts), ':cont' => 1, - ':cdest' => 'terminate-busy', + ':cdest' => 'all-circuits-busy', ':rec' => 'dontcare', ]);