You can use the Vonage Voice API to connect a call to a WebSocket, giving you a two-way stream of the call audio delivered over the WebSocket protocol in real-time. This enables you to process the call audio to perform tasks such as sentiment analysis, real-time transcription and decision-making using artificial intelligence.

In this tutorial, you will connect an inbound call to a WebSocket endpoint. The WebSocket server will stream an audio file into the call. You will implement this using the express web application framework and express-ws, which lets you define WebSocket endpoints like any other express route.

Completed project

If you would like to follow along without building the app yourself, the completed project is available on Github.