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.
69 lines
1.6 KiB
TypeScript
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;
|
|
}
|