/** * Hub model type definitions — Call, Leg, and status types. */ import type { IEndpoint } from '../sip/index.ts'; // --------------------------------------------------------------------------- // State types // --------------------------------------------------------------------------- export type TCallState = | 'setting-up' | 'ringing' | 'connected' | 'on-hold' | 'transferring' | 'terminating' | 'terminated'; export type TLegState = | 'inviting' | 'ringing' | 'connected' | 'on-hold' | 'terminating' | 'terminated'; export type TLegType = 'sip-device' | 'sip-provider' | 'webrtc'; export type TCallDirection = 'inbound' | 'outbound' | 'internal'; // --------------------------------------------------------------------------- // Status interfaces (for frontend dashboard) // --------------------------------------------------------------------------- export interface ILegStatus { id: string; type: TLegType; state: TLegState; remoteMedia: IEndpoint | null; rtpPort: number | null; pktSent: number; pktReceived: number; codec: string | null; transcoding: boolean; } export interface ICallStatus { id: string; state: TCallState; direction: TCallDirection; callerNumber: string | null; calleeNumber: string | null; providerUsed: string | null; createdAt: number; duration: number; legs: ILegStatus[]; } export interface ICallHistoryEntry { id: string; direction: TCallDirection; callerNumber: string | null; calleeNumber: string | null; providerUsed: string | null; startedAt: number; duration: number; }