feat(routing): add rule-based SIP routing for inbound and outbound calls with dashboard route management
This commit is contained in:
@@ -221,11 +221,12 @@ async function handleRequest(
|
||||
// Remove a provider.
|
||||
if (updates.removeProvider) {
|
||||
cfg.providers = (cfg.providers || []).filter((p: any) => p.id !== updates.removeProvider);
|
||||
// Clean up routing references.
|
||||
if (cfg.routing?.inbound) delete cfg.routing.inbound[updates.removeProvider];
|
||||
if (cfg.routing?.ringBrowsers) delete cfg.routing.ringBrowsers[updates.removeProvider];
|
||||
if (cfg.routing?.outbound?.default === updates.removeProvider) {
|
||||
cfg.routing.outbound.default = cfg.providers[0]?.id || '';
|
||||
// Clean up routing references — remove routes that reference this provider.
|
||||
if (cfg.routing?.routes) {
|
||||
cfg.routing.routes = cfg.routing.routes.filter((r: any) =>
|
||||
r.match?.sourceProvider !== updates.removeProvider &&
|
||||
r.action?.provider !== updates.removeProvider
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,8 +237,9 @@ async function handleRequest(
|
||||
}
|
||||
}
|
||||
if (updates.routing) {
|
||||
if (updates.routing.inbound) cfg.routing.inbound = { ...cfg.routing.inbound, ...updates.routing.inbound };
|
||||
if (updates.routing.ringBrowsers) cfg.routing.ringBrowsers = { ...cfg.routing.ringBrowsers, ...updates.routing.ringBrowsers };
|
||||
if (updates.routing.routes) {
|
||||
cfg.routing.routes = updates.routing.routes;
|
||||
}
|
||||
}
|
||||
if (updates.contacts !== undefined) cfg.contacts = updates.contacts;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user