feat(ring-groups): allow direct voicemail redirection on no-answer failover
Add vm-<ext> destination support in UI destination picker, API validation, and [app-voicemail] Asterisk dialplan context. Refs #2
This commit is contained in:
1 parent
3ef7ed0010
commit
d229aaf816
3 files changed
+64
-1
No files matched your search
@@ -1686,6 +1686,30 @@ class ConfigGenerator
|
||||
$lines[] = " same => n,Hangup()";
|
||||
$lines[] = "";
|
||||
|
||||
// 5b. Contexte dédié Dépôt Direct sur Boîte Vocale (Redirection sans sonnerie)
|
||||
$lines[] = "; ===========================================================================";
|
||||
$lines[] = "; DÉPÔT DIRECT SUR BOÎTE VOCALE (REDIRECTION / DÉBORDEMENT)";
|
||||
$lines[] = "; ===========================================================================";
|
||||
$lines[] = "[app-voicemail]";
|
||||
foreach ($extensions as $ext) {
|
||||
$num = trim((string)$ext['extension']);
|
||||
if (empty($ext['voicemail_enabled'])) {
|
||||
continue;
|
||||
}
|
||||
$lines[] = "exten => {$num},1,NoOp(Redirection directe vers messagerie vocale du poste {$num})";
|
||||
$lines[] = " same => n,Set(CHANNEL(language)={$sysLang})";
|
||||
$lines[] = " same => n,Answer()";
|
||||
$lines[] = " same => n,Wait(0.5)";
|
||||
$lines[] = " same => n,VoiceMail({$num}@default,u)";
|
||||
$lines[] = " same => n,Hangup()";
|
||||
}
|
||||
$lines[] = "exten => _X.,1,NoOp(Boite vocale inexistante ou desactivee pour \${EXTEN})";
|
||||
$lines[] = " same => n,Set(CHANNEL(language)={$sysLang})";
|
||||
$lines[] = " same => n,Answer()";
|
||||
$lines[] = " same => n,Playback(vm-incorrect-mailbox)";
|
||||
$lines[] = " same => n,Hangup()";
|
||||
$lines[] = "";
|
||||
|
||||
return implode("\n", $lines) . "\n";
|
||||
}
|
||||
|
||||
@@ -2328,6 +2352,17 @@ EOF;
|
||||
if (preg_match('/^\d+$/', $dest)) {
|
||||
return "Goto(from-internal,{$dest},1)";
|
||||
}
|
||||
if (str_starts_with($dest, 'vm-')) {
|
||||
$vmExt = preg_replace('/[^0-9A-Za-z_-]/', '', substr($dest, 3));
|
||||
if ($vmExt !== '') {
|
||||
$stmt = $this->db->prepare('SELECT voicemail_enabled FROM extensions WHERE extension = :ext AND enabled = 1');
|
||||
$stmt->execute([':ext' => $vmExt]);
|
||||
if ($stmt->fetchColumn()) {
|
||||
return "Goto(app-voicemail,{$vmExt},1)";
|
||||
}
|
||||
}
|
||||
return 'Goto(app-terminate,hangup,1)';
|
||||
}
|
||||
if (str_starts_with($dest, 'page-')) {
|
||||
$pageExt = substr($dest, 5);
|
||||
return "Goto(from-internal,{$pageExt},1)";
|
||||
|
||||
Reference in new issue
Block a user