fix(proxy-engine): improve inbound SIP routing diagnostics and enrich leg media state reporting
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user