Web

I. Installation

II. Extension login

Declare global variables and import the following classes

import {
  Invitation,
  InvitationAcceptOptions,
  Inviter,
  InviterInviteOptions,
  Registerer,
  Session,
  SessionState,
  UserAgent,
  UserAgentOptions,
  Web
} from "sip.js";
import {IncomingResponse} from "sip.js/lib/core";

userAgent: UserAgent;

// register to manage extension login and logout operations.
registerer: Registerer;

// incomingInvitation to manage events related to incoming calls
incomingInvitation: Invitation;

// outgoingInviter to manage events related to outgoing calls
outgoingInviter: Inviter;

// When any call takes place, a session is created, this variable is used to track the status of the call until the call ends.
session: Session;

Declare UserAgent and Registerer to log in to the extension:

III. Log out of extension

IV. Making an outgoing call

To make a call:

Video Call, continues the call()above function:

V. Receive call (incoming call)

Add this value to the delegate field of UserAgentOptions in section II, step 2.

  • If it is a video call, check the variableincomingInvitation

Accept call

  • If it is a video call, with the same function answer()above, we can implement it as follows:

Reject call

VI. Call handling, getting remoteMediaStream

  • Your interface must have tags <audio>and <video>to display video and play audio when making calls. With local being the user side and remote being the side where the user is talking to .

  • For example:

VII. Listening to the Call States

VIII. Actively end the call

IX. Hold the line

Last updated