JavaScript

Create a client side application

Create an HTML file called client_js.html. Add the following code, but make sure you paste in the JWT you generated for the user in the earlier step as the value for the token constant:

This is your web application that uses the Client SDK to accept an inbound call.

The main features of this code are:

  1. A notification box that can be updated with the call status.
  2. A button to answer an inbound call.
  3. A button to reject an inbound call.
  4. A button to hang-up an inbound call.
  5. The code creates a session using the JWT generated earlier.
  6. The code sets up two main event handlers.
    1. The first is fired on an inbound call invite. This in turn sets up 3 click button event handlers which answers, rejects and hangs-up the inbound call using the Client SDK methods answer, reject, and hangup respectively.
    2. The second, receives call leg status updates and sets the text of the notification box to the inbound call status.