import type { TLegType } from './status.ts'; export interface IIncomingCallEvent { call_id: string; from_uri: string; to_number: string; provider_id: string; ring_browsers?: boolean; } export interface IOutboundCallEvent { call_id: string; from_device: string | null; to_number: string; } export interface IOutboundCallStartedEvent { call_id: string; number: string; provider_id: string; } export interface ICallRingingEvent { call_id: string; } export interface ICallAnsweredEvent { call_id: string; provider_media_addr?: string; provider_media_port?: number; sip_pt?: number; } export interface ICallEndedEvent { call_id: string; reason: string; duration: number; from_side?: string; } export interface IProviderRegisteredEvent { provider_id: string; registered: boolean; public_ip: string | null; } export interface IDeviceRegisteredEvent { device_id: string; display_name: string; address: string; port: number; aor: string; expires: number; } export interface ISipUnhandledEvent { method_or_status: string; call_id?: string; from_addr: string; from_port: number; } export interface ILegAddedEvent { call_id: string; leg_id: string; kind: TLegType; state: string; codec?: string | null; rtpPort?: number | null; remoteMedia?: string | null; metadata?: Record; } export interface ILegRemovedEvent { call_id: string; leg_id: string; } export interface ILegStateChangedEvent { call_id: string; leg_id: string; state: string; codec?: string | null; rtpPort?: number | null; remoteMedia?: string | null; metadata?: Record; } export interface IWebRtcIceCandidateEvent { session_id: string; candidate: string; sdp_mid?: string; sdp_mline_index?: number; } export interface IWebRtcStateEvent { session_id?: string; state: string; } export interface IWebRtcTrackEvent { session_id?: string; kind: string; codec: string; } export interface IWebRtcAudioRxEvent { session_id?: string; packet_count: number; } export interface IVoicemailStartedEvent { call_id: string; voicebox_id?: string; caller_number?: string; } export interface IRecordingDoneEvent { call_id?: string; voicebox_id?: string; file_path: string; duration_ms: number; caller_number?: string; } export interface IVoicemailErrorEvent { call_id: string; error: string; } export type TProxyEventMap = { provider_registered: IProviderRegisteredEvent; device_registered: IDeviceRegisteredEvent; incoming_call: IIncomingCallEvent; outbound_device_call: IOutboundCallEvent; outbound_call_started: IOutboundCallStartedEvent; call_ringing: ICallRingingEvent; call_answered: ICallAnsweredEvent; call_ended: ICallEndedEvent; sip_unhandled: ISipUnhandledEvent; leg_added: ILegAddedEvent; leg_removed: ILegRemovedEvent; leg_state_changed: ILegStateChangedEvent; webrtc_ice_candidate: IWebRtcIceCandidateEvent; webrtc_state: IWebRtcStateEvent; webrtc_track: IWebRtcTrackEvent; webrtc_audio_rx: IWebRtcAudioRxEvent; voicemail_started: IVoicemailStartedEvent; recording_done: IRecordingDoneEvent; voicemail_error: IVoicemailErrorEvent; };