JavaScript

Create the code to make an in-app voice call

For this tutorial, Alice will be calling Bob.

Create an HTML file called client_alice.html and add the following code, making sure to paste Alice's JWT which you generated in the earlier step as the value for the token constant:

This is your client application that uses the Client SDK to make an in-app voice call to the destination user (Bob).

The main features of this code are:

  1. A button to call.
  2. A button to hang up.
  3. The code creates a session using the JWT generated earlier.
  4. Then code sets up two event listeners for the call and hang up buttons.
    1. The first listener will use the serverCall function to make the outbound call to Bob. Your webhook server will receive the user in the request body and route the call.
    2. The second listener will call hangup to end the call.