UNPKG

@telnyx/react-native-voice-sdk

Version:
266 lines (265 loc) 7.08 kB
import type { CallOptions } from '../call-options'; type InviteACKMessage = { id: string; jsonrpc: '2.0'; result: { callID: string; message: 'CALL CREATED'; sessid: string; }; voice_sdk_id: string; }; type CreateInviteMessageParams = { sessionId: string; sdp: string; attach: boolean; callId: string; callOptions: CallOptions; }; export declare function createInviteMessage({ sdp, sessionId, attach, callId, callOptions, }: CreateInviteMessageParams): { id: string; jsonrpc: string; method: string; params: { sessid: string; sdp: string; 'User-Agent': string; dialogParams: { attach: boolean; callID: string; audio: boolean | import("react-native-webrtc/lib/typescript/Constraints").MediaTrackConstraints | undefined; prefetchIceCandidates: boolean | undefined; destination_number: string | undefined; remote_caller_id_name: string | undefined; remote_caller_id_number: string | undefined; caller_id_name: string | undefined; caller_id_number: string | undefined; custom_headers: { name: string; value: string; }[] | undefined; clientState: string | undefined; }; }; }; export declare function isInviteACKMessage(msg: unknown): msg is InviteACKMessage; export type RingingEvent = { id: number; jsonrpc: '2.0'; method: 'telnyx_rtc.ringing'; params: { callID: string; callee_id_name: string; callee_id_number: string; caller_id_name: string; caller_id_number: string; dialogParams: { custom_headers: { name: string; value: string; }[]; }; display_direction: string; telnyx_leg_id: string; telnyx_session_id: string; }; voice_sdk_id: string; }; export declare function isRingingEvent(msg: unknown): msg is RingingEvent; export declare function createRingingAckMessage(id: number): { id: number; jsonrpc: string; result: { method: string; }; }; export type AnswerEvent = { id: number; jsonrpc: '2.0'; method: 'telnyx_rtc.answer'; params: { callID: string; dialogParams: { custom_headers: { name: string; value: string; }[]; }; sdp: string; variables: { 'Core-UUID': string; }; }; voice_sdk_id: string; }; export declare function isAnswerEvent(msg: unknown): msg is AnswerEvent; export declare function createAnswerAck(id: number): { id: number; jsonrpc: string; result: { method: string; }; }; export declare function isByeEvent(msg: unknown): msg is ByeEvent; export type ByeEvent = { id: number; jsonrpc: '2.0'; method: 'telnyx_rtc.bye'; params: { callID: string; cause: string; causeCode: number; dialogParams: { custom_headers: { name: string; value: string; }[]; }; sipCode: number; sipReason: string; sip_call_id: string; }; voice_sdk_id: string; }; type HangupRequest = { jsonrpc: '2.0'; id: string; method: 'telnyx_rtc.bye'; params: { sessid: string; dialogParams: { telnyxSessionId: string; telnyxLegId: string; callID: string; }; cause: string; causeCode: number; }; }; type CreateHangupRequestParams = { sessionId: string; cause: string; causeCode: number; telnyxSessionId: string; telnyxLegId: string; callId: string; }; export declare function createHangupRequest({ cause, causeCode, sessionId, callId, telnyxLegId, telnyxSessionId, }: CreateHangupRequestParams): HangupRequest; export type InviteEvent = { id: number; jsonrpc: '2.0'; method: 'telnyx_rtc.invite'; params: { callID: string; callee_id_name: string; callee_id_number: string; caller_id_name: string; caller_id_number: string; dialogParams: { custom_headers: { name: string; value: string; }[]; }; display_direction: string; sdp: string; telnyx_leg_id: string; telnyx_session_id: string; }; voice_sdk_id: string; }; type InviteAckMessage = { jsonrpc: '2.0'; id: number; result: { method: 'telnyx_rtc.invite'; }; }; export declare function createInviteAckMessage(id: number): InviteAckMessage; export declare function isInviteEvent(msg: unknown): msg is InviteEvent; type AnswerMessage = { jsonrpc: '2.0'; id: string; method: 'telnyx_rtc.answer'; params: { 'sessid': string; 'sdp': string; 'dialogParams': { telnyxSessionId: string; telnyxLegId: string; callID: string; }; 'User-Agent': string; }; }; type CreateAnswerMessageParams = { sessionId: string; sdp: string; dialogParams: object; callId: string; telnyxSessionId: string; telnyxLegId: string; }; export declare function createAnswerMessage({ dialogParams, sdp, sessionId, callId, telnyxLegId, telnyxSessionId, }: CreateAnswerMessageParams): AnswerMessage; type ModifyCallRequest = { jsonrpc: '2.0'; id: string; method: 'telnyx_rtc.modify'; params: { sessid: string; action: 'hold' | 'unhold'; dialogParams: object; }; }; export declare function createModifyCallRequest({ sessionId, action, callId, }: { callId: string; sessionId: string; action: 'hold' | 'unhold'; }): ModifyCallRequest; type ModifyCallAnswer = { id: string; jsonrpc: '2.0'; result: { action: 'hold' | 'unhold'; callID: string; holdState: 'held' | 'unheld'; sessid: string; }; voice_sdk_id: string; }; export declare function isModifyCallAnswer(msg: unknown): msg is ModifyCallAnswer; type DTMFRequest = { jsonrpc: '2.0'; id: string; method: 'telnyx_rtc.info'; params: { sessid: string; dtmf: string; dialogParams?: { telnyxLegId: string; telnyxSessionId: string; callID: string; destination_number: string; }; }; }; type CreateDTMFRequestParams = { digits: string; sessionId: string; telnyxLegId?: string; telnyxSessionId?: string; callId?: string; destinationNumber?: string; }; export declare function createDTMFRequest({ digits, sessionId, }: CreateDTMFRequestParams): DTMFRequest; type DTMFResponse = { id: string; jsonrpc: '2.0'; result: { message: string; sessid: string; }; voice_sdk_id: string; }; export declare function isDTMFResponse(msg: unknown): msg is DTMFResponse; export {};