> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fonoster.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tune turn-taking and audio

> Set your install's default recording policy and consent prompt, and see which turn detector and audio processing your calls use.

The voice gateway decides when a caller's turn ends and whether a call is recorded. Developers set
most of this per application, but some defaults belong to you as the operator. Use this page to set
the recording policy for the whole install or for one workspace, change the consent prompt, and
know which turn detector your calls use.

Every setting on this page lives in the gateway's configuration, `config/gateway.yaml`.

## Before you begin

You need Fonoster installed with Docker Compose. See
[Install with Docker Compose](https://docs.fonoster.com/self-hosting/install-compose.md). Run the commands on this page from
your `fonoster` folder.

## Apply a change

Each section below edits `config/gateway.example.yaml`. After you edit it, write the configuration
and recreate the voice gateway:

```bash theme={"system"}
npx -p @fonoster/common fonoster-config init
docker compose up -d --force-recreate appbridge
```

Recreating the gateway ends the calls in progress, so do it when the install is quiet. Records of
those calls are still sealed.

## Set the default recording policy

A call is recorded by the first policy that's set, in this order:

1. The application's policy, set by the developer. See
   [Record calls and ask for consent](https://docs.fonoster.com/telephony/recording.md).
2. The workspace's policy, set by you.
3. The install's default, set by you.
4. `off`.

Each policy is `off`, `on` or `consent`. With `consent`, the caller hears a short prompt before
recording starts.

![Four stacked layers decide if a call is recorded: application policy, workspace policy, install default, and off. The application layer is set to Workspace default, so the call falls through to the workspace policy, which is on, and the call is recorded.](https://mintcdn.com/fonoster/GsxtawNPYOQvohG4/images/turn-taking-and-audio/recording-precedence-light.png?fit=max\&auto=format\&n=GsxtawNPYOQvohG4\&q=85\&s=ddd020f3f91bc177d7a41b7d919658fb)

**1. Set the install's default**

Under `callRecord`, set `recording`. The Compose install ships with `off`:

```yaml theme={"system"}
callRecord:
  # ...
  recording: consent
```

**2. Set a workspace's policy (optional)**

Under `callRecord`, add `workspaces`, keyed by the workspace's ID (`WO…`). The dashboard shows
it as **Access key ID** under **Settings**:

```yaml theme={"system"}
callRecord:
  # ...
  recording: off
  workspaces:
    WO7d2kq9x4m1c8b3n6p0r5t2v9y4z7a1e3: { recording: on }
```

That workspace's applications left on **Workspace default** are now recorded. Applications
with their own policy keep it.

**3. Change the consent prompt (optional)**

The prompt is "This call will be recorded." by default. Set your own words under `callRecord`:

```yaml theme={"system"}
callRecord:
  # ...
  consentPrompt: "This call may be recorded for quality and training."
```

The prompt is the same for every application, in the application's own voice. It isn't
translated, so write it in your callers' language.

**4. Apply it**

Write the configuration and recreate the gateway, as in [Apply a change](#apply-a-change).

> [!TIP]
>
> Make a test call to an application left on **Workspace default**. With `on`, its call record has
> a recording. With `consent`, you hear the prompt first.

The gateway doesn't start with any value other than `off`, `on` or `consent`. To catch a typo
first, run `npx -p @fonoster/common fonoster-config check`.

## Turn detection

The gateway decides when the caller has finished speaking with a **turn detector**. Every
application in the Compose install uses the default detector, `baseline`: voice activity, final
transcripts and a silence timer. Developers tune it per application with `patience`. See
[Turn-taking and barge-in](https://docs.fonoster.com/autopilot/turn-taking.md).

The gateway also has other detectors:

| Detector | What it does |
| - | - |
| `baseline` (default) | Voice activity, final transcripts and a silence timeout |
| `backchannel-hold` | Like `baseline`, but speech over the agent counts as an interruption only after 500 ms, and short acknowledgments such as "uh-huh" never do |
| `stt` | A speech recognizer that reports the end of a turn itself decides. If it sends nothing for 2.5 seconds after a final transcript, the turn ends anyway |
| `ws://…` | Your own detector, hosted next to the gateway, over a WebSocket. If it's unreachable or more than 200 ms behind, `baseline` answers instead |

The detector is set per application, with `speech.detector`, only for applications listed in the
gateway's own file. The Compose install keeps applications in its database, so the dashboard and
the API create them, and they always use `baseline`. There's no install-wide setting for the
detector.

## Audio filters

Applications can turn on noise cancelling (see
[Cancel background noise](https://docs.fonoster.com/telephony/noise-cancelling.md)). The filter runs in AppBridge on the
caller's audio before speech recognition and turn detection, and it needs a noise-cancelling
provider in the catalog with a key.

Register the provider once, with the capability `nc`:

```bash theme={"system"}
fonoster-registry add-provider aicoustics --adapter aicoustics --capabilities nc \
  --credential-ref aicoustics-default --label "ai-coustics"
```

Give it a platform key in AppBridge's configuration, as for a speech provider. Workspaces that add
their own ai-coustics key on the Vendor keys page use that key instead.

```yaml theme={"system"}
providers:
  aicoustics:
    adapter: aicoustics
    capabilities: [nc]
    credential: { env: AIC_SDK_LICENSE }
```

Filtering never drops a call. A filter that can't start or fails mid-call leaves the call
unfiltered and the call record says so. The filter phones home: the vendor's SDK authorizes the
key and reports usage online, so AppBridge needs egress to ai-coustics at call time.

The AppBridge image ships the vendor's SDK and the Voice Focus model, so nothing is downloaded at
call time. To pin a model file or turn the download off, set the filter's server-side options in
`appbridge.yaml`:

```yaml theme={"system"}
audioFilters:
  aiCoustics: { modelDir: /work/models, autoDownload: false }
```

## Next steps

> **[Record calls and ask for consent](https://docs.fonoster.com/telephony/recording.md)**
>
> How developers set the policy per application.

> **[Rotate call-record keys](https://docs.fonoster.com/self-hosting/call-record-keys.md)**
>
> Manage the key that signs your call records.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.