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:
- A notification box that can be updated with the call status.
- A button to answer an inbound call.
- A button to reject an inbound call.
- A button to hang-up an inbound call.
- The code creates a session using the JWT generated earlier.
- The code sets up two main event handlers.
- 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, andhanguprespectively. - The second, receives call leg status updates and sets the text of the notification box to the inbound call status.
- 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
Receiving a phone call in-app
You receive a call from a phone to your app
Steps
1
Introduction to this task2
Prerequisites3
Create a webhook server4
Create a Vonage Application5
Buy a Vonage number6
Link a Vonage number7
Create a User8
Generate a JWT9
Install Client SDK10
Create a client side application11
Run your application12
What's next?