feat(runtime): refactor runtime state and proxy event handling for typed WebRTC linking and shared status models

This commit is contained in:
2026-04-14 10:45:59 +00:00
parent 5a280c5c41
commit 51f7560730
15 changed files with 1105 additions and 813 deletions

View File

@@ -2,72 +2,12 @@
* Application state — receives live updates from the proxy via WebSocket.
*/
export interface IProviderStatus {
id: string;
displayName: string;
registered: boolean;
publicIp: string | null;
}
import type { IContact } from '../../ts/config.ts';
import type { ICallHistoryEntry, ICallStatus, IDeviceStatus, IProviderStatus } from '../../ts/shared/status.ts';
export interface IDeviceStatus {
id: string;
displayName: string;
contact: { address: string; port: number } | null;
aor: string;
connected: boolean;
isBrowser: boolean;
}
export interface ILegStatus {
id: string;
type: 'sip-device' | 'sip-provider' | 'webrtc' | 'tool';
state: string;
remoteMedia: { address: string; port: number } | null;
rtpPort: number | null;
pktSent: number;
pktReceived: number;
codec: string | null;
transcoding: boolean;
metadata?: Record<string, unknown>;
}
export interface ICallStatus {
id: string;
state: string;
direction: 'inbound' | 'outbound' | 'internal';
callerNumber: string | null;
calleeNumber: string | null;
providerUsed: string | null;
createdAt: number;
duration: number;
legs: ILegStatus[];
}
export interface IHistoryLeg {
id: string;
type: string;
metadata: Record<string, unknown>;
}
export interface ICallHistoryEntry {
id: string;
direction: 'inbound' | 'outbound' | 'internal';
callerNumber: string | null;
calleeNumber: string | null;
providerUsed: string | null;
startedAt: number;
duration: number;
legs?: IHistoryLeg[];
}
export interface IContact {
id: string;
name: string;
number: string;
company?: string;
notes?: string;
starred?: boolean;
}
export type { IContact };
export type { ICallHistoryEntry, ICallStatus, IDeviceStatus, IProviderStatus };
export type { ILegStatus } from '../../ts/shared/status.ts';
export interface IAppState {
connected: boolean;