Files
twenty/packages
martmull 1f55234d0b fix(call-recorder): leave call when only recording bots remain (#23053)
## Problem

Fixes
[core-team-issues#2689](https://github.com/twentyhq/core-team-issues/issues/2689).

`everyone_left_timeout` only fires when the bot is the sole remaining
participant, and Recall counts other recording bots as participants. So
when several bots share a meeting, none of them sees itself as alone.

Recall does enable `bot_detection` by default, but it ships an empty
`matches` list, so the name-based check can never classify anyone. The
only detector that actually runs is the behavioural one, at its default
20 minute grace plus 10 minute timeout. A meeting left with only bots
therefore stays open for around 30 minutes, and two Twenty bots in the
same call never recognise each other at all.

This happens when several workspace members are invited to the same
meeting and each has the recorder preference on, or when third-party
notetakers stay behind after the humans leave.

## What this does

Sends a full `automatic_leave.bot_detection` block plus
`silence_detection`:

- **`using_participant_names`** — the configured recorder name, so
co-scheduled Twenty bots recognise each other, plus a list of common
notetakers. `timeout: 10`, which is Recall's enforced minimum; their
example config shows `5` and the API rejects it.
- **`using_participant_events`** — a participant that never speaks nor
shares screen is treated as a bot.
- **`silence_detection`** — Recall's documented example values
(`activate_after: 1200`, `timeout: 300`). Previously unset, so it fell
back to Recall's 20 + 60 minute default.

Both bot detectors activate 5 minutes after the **meeting start time**,
not 5 minutes after the bot joins. The bot joins early by a configurable
amount, so anchoring to join time spent the grace period before the
meeting existed — at a 10 minute early join, detection would have gone
live 5 minutes before the meeting began.

`everyone_left_timeout` is unchanged and still covers the ordinary case.

Effect:

| | before | after |
|---|---|---|
| Only bots remain | ~30 min | ~5 min after meeting start |
| Someone leaves the call open after talking | ~80 min | ~25 min |

## Deferred

De-duplicating bots per meeting URL, so several `callRecording`s in one
meeting share a single bot instead of each spawning one. `bot_detection`
is still needed for third-party bots, so this ships first.

---------

Co-authored-by: ehconitin <nitinkoche03@gmail.com>
2026-07-28 08:51:40 +00:00
..