Files
siprouter/ts/call/types.ts
Juergen Kunz f3e1c96872 initial commit — SIP B2BUA + WebRTC bridge with Rust codec engine
Full-featured SIP router with multi-provider trunking, browser softphone
via WebRTC, real-time Opus/G.722/PCM transcoding in Rust, RNNoise ML
noise suppression, Kokoro neural TTS announcements, and a Lit-based
web dashboard with live call monitoring and REST API.
2026-04-09 23:03:55 +00:00

69 lines
1.6 KiB
TypeScript

/**
* 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;
}