stevechef_
06/05/2025, 10:40 AMVapi Support Bot
06/05/2025, 10:41 AMlistenUrl from the webhook to stream the call's audio in real-time, but only while the call is ongoing. The stream is in raw PCM format, not MP3, and the URL expires after the call ends. Here’s a Node.js example to save the audio during the call:
js
const WebSocket = require('ws');
const fs = require('fs');
let pcmBuffer = Buffer.alloc(0);
const ws = new WebSocket('wss://your-listen-url-here');
ws.on('message', (data, isBinary) => {
if (isBinary) pcmBuffer = Buffer.concat([pcmBuffer, data]);
});
ws.on('close', () => fs.writeFileSync('audio.pcm', pcmBuffer));
Connect to the listenUrl during the call to capture audio; you cannot access it after the call ends.
Source:
- [Call Listen Feature – Vapi Documentation](https://docs.vapi.ai/calls/call-features#call-listen-feature)Kyle
06/05/2025, 11:47 AM