# Calls at once

This page is for an admin or IT person whose company runs a call center on its office line (SIP, through a PBX) and wants to know how many calls Lumate can carry at once, what limits that, and which settings change it.

## What the office line does with several calls

Calls on the office line are counted in two groups, each with its own limit:

| Group | Calls | Limit | Where |
|---|---|---|---|
| **Inbound** | Callers answered by reception, and staff talking with Lumate (each staff talk takes one inbound slot) | **Calls answered at once** (`max_inbound`, 1 to 20, default 3) | **Settings → Call center → Reception** |
| **Outbound** | The dialer's AI calls, call lists, **Call now** | **AI calls at once** (1 up to the server's ceiling, below) | **Settings → Call center → Dialer** |

On top of the two there is a **line total**: **PBX channels for this extension**, the most calls (inbound and outbound together) your PBX lets Lumate's extension carry. Leave it empty and the total is the two limits added together.

- **Callers are answered while the dialer is calling.** An inbound call is never refused because of the dialer: reception answers it up to its own limit, whatever the dialer is doing.
- **At the line total the dialer waits.** It places no new call until a channel is free; calls already up are never cut. The callers who are already on count first, so the dialer yields to them.
- **A caller hears busy** when the inbound slots are full: callers and staff talks together fill **Calls answered at once**, or the inbound calls alone fill the line total, or the server is at its ceiling of calls (below). With **Calls answered at once** at 1, a staff talk makes callers hear busy; at 2 or more a caller is answered beside it. Nothing is opened and nothing is paid for a call that hears busy.
- **Staff talking with Lumate** on the office line is one talk at a time, and is allowed while an inbound slot is free (a caller on the line can take the last one).
- **Line channels apply to the office line (SIP through a PBX) only.** WhatsApp and the OpenAI phone-number line ignore the field. The line total is a brake for the dialer: inbound calls ignore it, so with a PBX limit of 4, 3 outbound and 2 inbound calls can meet and the PBX refuses one.

## What limits parallel calls

More calls at once is not only a setting. Four things set the real limit; the lowest one wins.

1. **The server's CPU and memory.** Each call is a live audio session: the server decodes and encodes audio both ways and keeps the conversation. Per-call cost depends on your machine, so measure it (see below) instead of guessing.
2. **Your OpenAI account's concurrent voice sessions.** Every AI call is one session with OpenAI. When the account's limit is reached, new calls fail with "OpenAI's limit of simultaneous voice sessions was reached". Check the limit of your plan with OpenAI; Lumate cannot raise it.
3. **The PBX and the trunk.** Your PBX or SIP trunk carries a fixed number of channels. Put the number Lumate's extension may use in **PBX channels for this extension**, so the dialer waits instead of the PBX refusing a call.
4. **Work after the call.** Each ended call is reviewed by an agent (a summary, the follow-up on the card). The runner does this a few at a time (`RUNNER_SLOTS`, default 2), so when calls end faster than that, reviews queue. See below.

## The settings

| Setting | Where | Meaning |
|---|---|---|
| **AI calls at once** | **Settings → Call center → Dialer** | The dialer's own limit. The page says what this server allows. |
| **PBX channels for this extension** | Same card | The line total. Empty: inbound and outbound limits together. |
| **Calls answered at once** | **Settings → Call center → Reception** | Inbound limit. |
| `LUMATE_MAX_CALLS` | The server's `.env` | The most **AI voice calls at once on this server**, all companies and all channels together (the dialer, reception, staff talks, phone numbers, WhatsApp). Default **10**. A company's own limits stay below it. At the ceiling an inbound call hears busy and the dialer waits. |
| **Call reviews a day** (`review_cap_factor`) | **Settings → Call center → Dialer** | Reviews of ended calls per agent per day, as a multiple of the agent's daily run limit. Default **10**. |
| `RUNNER_SLOTS` | The runner's `.env` | How many agent runs (call reviews included) at once. Default **2**. |

**Raising the ceiling.** The default of 10 is deliberately careful. Measure first, then set `LUMATE_MAX_CALLS` in `/opt/lumate/.env` (for example `LUMATE_MAX_CALLS=30`) and restart the server. A value saved above a lowered ceiling is held down to it. Give the server more memory (`SERVER_MEMORY`) and the runner more (`RUNNER_MEMORY`) with it; see [Operations](/docs/operations).

**One server process.** The counter lives in the memory of one Lumate server process, so "per server" holds when Lumate runs as ONE process (the default install); with several worker processes, each would count its own calls. Meet and browser (WebRTC) voice sessions are not counted: only phone calls (the dialer, reception, staff talks, phone numbers, WhatsApp) take a place. A call whose server task is gone while its session still shows open is closed after about 90 seconds and its place is freed.

## Work after the call

Reviews of ended calls queue, and none is dropped. They run in this order (lower first):

1. What people ask for, and what a customer is waiting for: a message, an explicit request, a customer's follow-up.
2. The reviews of the dialer's calls.
3. An admin's errand call and calls made from Chat.
4. The plain review of a call on a phone number.

Every 30 minutes a review waits it moves up one group, so nothing waits for ever. Inside a group the oldest goes first.

**A cap per agent per day.** Call reviews have their own cap: 10 times the agent's daily run limit by default (a company setting). Past it, ended calls are not reviewed one by one: each agent gets one **hourly digest** run that covers all of them. No call is dropped: each keeps its transcript and summary and appears in the digest.

When reviews are waiting, **Call center** shows how many are waiting, how many are running and how long the oldest has waited. If the backlog keeps growing, raise `RUNNER_SLOTS` (and the runner's memory), or lower **AI calls at once**.

## WhatsApp and Chat calls are one at a time

A call through WhatsApp (the office browser's WhatsApp Web, or the company's WhatsApp number) is **one call at a time**: one WhatsApp tab carries one call. Calls from Chat are one at a time too. The settings above are for the office line (SIP). A company that needs many parallel calls needs the office line.

## How to measure

Measure on a quiet machine, with the load-test kit in the repository: `tools/dev/load/` (a PBX and a SIP call generator in Docker, scenarios for inbound, outbound and mixed calls, and a script that records the server's CPU and memory per call and the OpenAI session errors). Its README says how to run it. Then:

1. Run with 5 calls, then 10, then 20, and read the per-call CPU and memory in the report.
2. Pick the number of calls at which the server stays under about 70% CPU and has memory to spare, and at which there are no OpenAI session errors.
3. Set `LUMATE_MAX_CALLS` to it (or a little above), then **AI calls at once** and **Calls answered at once** inside it, and **PBX channels for this extension** to your PBX's number.
