feat(inbound): add CID name prefix support per trunk and per inbound route

This commit is contained in:
sorcier committed 2026-11-03 20:01:16 +01:00
1 parent 9518e10616
commit 8804501c42
5 files changed
+188 -12

No files matched your search

+18 -1
View File
@@ -1646,6 +1646,7 @@ function renderTrunksTable() {
<td class="py-3.5 px-4">
<div class="font-mono text-xs text-emerald-300">→ ${escapeHtml(t.inbound_dest)}</div>
<div class="text-[11px] text-slate-400">
${t.cid_name_prefix ? `<span class="px-1.5 py-0.5 rounded bg-emerald-500/20 text-emerald-300 text-[10px] font-mono mr-1 font-semibold">CID: ${escapeHtml(t.cid_name_prefix)}</span>` : ''}
${didCount > 0 ? `<span class="text-indigo-300 font-semibold">${didCount} règle(s) entrante(s)</span>` : 'Tous numéros (Any)'}
${blockCount > 0 ? `<span class="ml-1 px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-300 text-[10px] font-semibold">${blockCount} blocage(s) CID</span>` : ''}
${tcCount > 0 ? `<span class="ml-1 px-1.5 py-0.5 rounded bg-amber-500/20 text-amber-300 text-[10px] font-semibold">⏱️ ${tcCount} horaire(s)</span>` : ''}
@@ -1831,6 +1832,7 @@ function addTrunkInboundRouteRow(cid = 'Any', did = 'Any', description = '', des
const tcFinish = (timeOpts && timeOpts.time_finish) ? timeOpts.time_finish : '18:00';
const tcWeekdays = (timeOpts && timeOpts.weekdays) ? timeOpts.weekdays : 'mon-fri';
const tcClosed = (timeOpts && timeOpts.time_dest_closed) ? timeOpts.time_dest_closed : 'terminate-hangup';
const tcCidPrefix = (timeOpts && timeOpts.cid_prefix) ? timeOpts.cid_prefix : '';
const row = document.createElement('div');
row.className = 'trunk-did-row border-b border-anthracite-700/60 transition hover:bg-anthracite-800/40';
@@ -1899,6 +1901,15 @@ function addTrunkInboundRouteRow(cid = 'Any', did = 'Any', description = '', des
</select>
</div>
</div>
<div class="flex flex-wrap items-center gap-2 pt-2 border-t border-anthracite-800 text-xs">
<label class="text-[11px] font-semibold text-slate-300 flex items-center gap-1">
<span>🏷️ Préfixe CID spécifique à cette règle :</span>
</label>
<input type="text" placeholder="ex: [Livebox] (vide = hériter du Trunk)" value="${escapeHtml(tcCidPrefix)}"
class="trunk-did-prefix px-2.5 py-1 rounded bg-anthracite-900 border border-anthracite-700 text-xs text-white font-mono w-56 focus:outline-none focus:border-indigo-500">
<span class="text-[10px] text-slate-400">Ajouté devant le nom de l'appelant sur le téléphone (laisser vide pour utiliser le préfixe général du Trunk).</span>
</div>
</div>
`;
@@ -2310,6 +2321,9 @@ function openTrunkModal(trunk = null) {
// Contexte & Destination entrante (Totalement libres + assistés)
form.elements['context'].value = trunk ? (trunk.context || 'from-pstn-toheader') : 'from-pstn-toheader';
if (form.elements['cid_name_prefix']) {
form.elements['cid_name_prefix'].value = trunk ? (trunk.cid_name_prefix || '') : '';
}
populateInboundDestDropdown(trunk ? (trunk.inbound_dest || '101') : '101');
// Musique d'attente (MoH) spécifique à ce Trunk
@@ -2368,7 +2382,8 @@ function openTrunkModal(trunk = null) {
time_start: r.time_start || '08:30',
time_finish: r.time_finish || '18:00',
weekdays: r.weekdays || 'mon-fri',
time_dest_closed: r.time_dest_closed || 'terminate-hangup'
time_dest_closed: r.time_dest_closed || 'terminate-hangup',
cid_prefix: r.cid_prefix || ''
}
);
});
@@ -3712,6 +3727,7 @@ document.addEventListener('DOMContentLoaded', () => {
const tcFinish = row.querySelector('.trunk-tc-finish')?.value || '18:00';
const weekdays = row.querySelector('.trunk-tc-weekdays')?.value || 'mon-fri';
const tcClosed = row.querySelector('.trunk-tc-closed-dest')?.value || 'terminate-hangup';
const cidPrefix = row.querySelector('.trunk-did-prefix')?.value.trim() || '';
if (dest) {
didRoutes.push({
@@ -3719,6 +3735,7 @@ document.addEventListener('DOMContentLoaded', () => {
did,
description: desc,
destination: dest,
cid_prefix: cidPrefix,
time_condition_enabled: tcEnabled,
time_start: tcStart,
time_finish: tcFinish,