fix(proxy-engine): improve inbound SIP routing diagnostics and enrich leg media state reporting

This commit is contained in:
2026-04-14 20:19:34 +00:00
parent 0d82a626b5
commit 88768f0586
46 changed files with 555689 additions and 107 deletions

View File

@@ -28,6 +28,24 @@ export function registerProxyEventHandlers(options: IRegisterProxyEventHandlersO
onCloseWebRtcSession,
} = options;
const legMediaDetails = (data: {
codec?: string | null;
remoteMedia?: string | null;
rtpPort?: number | null;
}): string => {
const parts: string[] = [];
if (data.codec) {
parts.push(`codec=${data.codec}`);
}
if (data.remoteMedia) {
parts.push(`remote=${data.remoteMedia}`);
}
if (data.rtpPort !== undefined && data.rtpPort !== null) {
parts.push(`rtp=${data.rtpPort}`);
}
return parts.length ? ` ${parts.join(' ')}` : '';
};
onProxyEvent('provider_registered', (data) => {
const previous = statusStore.noteProviderRegistered(data);
if (previous) {
@@ -128,7 +146,9 @@ export function registerProxyEventHandlers(options: IRegisterProxyEventHandlersO
});
onProxyEvent('leg_added', (data) => {
log(`[leg] added: call=${data.call_id} leg=${data.leg_id} kind=${data.kind} state=${data.state}`);
log(
`[leg] added: call=${data.call_id} leg=${data.leg_id} kind=${data.kind} state=${data.state}${legMediaDetails(data)}`,
);
statusStore.noteLegAdded(data);
});
@@ -138,7 +158,9 @@ export function registerProxyEventHandlers(options: IRegisterProxyEventHandlersO
});
onProxyEvent('leg_state_changed', (data) => {
log(`[leg] state: call=${data.call_id} leg=${data.leg_id} -> ${data.state}`);
log(
`[leg] state: call=${data.call_id} leg=${data.leg_id} -> ${data.state}${legMediaDetails(data)}`,
);
statusStore.noteLegStateChanged(data);
});