> For the complete documentation index, see [llms.txt](https://docs.concurrence.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.concurrence.com/developer-guide/classic-api/core-api/conversations/conversations-voice.md). Agents can also search and read this documentation through its [MCP server](https://docs.concurrence.com/~gitbook/mcp).

# Voice

Voice note exchange over HTTP and real-time WebSocket voice with audio filler management.

Concurrence supports two voice modes. Choose the one that matches your UX and latency needs:

| Mode                            | Transport     | Best for                                        | Latency       | Notes                                             |
| ------------------------------- | ------------- | ----------------------------------------------- | ------------- | ------------------------------------------------- |
| **Voice Notes (HTTP)**          | HTTP + NDJSON | Asynchronous push-to-talk, in-app voice replies | Low-to-medium | Upload a short clip and receive streamed TTS back |
| **Real-time Voice (WebSocket)** | WebSocket     | Natural, full-duplex conversations              | Very low      | Bidirectional audio with VAD and interruption     |

See real-time details in [Real-time Voice (WebSocket)](https://docs.concurrence.com/developer-guide/classic-api/core-api/conversations/conversations-realtime.md).

{% hint style="warning" %}
**Phone-based voice**: these endpoints are for text-channel voice (push-to-talk notes and WebSocket streaming). For enterprise phone-based inbound and outbound calls with EHR integration, see [Platform API: Voice Agent](https://docs.concurrence.com/developer-guide/platform-api/conversations/voice-agent.md).
{% endhint %}

## Voice Mode Comparison

| Interaction                   | Choose             | Client responsibility                                                       |
| ----------------------------- | ------------------ | --------------------------------------------------------------------------- |
| Recorded clip or push-to-talk | HTTP voice notes   | Submit the clip and consume the returned audio stream.                      |
| Continuous audio exchange     | Realtime WebSocket | Manage streaming audio, speech boundaries, and local playback interruption. |

## Voice Notes (HTTP)

Treat each `/interact` call as an asynchronous voice-note exchange, not a full-duplex call.

### Request Essentials

1. Encode microphone audio as MP3, or capture raw PCM (mono, 16-bit or 32-bit samples, 4000-44100 Hz frame rate). WAV containers and FLAC are not accepted and return `415 Unsupported Media Type`.
2. POST the clip as `recorded_message` with `request_format=voice`, and set the `request_audio_config` query parameter to match the encoding: `{"type":"mp3"}` for MP3, or `{"type":"pcm","frame_rate":16000,"sample_width":2,"n_channels":1}` for raw PCM.
3. Set `response_format=voice`.
4. Read the NDJSON stream. `new-message` events contain base64 PCM16 audio chunks. There is no response codec selection, and the `Accept` header does not change the audio format.

> TypeScript SDK note: the TS SDK does not support voice over HTTP. Use direct API calls.

### Voice Note Exchange <a href="#sequence-diagram-voice-note-exchange" id="sequence-diagram-voice-note-exchange"></a>

Submit a supported audio clip with the voice request and response settings. Consume the returned NDJSON events incrementally, decode audio chunks from `new-message`, and use `interaction-complete` to identify the completed exchange.

### API Reference

{% openapi src="<https://api.amigo.ai/v1/openapi.json>" path="/v1/{organization}/conversation/{conversation\_id}/interact" method="post" %}
<https://api.amigo.ai/v1/openapi.json>
{% endopenapi %}

### Minimal Client Handling (browser-friendly)

```ts
if (evt.type === "new-message" && typeof evt.message === "string" && evt.message) {
  const bytes = Uint8Array.from(atob(evt.message), (c) => c.charCodeAt(0));
  playAudio(bytes.buffer); // your audio player implementation
}
```

### Tips

* Keep uploads short (a few seconds) for responsive turn-taking.
* Accumulate audio chunks from `new-message` into a single buffer for smooth playback.
* Use `interaction-complete` as the boundary between turns.

### Managing Perceived Latency

During voice interactions, the agent plays pre-generated **audio fillers** (for example, "Let me look that up...") when an operation exceeds its configured threshold, so users hear natural feedback instead of silence. Filler phrases and thresholds are configured per Context Graph state, and the threshold should be kept as close to zero as the schema allows. See the Events page for the full event structure and configuration reference:

{% content-ref url="/pages/kCrJX14EAGxaN1HezBV6" %}
[Events](https://docs.concurrence.com/developer-guide/classic-api/core-api/conversations/conversations-events.md)
{% endcontent-ref %}

On the client, audio fillers arrive as `current-agent-action` events with type `action-too-long`:

```typescript
if (evt.type === "current-agent-action" && evt.action.type === "action-too-long") {
  // Audio filler contains base64 PCM audio (or text fallback)
  const audioFiller = evt.action.filler;
  playAudio(base64ToBytes(audioFiller));
}
```

## Real-time Voice (WebSocket)

For low-latency, natural conversation with VAD and barge-in, use Real-time Voice (WebSocket). It supports continuous upstream audio, interruption handling, and streaming TTS.

{% content-ref url="/pages/UTChEvpWEmTl0gMk79Qf" %}
[Real-time Voice (WebSocket)](https://docs.concurrence.com/developer-guide/classic-api/core-api/conversations/conversations-realtime.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.concurrence.com/developer-guide/classic-api/core-api/conversations/conversations-voice.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
