Sending Structured Data during a call
# support
r
Hi guys, I need a way for data that is captured to be sent to make as it is recieved and not at the end of a call. Is it possible to do that? Thanks
v
Yes, you can stream real-time audio data from a live call using the "Call Listen" feature and a WebSocket connection. Here’s a Node.js example to receive and process audio as it arrives:
Copy code
js
const WebSocket = require('ws');
let pcmBuffer = Buffer.alloc(0);
const ws = new WebSocket("wss://your-listenUrl/transport");

ws.on('message', (data, isBinary) => {
  if (isBinary) {
    pcmBuffer = Buffer.concat([pcmBuffer, data]);
    // Process or forward the audio data here in real-time
  }
});
Replace
"wss://your-listenUrl/transport"
with your actual listenUrl.
For more details, see the [Vapi call features documentation](https://docs.vapi.ai/calls/call-features). Source: - [Vapi Call Features Documentation](https://docs.vapi.ai/calls/call-features)
c
Hi ronakp1234, To help with generating structured data, ensure you've followed the setup and integration instructions: 1. Create your structured output: Use a JSON schema to specify the data you want to extract from calls. Here's a [quickstart guide](https://docs.vapi.ai/assistants/structured-outputs-quickstart) for setting this up. 2. Attach the structured output to an assistant: Ensure that the structured output is correctly linked to the assistant via the Dashboard under Artifact Plan or through API integration. 3. Test the setup: Use test calls to verify that data is extracted into the specified schema. See details on creating and testing calls in this [guide](https://docs.vapi.ai/assistants/structured-outputs-quickstart). 4. Retrieve the structured data: Once a call ends, you can retrieve structured outputs via the [API](https://docs.vapi.ai/api-reference/structured-outputs/structured-output-controller-run) or view them in the Call Logs section of the Dashboard. Ensure that your schemas are well-defined, including necessary validation patterns, and that any non-critical fields are optional to avoid partial extractions. For further details and troubleshooting tips, refer to the [structured outputs documentation](https://docs.vapi.ai/assistants/structured-outputs-examples). If you've already verified these aspects and the issue persists, consider reviewing logs for any validation errors or checking API configurations for any discrepancies.
2 Views