Types and Interface of other Objects

This topic introduces the types and interface of other objects used by 'Linkus SDK for Web Core'.

CallOptions type

Call options for answering or making a call.

type CallOptions = {
    video?: boolean; // Whether it is a video call.
    offerToReceiveVideo?: boolean; // Whether to receive video from the other party.
    extraHeaders?: string[]; // Additional SIP request headers.
};

Report object

Call quality report object.
interface Report {
    lksTimestamp: string; // The timestamp of the time when the call was made or received.
    lksDate: string; // The time when the call was made or received. Time format: YYYY-MM-DD hh:mm:ss
    callId: string; // The unique ID of the call.
    extension: string; // Extension number.
    iceResult: string; // The ICE candidate type. local: host; public: srflx or prflx; turn: relay.
    lksNetworkType: string; // Network type.
    lksDeviceType: string; // The client type. Currently only Web client is available.
    lksDuration: string; //  Correspond to the 'totalSamplesDuration' attribute.
    lksAudioCodec: string; // Audio codec.
    lksAudioRx: string; // The audio packets received that correspond to the 'packetsReceived' attribute.
    lksAudioRxLost: string; // The audio packet loss rate that corresponds to the 'packetsLost' attribute. Formula: lksAudioRxLost=(packetsLost / (packetsLost + packetsReceived)).toFixed(6).
    lksAudioRxMaxjitter: string; // The maximum audio jitter on the receiver.
    lksAudioRxAvgjitter: string; // The average audio jitter that corresponds to "Jitter*1000".
    lksAudioTx: string; // The audio packet sent.
    lksAudioTxLost: string; // Audio packet loss rate on the sender.
    lksAudioTxMaxjitter: string; // The maximum audio jitter on the sender.
    lksAudioTxAvgjitter: string; // The average audio jitter on the sender.
    lksVideoCodec: string; // Video codec
    lksVideoRx: string; // The video packet received.
    lksVideoRxLost: string; // The video packet loss rate that corresponds to the 'packetsLost' attribute. Formula: lksVideoRxLost=(packetsLost / (packetsLost + packetsReceived)).toFixed(6).
    lksVideoRxMaxjitter: string; //The maximum video jitter on the receiver.
    lksVideoRxAvgjitter: string; // The average video jitter on the receiver.
    lksVideoTx: string; // The video packet sent.
    lksVideoTxLost: string; // Video packet loss rate on the sender.
    lksVideoTxMaxjitter: string; // The maximum video jitter on the sender.
    lksVideoTxAvgjitter: string; // The average video jitter on the sender.
}

StaticCallStatus object

Static properties of a call.
interface StaticCallStatus {
    name: string; // Caller name
    avatar: string; // Profile image
    company: string; // Company name
}

CallStatus object

The call status object.
interface CallStatus extends StaticCallStatus{
    number: string; // Phone number or extension number.
    callId: string; // The unique ID of the call.
    communicationType: 'outbound' | 'inbound'; // Call type
    isVideo: boolean; //Whether it is a video call.
    isRing: boolean;
    isHold: boolean;
    isMute: boolean;
    callStatus: 'ringing' | 'calling' | 'talking' | 'connecting';
    callStartTime: number; // The time when the call is answered.
    recordStatus: 'stop' | 'recording' | 'pause'; // Recording status. stop: Not in recording; recording: Recording,; pause: Recording is paused.
    isTransfer: boolean; // Whether it is an attended transfer call.
    transferParent?: TransferParentType; // When it's an attended transfer call, specify the parent call.
    isConference: boolean; // Whether it is an audio conference call.
}

type TransferParentType = {
    // Parent call in the attended transfer call.
    callId: string; // The unique ID of the call.
    avatar: string; // Profile image.
    name: string; // Name of the transfer target.
    number: string; // Number of the transfer target.
    callDuration: number; // The time between the call answered and the call ended. 
    holdDuration: number; // The duration of the call being held.
}

TimerType type

Types of call timing.

type TimerType = {
    ringDuration: number; // The time between the call started and the call answered.
    callingDuration: number; // The time between the call dialed and the call answered.
    callDuration: number; // The time between the call answered and the call ended. 
    holdDuration: number; // The duration of the call being held.
}

AgreeChangeVideoParamsType type

type AgreeChangeVideoParamsType = { callId: string; name: string };

agreeChangeVideo Usage

To agree to switch to a video call during an ongoing call, you can use the agreeChangeVideo method.

session.agreeChangeVideo = (inviteInfo: AgreeChangeVideoParamsType) => {
    return new Promise<boolean>((resolve) => {
        // Here you can add logic to decide whether to agree to switch to a video call
        const userAgrees = Modal.confirm({
            title: 'Switch to Video Call',
            content: `${inviteInfo.name} invites you to switch to a video call. Do you agree?`,
            onOk: () => {
                // User agrees to switch to video call
                resolve(true);
            },
            onCancel: () => {
                // User rejects switching to video call
                resolve(false);
            }
        });
        setTimeout(() => {
            // Close modal
            userAgrees.close();
            // If the user does not make a choice within 10 seconds, it defaults to rejection
            resolve(false);
        }, 10 * 1000);
    });
}