Skip to content

Set up a voice number

The voice agent answers phone calls (Twilio), WhatsApp calls and web calls for a workspace. A call reaches a workspace only through a voice number that the workspace has registered. The number decides which workspace answers, whose authority the agent acts with, which tools it may use and which callers may reach it. The design is recorded in ADR 0079.

The operator runs the voice gateway (services/voice-gateway) next to the server and sets VOICE_GATEWAY_TOKEN to the same value on both. The gateway’s own keys (speech recognition, speech synthesis, Twilio, WhatsApp) are listed in services/voice-gateway/PROVISIONING.md. They are infrastructure keys of the instance, not workspace credentials. GET /readyz on the gateway names every key the active configuration still misses.

  1. Open Settings › Voice as a workspace owner or admin.
  2. Choose Add number and enter the number in E.164 form, for example +4930123456789: a leading +, then 7 to 15 digits, no spaces and no leading zero after the +.
  3. Pick the member the agent acts as (the audit actor), and optionally a project. With a project, the call’s tools only reach that project.
  4. Choose the tools. Only tools of the external MCP surface can be selected, and the list starts empty: a number with no tools can talk, but cannot act.
  5. Decide who may call. With Trusted callers only on, only the numbers you list open a call. Ops tools (tools that change something) are available only on such a number. A number open to anyone stays read-only.
  6. Save. The number answers as soon as it is enabled. Turn Enabled off to stop answering without losing the settings.
The Voice tab in Settings, with the Numbers and Calls switch, the registered voice numbers with their label, project, tools, callers and status, and the transcript retention card.The Voice tab in Settings, with the Numbers and Calls switch, the registered voice numbers with their label, project, tools, callers and status, and the transcript retention card.

Automations use the management API for the same thing: GET, PUT and DELETE on /api/management/v1/workspaces/{slug}/voice-numbers/{e164} with a token that carries management:voice_numbers:write (see the management API reference). PUT is an idempotent upsert, so a repeated run changes nothing.

Settings › Voice › Calls lists the workspace’s calls: when, from which number, how long, and whether the call ended, was cancelled or was handed over to a person. Open a call to read its transcript, turn by turn, including the tools the agent used.

  • AI notice. Every call starts with a spoken notice that the caller is talking to an AI. It plays before the agent’s first answer, in English or German (the gateway’s VOICE_ASR_LANGUAGE). It cannot be switched off. The operator can put a greeting in front of it (VOICE_AI_NOTICE), but the notice sentence always follows. A call whose notice did not play gets no answer from the agent.
  • Text only. The gateway stores the text of each turn. It records no audio.
  • Retention. Transcripts are deleted after the workspace’s voice transcript window: 30 days unless an owner or admin sets another value between 1 and 3650 days under Settings › Voice. A call keeps the window that was in force when it started.
  • Handover. When a call is handed over to a person, the transcript is copied into the caller’s conversation in your conversation provider (Chatwoot or Intercom). That copy follows the conversation provider’s retention, not the voice window.

A caller on a phone call presses 0 to reach a person. The gateway then hands the call to your team before it connects the caller to the human line (VOICE_HANDOVER_NUMBER):

  1. The gateway asks the server to hand the call over. The server uses your workspace’s conversation resource (the only chatwoot or intercom resource of the workspace) and its team: set the resource’s handoff_team_id to the provider’s team id.
  2. The server looks up the caller by phone number in the provider. Chatwoot: it finds or creates the contact in the resource’s inbox and reuses an open conversation or opens a new one. Intercom: it finds the contact or creates a lead and reuses an open conversation or opens a new one.
  3. It posts the transcript, a summary and the reason as a private note, assigns the team and ends the call session. The call history shows the call as handed over.
  4. The gateway connects the caller to the human line.

If the handover fails, for example because the workspace has no conversation resource or several of them, the gateway logs the error and still connects the caller to the human line, only without the note in the provider. A call without a caller number (a web or chat call) cannot open a conversation by number and is refused.

Two voice-gateway endpoints need configuration before they answer:

  • Metrics. /metrics and /metrics.json answer only a request with Authorization: Bearer <VOICE_METRICS_TOKEN>. Set VOICE_METRICS_TOKEN on the gateway and give your Prometheus scrape job the same token. While it is unset, every scrape gets 401.
  • Handover. /twilio/handover returns the TwiML that dials the human line, so it answers only a GET that carries a valid Twilio signature over the full URL. The gateway verifies it with TWILIO_AUTH_TOKEN; an unsigned or wrongly signed request gets 403. The call redirect asks Twilio to fetch it with Method=GET, so nothing else is needed on your side.

An instance operator can insert a number directly while no workspace admin is available, for example to bootstrap a demo line. The database refuses a malformed number and an owner who is not a member of the workspace:

INSERT INTO workspace_voice_numbers
(number_e164, workspace_id, owner_user_id, label, tool_scope, enabled)
VALUES
('+4930123456789', '<workspace uuid>', '<member user uuid>', 'Support line',
'[]'::jsonb, TRUE);

Prefer Settings › Voice or the management API: they also check the tool scope against the external MCP surface, which the database cannot do.

Point a workspace’s calls at another model (operator)

Section titled “Point a workspace’s calls at another model (operator)”

By default a call uses the openai provider through the workspace’s credentials. An instance operator can point one workspace’s calls at another OpenAI-compatible endpoint, for example a self-hosted vLLM, with a row in workspace_llm_endpoints. There is no tenant screen for it, because the row can allow internal egress:

INSERT INTO workspace_llm_endpoints
(workspace_id, provider, base_url, model, credential_id, egress_allowlist)
VALUES
('<workspace uuid>', 'openai', 'https://llm.example.com/v1', 'qwen3-32b',
NULL, '[]'::jsonb)
ON CONFLICT (workspace_id) DO UPDATE
SET provider = EXCLUDED.provider, base_url = EXCLUDED.base_url,
model = EXCLUDED.model, credential_id = EXCLUDED.credential_id,
egress_allowlist = EXCLUDED.egress_allowlist, updated_at = NOW();
  • provider is openai, qwen or openrouter; base_url and model must not be blank.
  • credential_id is an API key of this workspace or its organization (the database refuses any other). NULL uses the provider’s default credential.
  • egress_allowlist lists the internal hosts or IPv4 CIDRs the endpoint may reach. [] allows none; add an internal host only when the endpoint really runs there.

A call takes the endpoint in force when it starts and keeps it until it ends. Delete the row to go back to the default.