# How calling works

> The lines a workspace calls from, the order they are tried in, the three kinds of call (a person's, an AI call, a missed call), inbound calls and voice agents, and where each call's history ends up.

Source: https://docs.mycrmsim.com/guides/how-calling-works
Updated: 2026-12-02

myCRMSIM places calls from the workspace's **own devices**, the same ones that
send its messages. Nothing dials from the cloud on the workspace's behalf: a
call always goes out of a Mac, a phone, a WhatsApp line or a Twilio number the
workspace has connected. This guide explains the pieces and how the API endpoints
fit together.

---

## The lines

A workspace can call from up to four kinds of line:

| Line | What it is | Can call | Notes |
|---|---|---|---|
| **Mac (FaceTime)** | The Mac that runs the iMessage gateway | Phone numbers and **Apple ID emails** (FaceTime Audio) | The only line that can call an email. Needs calling switched on for the Mac. |
| **Android (SIM)** | The Android gateway phone | Phone numbers | Browser audio only when the phone's calling line is on; otherwise the phone still rings the contact. |
| **WhatsApp** | A connected WhatsApp number | WhatsApp users | A WhatsApp voice call from that number. |
| **Twilio** | A Twilio number of the account | Phone numbers | Needs Twilio calling enabled for the account. |

[List lines](https://docs.mycrmsim.com/docs/calls/list-lines) shows every line of a workspace on every
medium — the Mac, each SIM in the Android phone, the WhatsApp numbers, the
Twilio numbers and caller IDs — and whether calling is on
for each. Calling is switched on per line in the dashboard's Calling settings
(it is a billed add-on), so the API reads it and does not change it.

[Call readiness](https://docs.mycrmsim.com/docs/calls/call-readiness) (`GET /calls/readiness`) answers the
first question before anyone dials: can this workspace call **right now**? It
says so line by line — `facetime`, `android` (whether a SIM call would carry
audio) and `missed_call` (whether the Missed Call action could ring) — and
returns the routing order below.

---

## The order: Call Routing

**Call Routing** is the workspace's own order of lines, one line per row.

- A call with no `channel` starts on the **first row**.
- With `allow_backup: true`, when the line fails *after* dialling (the Mac,
  the phone or Twilio said so), the call moves to the **next row**.
- **AI calls** and **missed calls** follow the same order automatically.
- With no routing set, a call tries the Mac, then Android.

Read it with [Get call routing](https://docs.mycrmsim.com/docs/calls/get-call-routing) and set it with
[Save call routing](https://docs.mycrmsim.com/docs/calls/save-call-routing):

```json
{ "workspace_id": 7, "routing": [["whatsapp"], ["imessage"], ["android"]] }
```

The rules are the dashboard's: up to 4 rows, one line per row, a line in one
row only, Twilio only when Twilio calling is enabled.

---

## Three kinds of call

### 1. A call a person makes

[Place a call](https://docs.mycrmsim.com/docs/calls/start-call) is the dashboard's call button. The line
dials the contact, and the caller talks through a **LiveKit room** that the
response hands back:

```json
{
  "call_id": "c7f1a2b3-…",
  "channel": "imessage",
  "room": { "url": "wss://livekit.example.com", "name": "call-c7f1a2b3", "token": "eyJ…", "identity": "browser-42-…" },
  "audio": true,
  "backup_lines": ["android"]
}
```

Join `room.url` with `room.token` using any LiveKit client (the dashboard uses
`livekit-client`), publish a microphone track and subscribe to the contact's
audio. `audio: false` means the line rings the contact without browser audio
(an Android phone whose calling line is off) — the call still happens on the
device.

`room.url` is not one fixed address: it can be our LiveKit server, LiveKit Cloud,
or, on a white-label account, that account's own calls domain
(`wss://calls.your-brand.com`). Always connect to the `room.url` of the call you
are joining; never store one or hard-code it. If your network only lets known
hosts through, allow the calls domain as well.

Who to call: `contact_id` (its phone number, or its email over FaceTime when it
has none), or a `phone` / `email` directly. An email can only go over FaceTime
from the Mac.

Hang up with [End call](https://docs.mycrmsim.com/docs/calls/end-call). During a WhatsApp call,
[Get WhatsApp call](https://docs.mycrmsim.com/docs/calls/get-whatsapp-call) gives its live state.

To follow the call without polling, have its steps (`ringing`, `answered`,
`ended`) pushed to your callback URL as `call.status` events:
[Build calling into your own system](https://docs.mycrmsim.com/guides/call-events).

### 2. An AI call

[Place an AI call](https://docs.mycrmsim.com/docs/calls/start-ai-call) puts a **voice agent** on the
line instead of a person. The voice agent is chosen the way the dashboard
chooses it:

1. The contact's tags are matched to an **AI agent's Contact Tag**; that AI
   agent's voice agent calls.
2. No match: the workspace's **inbound (default) voice agent** calls.
3. Neither, or the matched voice agent is paused, or AI is turned off for the
   contact: the call is **refused**, never swapped to another agent.

[Preview an AI call](https://docs.mycrmsim.com/docs/calls/preview-ai-call) runs the same choice without
dialling, so you can show the agent's name first. `voice_agent_id` names an
agent explicitly.

The response is **202**: the call was placed. Follow it with
[Get AI call](https://docs.mycrmsim.com/docs/calls/get-ai-call) while it is live; afterwards the lasting
record, transcript included, is in
[List voice calls](https://docs.mycrmsim.com/docs/voice-agents/list-voice-calls).

### 3. A missed call

[Place a missed call](https://docs.mycrmsim.com/docs/calls/missed-call) rings the contact for
`ring_seconds` (3–60) and hangs up before they can answer. Nothing is said on
the line; the contact sees a missed call and calls back, or reads the text that
follows. It is the **Missed Call** automation action, so it uses the first line
in Call Routing that can ring: the Android phone, the Mac, Twilio or the
WhatsApp line. It doesn't need calling switched on for that line, except a
WhatsApp line, which only rings with calling on. A line that is offline moves on to the next one.

---

## Inbound calls

A call arriving on one of the workspace's lines **rings the dashboard**.
[List ringing calls](https://docs.mycrmsim.com/docs/calls/list-ringing-calls) shows what is ringing now,
with the caller, the matched contact and the line. Answering needs the
dashboard (browser audio); [Decline ringing call](https://docs.mycrmsim.com/docs/calls/decline-ringing-call)
works from the API, for everyone (`scope: "all"`) or just for this user
(`"me"`).

When the workspace has an **inbound voice agent**
([Set inbound voice agent](https://docs.mycrmsim.com/docs/voice-agents/set-inbound-voice-agent)), it
picks up after its `inbound_answer_after_seconds` unless a person answers
first — within its `inbound_hours` when they are enabled. The ringing-call row
says when: `ai_answer_at` and `ai_agent_name`.

---

## Voice agents

A **voice agent is the voice of an AI agent**. The AI agent
([AI agents](https://docs.mycrmsim.com/docs/ai-agents/list-ai-agents)) holds the prompt, the goal and
the knowledge; the voice agent says *how it speaks*:

- **mode** `pipeline` — a speech-to-text model (`stt`), a language model
  (`llm`) and a text-to-speech voice (`tts`); or `realtime` — one realtime
  speech model.
- the **greeting**, extra **instructions** for calls, how **responsive** it is
  and whether it may be interrupted, whether it **discloses** being an AI;
- **max_call_seconds**, and for inbound: **inbound_answer_after_seconds** and
  **inbound_hours**.

[Catalog](https://docs.mycrmsim.com/docs/voice-agents/voice-agent-catalog) lists the providers, models
and voices the settings may name, and whether each is available to the
workspace (some need the workspace's own key connected in Settings).

One voice agent per AI agent. Manage them with
[List](https://docs.mycrmsim.com/docs/voice-agents/list-voice-agents),
[Create](https://docs.mycrmsim.com/docs/voice-agents/create-voice-agent),
[Update](https://docs.mycrmsim.com/docs/voice-agents/update-voice-agent) and
[Delete](https://docs.mycrmsim.com/docs/voice-agents/delete-voice-agent); choose who answers inbound
calls with [Set inbound voice agent](https://docs.mycrmsim.com/docs/voice-agents/set-inbound-voice-agent).
Pausing a voice agent (`status: "paused"`) stops it taking or placing calls.

Voice agents can be switched off for a whole account by support; every voice
endpoint then answers **403** `voice_agents_off`.

---

## Where the history is

| Call | Where to read it |
|---|---|
| Any **AI call**, on any line | [List voice calls](https://docs.mycrmsim.com/docs/voice-agents/list-voice-calls) and [Get voice call](https://docs.mycrmsim.com/docs/voice-agents/get-voice-call) (with the transcript, duration, end reason and metrics) |
| Calls on the **Mac** line, incoming or outgoing | [List recent calls](https://docs.mycrmsim.com/docs/calls/list-calls) and [Get call](https://docs.mycrmsim.com/docs/calls/get-call), stage by stage with an `outcome` (`answered`, `missed`, `declined`, …) and the line's health at the time |
| Calls on **SIM, WhatsApp and Twilio** lines | Logged on the contact's conversation as `CALL:` messages — [List conversation messages](https://docs.mycrmsim.com/docs/conversations/list-conversation-messages) |

---

## Refusals you will meet

| Response | Meaning |
|---|---|
| `400` with the dashboard's wording | The line can't dial right now: no Mac assigned, the Mac is offline, no calling plan, no Call Routing, AI turned off for the contact, no agent to call them. |
| `403` `voice_agents_off` | Voice agents are switched off for the account. |
| `409` `busy` | Every device the call could use is on a call. Try again shortly (automations retry on their own). |
| `409` `dnd` | The contact has outbound Do-Not-Disturb on for that channel. |
| `409` `not_ringing` | The ringing call was answered, declined or abandoned before the decline arrived. |
| `404` | The workspace, contact or call is not this token's, or the call is no longer tracked. |
| `503` `calls_in_progress` | The Calls API is not switched on yet. Every Calls endpoint answers this until it is; nothing was dialled. |

---

## Scopes

| Scope | Lets the app |
|---|---|
| `calls.read` | readiness, lines, routing, ringing calls, history, following a call, receiving outgoing call events |
| `calls.write` | place calls, AI calls and missed calls, end them, decline ringing calls, save routing |
| `voice_agents.read` | list voice agents, the catalog, the inbound choice, the AI call history |
| `voice_agents.write` | create, update and delete voice agents, set the inbound voice agent |
