odyjx
03/26/2025, 5:22 PMVapi Support Bot
03/26/2025, 5:24 PMlistenUrl
by triggering the /call
endpoint
2. Connect to this WebSocket URL to stream the audio data in real-time
3. Process the audio directly or save it for later analysis
Here's a simple Node.js example of how you might implement this from the [Call Features documentation](https://docs.vapi.ai/calls/call-features):
javascript
const WebSocket = require('ws');
const fs = require('fs');
let pcmBuffer = Buffer.alloc(0);
const ws = new WebSocket("wss://aws-us-west-2-production1-phone-call-websocket.vapi.ai/7420f27a-30fd-4f49-a995-5549ae7cc00d/transport");
ws.on('open', () => console.log('WebSocket connection established'));
ws.on('message', (data, isBinary) => {
if (isBinary) {
pcmBuffer = Buffer.concat([pcmBuffer, data]);
console.log(`Received PCM data, buffer size: ${pcmBuffer.length}`);
} else {
console.log('Received message:', JSON.parse(data.toString()));
}
});
Is there anything specific about live call listening that you'd like to know more about?
Sources:
- [Vapi documentation](https://docs.vapi.ai/calls/call-features)
- [Call Features documentation](https://docs.vapi.ai/calls/call-features)