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

@@ -32,8 +32,32 @@ const LEG_TYPE_LABELS: Record<string, string> = {
'sip-device': 'SIP Device',
'sip-provider': 'SIP Provider',
'webrtc': 'WebRTC',
'tool': 'Tool',
};
function renderHistoryLegs(legs: ICallHistoryEntry['legs']): TemplateResult {
if (!legs.length) {
return html`<span style="color:#64748b">-</span>`;
}
return html`
<div style="display:flex;flex-direction:column;gap:6px;font-size:.72rem;line-height:1.35;">
${legs.map(
(leg) => html`
<div>
<span class="badge" style="${legTypeBadgeStyle(leg.type)}">${LEG_TYPE_LABELS[leg.type] || leg.type}</span>
<span style="margin-left:6px;font-family:'JetBrains Mono',monospace;">${leg.codec || '--'}</span>
<span style="margin-left:6px;color:#94a3b8;">${STATE_LABELS[leg.state] || leg.state}</span>
${leg.remoteMedia
? html`<span style="display:block;color:#64748b;font-family:'JetBrains Mono',monospace;">${leg.remoteMedia}</span>`
: ''}
</div>
`,
)}
</div>
`;
}
function directionIcon(dir: string): string {
if (dir === 'inbound') return '\u2199';
if (dir === 'outbound') return '\u2197';
@@ -226,8 +250,8 @@ export class SipproxyViewCalls extends DeesElement {
`,
];
connectedCallback() {
super.connectedCallback();
async connectedCallback(): Promise<void> {
await super.connectedCallback();
this.rxSubscriptions.push({
unsubscribe: appState.subscribe((s) => {
this.appData = s;
@@ -490,6 +514,11 @@ export class SipproxyViewCalls extends DeesElement {
renderer: (val: number) =>
html`<span style="font-family:'JetBrains Mono',monospace;font-size:.75rem">${fmtDuration(val)}</span>`,
},
{
key: 'legs',
header: 'Legs',
renderer: (val: ICallHistoryEntry['legs']) => renderHistoryLegs(val),
},
];
}
@@ -551,9 +580,7 @@ export class SipproxyViewCalls extends DeesElement {
</span>
</td>
<td>
${leg.remoteMedia
? `${leg.remoteMedia.address}:${leg.remoteMedia.port}`
: '--'}
${leg.remoteMedia || '--'}
</td>
<td>${leg.rtpPort ?? '--'}</td>
<td>