# NexGate Calls & Meetings: revamp requirements

**Version:** 0.4 · **Started:** 2026-11-24 · **Status:** being discussed with the owner; five meeting fixes and two call
fixes already built (§2), everything else design only

How calls and meetings should work after the revamp: what NexGate keeps, what it learns from WhatsApp, Telegram, Google
Meet, Zoom and Teams, and what it reuses from the live revamp. A living document: every topic we discuss is added here.

Today's technical spec and API: `calls_meetings_api_doc.md` (repo root). Where this document disagrees with it, **this
document wins** and the API doc is updated when we build. Related: `docs/live/LIVE_REVAMP_REQUIREMENTS.md` (the live
tools meetings reuse), `docs/gift/GIFT_SYSTEM_SPEC.md` (moment gifts), `docs/team/WORK_CALLS.md` (work calls).

**Marks used**

| Mark | Meaning |
|---|---|
| ✅ | Agreed with the owner |
| 🟡 | Proposed, waiting for the owner's answer |
| ⬜ | Not discussed yet |
| ❌ | Decided against |
| 🔨 | Built (commit given) |

**Rules that apply everywhere**
- **Our side only.** This document covers the backend, the notification server and infrastructure. App work is the app
  team's; they get it through the API change log (owner 2026-11-24).
- **The backend decides, the app shows.** Who can be called, who rings, limits, which buttons appear: all from the backend.
- **A person is identified only by accountId** (never a chat address / JID in a new field).
- **Never reshape an existing response.** New things are added fields or new endpoints; old names keep working until the
  apps switch.
- **Check real behaviour on staging** (logs and database over `ssh nexgate`) before deciding something is broken or works.

---

## 0. The picture in one page

| | **Calls** (1:1 and group) | **Meetings** |
|---|---|---|
| What it is | A phone call: it **rings** | A **private live**: you **join** at a time, nothing rings |
| Audio or video | chosen by the caller (audio → video possible) | ✅ **no choice: a meeting is a meeting**; everyone switches their own camera and mic |
| Who | Chat contacts (1:1), group chat members, shops, parcel work calls | Invited people and link holders, signed in |
| Size | Up to 8 (from settings, C5) | Host + up to 8 speakers + many listeners |
| Style | ✅ **Light, the WhatsApp way**: reactions and raise hand go phone to phone | ✅ **Same stage and tools as Audio / Video live**: co-hosts, requests, mute, invites with privacy, chat, polls, questions, selling, gifts |
| Inside the room | LiveKit (sound, video, data) | LiveKit (everyone is in it) |
| Tools in the room | ✅ API in → backend checks → **LiveKit `SendData`** out | the same |
| Outside the room (ringing, invites, reminders) | SSE when the app is open, push when closed; later Centrifugo's personal channel | the same |

---

## 1. What exists today (checked in code 2026-11-24)

Code: `chat_system/calls_mng` (calls + meetings), `shipping_service/work_calls`, `team_mng/shop_calls`,
`chat_system/livekit`, notification server `PushService` / `FcmPushProvider` / `ApnsVoipPushProvider`.

### 1.1 Calls

| | 1:1 call | Group call | Shop call | Work call (parcels) |
|---|---|---|---|---|
| Start | `POST /calls` with a conversation, a person or a shop | from a group chat | customer calls a shop (from its page) | buyer, shop or shipper about one order |
| Who rings | the other person | **everyone in the group** | shop terminals + the owner per "Ring on my phone" (always / when nobody's at the shop / never) | the people on the parcel |
| Limit | — | **8** (`app.livekit.group-max-participants`); a group **over 8 can't call at all** (`CALL_TOO_LARGE`) | first to answer wins | — |
| Video | ✅ | **off above 4 people** (`video-off-above-participants`) | ✅ | ✅ |
| Rules | chat contacts only (message requests) | — | shops can't cold-call customers | only while the order is open |

- **Life of a call:** `RINGING` (45 s) → `ACTIVE` (someone joined) → `ENDED` with an outcome: `COMPLETED`, `MISSED`,
  `DECLINED`, `CANCELLED`, `BUSY`, `FAILED`. The server learns joins and leaves from **LiveKit webhooks**, not from phones.
- On ending, a **`CALL_EVENT` message** is written in the chat ("Missed call", "Call 4:12"); `GET /calls` = history (30).
- Already works: joining a group call late **if you were rung**; turning a 1:1 into a 3-way (`POST /calls/{id}/participants`,
  caller only, contacts only); audio → video mid-call (recorded when a camera appears).
- **Ringing when the app is closed works** (owner 2026-11-24, staging logs: 408 incoming-call pushes in 30 days, all
  delivered):
  - backend sends `CHAT_INCOMING_CALL` as a **HIGH** push carrying caller name and photo, room, URL and a 10-minute token
    (answering = one tap, no round trip); for a shop call "answer as the shop" instead of the token;
  - Android: Firebase high priority, **expires with the ring** (45 s), so a late ring never arrives after the call;
  - iPhone: **Apple VoIP push (PushKit)** straight to Apple (Firebase can't send this type), paired with the Firebase token
    (`DeviceTokenKind.PUSH` / `VOIP`) so the phone rings once; switch `push.apns.voip.enabled`.
- Busy and stuck calls: `isOnAnotherCall` (busy check), `CallTimeoutJob` (ring timeout, stuck ACTIVE after 4 h, OPEN
  meetings without an end), `MeetingScheduleJob` (opens / closes meetings every 30 s).

### 1.2 Meetings

- `POST /meetings`: title (required), description, start (`scheduledAt`, empty = now), end (`endsAt`), audio / video,
  access **INVITED** (a guest list) or **OPEN** (join links), invitees (accountIds), optional chat conversation (writes
  "Friday 17:00, pricing review" into it).
- States: `SCHEDULED` → `OPEN` (the job opens it at the start) → `ENDED`. **Never rings**; "starting" is a notice.
- Roles: **HOST**, **SPEAKER** (shares the cap of 8), **LISTENER** (no limit; subscribe only, enforced in the token).
- Links: `POST /meetings/{id}/links?role=SPEAKER|LISTENER` (30 days, never HOST); `POST /meetings/join/{token}`.
- Host: promote / demote (`PUT …/participants/role`), end, cancel (before it opens), edit (`PATCH`).
- Notices: `CHAT_MEETING_INVITE`, `_STARTING`, `_UPDATED`, `_ROLE_CHANGED`, `_ENDED`, `_CANCELLED`.
- Screen share: **already allowed in the LiveKit token** for speakers (`screen_share`); only app work. Listeners may send
  data messages.

### 1.3 Staging, last 30 days (2026-11-24)

| Call | Result | Count |
|---|---|---|
| 1:1 audio | completed / busy / cancelled / missed / declined | 42 / 33 / 32 / 12 / 5 |
| 1:1 video | completed / busy / cancelled / missed | 16 / 7 / 7 / 1 |
| Group audio | completed / missed / cancelled | 18 / 3 / 3 |
| Group video | completed | 5 |
| Meetings (video) | completed / still scheduled | 22 / 5 |

Health check (2026-11-24): nothing stuck ringing or active, no meeting open past its end, no scheduled meeting that
failed to open, no ended call without an outcome. Found and fixed: §2.

---

## 2. Fixed on 2026-11-24 (🔨, local on `fet/team`, unpushed)

| # | Problem | Fix | Commit |
|---|---|---|---|
| P1 | A meeting for **now** was saved `SCHEDULED`; "starting" came up to 30 s late | opens `OPEN` at once | `f183fa52` |
| P2 | Invitees could join **days early** into an empty room | doors open **10 min before** the start (`NOT_OPEN_YET`); the host any time | `f183fa52` |
| P5 | Role change named a person by **JID** | `accountId=` (the old `jid=` still works) | `f183fa52` |
| P7 | Edit only title + start; end unchecked; past start became "now"; English words in the notice | edit takes **description** and **end**; end after start (`END_BEFORE_START`); past start refused (`IN_THE_PAST`); notice adds `changedFields` keys | `f183fa52` |
| P8 | Invitees past 8 **quietly** became listeners | create answer adds `speakerLimit` + `invitedAsListeners` | `f183fa52` |
| B1 | **BUSY bug:** a person counted as on a call while only **invited to a meeting** (scheduled, or open without them) or rung by an unanswered **group** call. **29 of 40** BUSY calls in 30 days; one person unreachable for 1:1 calls until 28 Nov | busy = **in a room now** (joined, not left) or **being rung by a 1:1**; replayed on staging data before changing; work calls too | `8299506d` |
| B2 | 96 people "joined but never left" in ended calls | when a call ends, everyone still in the room is marked as left | `616346a7` |

Docs: `calls_meetings_api_doc.md` ("Changes 2026-11-24"), `docs/changelog/frontend_changelog_2026-11-24.md` §9–§10.
Tests: `MeetingFixesTest` (5); suite 620 green.

---

## 3. Real time: which pipe carries what

✅ Agreed 2026-11-24.

| What | Pipe | Why |
|---|---|---|
| **Inside a call or meeting**: pins, coupon drops, polls, requests list, mute, gifts, meeting chat | **LiveKit data**, sent **by our backend** (`SendData` on LiveKit's server API) | everyone in a call or meeting is already connected to LiveKit for sound and video |
| Reactions and raise hand **in calls** | LiveKit data **phone to phone** (no backend) | light, like WhatsApp |
| **Outside the room**: ringing, invites, "starting", reminders, "a call is on · Join" | SSE when the app is open, push when closed; **later Centrifugo's personal channel** (live doc §13.4) once it exists | reaches people not in the room yet |

**The rule for every tool in a call or meeting:**
```
 Host taps Pin ──API──► Backend: checks (her shop's product? price? coupon rules? meeting on?) · saves it
                              └──LiveKit SendData (server → room) {event: PIN, productId}──► every phone, within a second
 Someone joins late ──join answer / GET …/pins──► current shelf and pin
```
- Messages carry **a key + an id**, never display text (the phone draws the card from the API; LiveKit data messages are
  small, ~15 KB).
- **Phones trust only messages sent by the server** for tools (a fake "coupon" from a phone is ignored).
- Taps on a pinned product → normal checkout, recorded as a sale from this meeting (live doc §13.6 sale origins).
- Our `LiveKitClientImpl` already calls LiveKit's server API (list participants, mute, delete room); `SendData` is one more
  method on it.

**Why live is different:** live **viewers** watch through **SRS** (a one-way video stream, cheap for thousands) which
can't carry messages, so live needs Centrifugo; the host and guests are in LiveKit. In meetings **every listener is a
LiveKit participant**, so the data pipe is already there. If a meeting ever had thousands of listeners on SRS, those
would need Centrifugo.

| | LiveKit (calls, meetings, live stage) | SRS (live viewers) |
|---|---|---|
| Kind | two-way room | one-way stream, like TV |
| Cost per person | high (streams forwarded to each) | very low (copied, cached on edges) |
| Good for | a few to a few hundred who interact | hundreds to thousands who watch |
| Carries messages | ✅ data | ❌ |

---

## 4. Calls

### 4.1 What others do that we don't (from what we know, 2026-11-24)

| Others do | Who | Us today |
|---|---|---|
| Ring when the app is closed / locked | everyone | ✅ works (§1.1) |
| Group call size | WhatsApp up to 32; Telegram very large; Meet 100+ | 8 |
| **Pick who to ring** in a group | WhatsApp | rings everyone; a group over 8 can't call |
| **"Call ongoing · Join"** from the chat | WhatsApp, Telegram | only people rung can join |
| **Add people during any call** | WhatsApp, Telegram, Meet | 1:1 → 3-way only |
| **"Who can call me"** | Telegram (WhatsApp: "silence unknown callers") | only the message-request rule |
| **Missed call → Call back / Message** from the notice | WhatsApp, Telegram | plain notice |
| **Call waiting** (a second call while on one) | WhatsApp | second caller gets BUSY |
| Works on strict networks (TURN) | everyone | TURN off on our LiveKit |
| One **Calls tab**: history + upcoming | WhatsApp | history only, meetings without title / time |
| Screen share, low data mode, raise hand, reactions | everyone | app work (screen share already allowed by the server) |

### 4.2 Backend list for calls

| # | What | How (backend) | Status |
|---|---|---|---|
| C1 | Ring when closed | built and working (§1.1) | ✅ done |
| C2 | **Pick who to ring in a group** | `POST /calls` gains optional `inviteeAccountIds` (group chat only, members only, up to the limit); only they ring. A group of 30 can call 8 of them | 🟡 |
| C3 | **"A call is on · Join"** | the conversation shows the running call (id, kind, who's in, count); **any member** of the group chat can join while there's room (not only people rung) | 🟡 |
| C4 | **Add people during any call** | anyone in the call adds contacts (group or 1:1), up to the limit; blocks and "who can call me" apply | 🟡 |
| C5 | **Limits that grow** | people per call and "video off above" from **admin settings in the database**, not config; raised without a release | 🟡 |
| C6 | **"Who can call me"**: everyone / contacts / nobody | privacy setting like gifts and live invites; refused calls look the same as a block to the caller | 🟡 |
| C7 | **Missed-call notice with actions** | the notice carries `actions: [CALL_BACK, MESSAGE]` + ids; the app draws the buttons | 🟡 |
| C8 | **Call waiting** | a second 1:1 call rings with `waiting: true` instead of BUSY; the person ends one and answers, or declines | 🟡 |
| C9 | **TURN on** | turn on TURN in our LiveKit (infra; the spec deviation noted in memory) | 🟡 |
| C10 | **One Calls tab** | `CallResponse` gains title, start, end, my role, access for meetings (fields added, P6); a new "upcoming" list (§6.2) | 🟡 |
| — | Centrifugo for calls | ✅ not needed to work; calls move onto Centrifugo's personal channel **after live phase 1** as a tidy-up | ✅ |

### 4.3 Tools in calls

✅ Agreed 2026-11-24 (owner: "the call needs those tools as listed in the table").

| Tool | 1:1 call | Group call (≤ 8) | Backend |
|---|---|---|---|
| Reactions ❤️ 😂 🔥 | ✅ | ✅ | none (phone to phone) |
| Raise hand ✋ | — | ✅ | none (phone to phone) |
| Mute others (never unmute), remove + block from this call | — | ✅ whoever started it | server mute / remove through LiveKit |
| **Gifts** (moment gifts) | ✅ | ✅ | built (gift spec v6); add place for calls (`GiftPlace.MEETING` exists; calls reuse it or get `CALL`) |
| **Pin a product** | ✅ shop calls ("this one?") | — | API → check → `SendData` (§3) |
| "Weak network, try a new location" | ✅ | ✅ | none (the phone detects it) |

**Example:** Juma calls Asha → ❤️ phone to phone. Asha sends a 🌹 gift during the call → Juma's gift balance. Juma
calls Duka la Mama → the shop pins the red kanga → Juma sees the card in the call → taps → checkout ✅

---

## 5. Meetings are a private live

✅ Agreed 2026-11-24: a meeting uses **the same stage and tools as Audio / Video live**, but only invited people and link
holders get in, and everyone is in LiveKit (§3). One set of rules for live and meetings: built once.

| Live tool (live doc) | In meetings | Backend |
|---|---|---|
| Reactions (§8.2) | ✅ | counted and mixed every 2 s, sent by `SendData` |
| Requests ✋ + "who can ask to speak" (X2, X3, X5) | ✅ | requests list for host and co-hosts |
| Co-hosts, max 2 (§8.1a) | ✅ | new role `CO_HOST`: accept requests, mute, remove; can't end |
| Mute, never unmute; back to listener; remove + block (X4, X6) | ✅ | server mute / remove through LiveKit |
| Invites with accept + "Who can invite me" (§8A.8–9) | ✅ | §7 |
| Chat with role badges (§8.7) | ✅ | §10 |
| Polls, questions with Me too (§8.5, §8.6) | ✅ | §10 |
| Gifts (gift spec v6) | ✅ | `GiftPlace.MEETING` (exists, switched off until built) |
| Pin, coupon drop, flash price (§7) | ✅ a shop's meeting (wholesale session) | §11 |
| Weak network bar, speaker weak-network flag (§9.3 N7, N9) | ✅ | speaker flag to host |
| Booking, reminders 24 h / 15 min, upcoming list (§4) | ✅ | §6 |
| Send listeners to another live / meeting (Y8) | later | — |

**Example:** Duka la Mama holds a **wholesale meeting** for 40 shop owners → Neema is co-host → owners raise hands →
a poll "which colour next month?" → Mama Yoyo pins a kanga and drops a 15% wholesale coupon → Asha sends a 🔥 gift ✅

**Meeting topics**

| # | Topic | Fixes | Status |
|---|---|---|---|
| M1 | Invites | P3, P4 | §7 (✅ mostly) |
| M2 | My meetings, upcoming, reminders | P6, P9 | §6 🟡 |
| M3 | Roles in the room | P4 | §8 🟡 |
| M4 | Waiting room and locks | new | §9 🟡 |
| M5 | Chat, polls, questions, reactions | new | §10 🟡 |
| M6 | Selling and gifts | new | §11 🟡 |
| M7 | Links and "joined by your link" | new | §12 🟡 |
| M8 | Limits from settings | new | §13 🟡 |

---

## 5a. A meeting is a meeting: no audio / video choice

✅ Owner 2026-11-24: "we don't need Video / Audio, a meeting is a meeting; people can switch".

- Creating a meeting has **no Video / Audio pick**. Every meeting is **camera-capable**; each person turns their own
  **camera and mic on or off** during it (Google Meet, Zoom).
- **Today:** `CreateMeetingRequest.kind` exists and defaults to **AUDIO** when empty, which blocks cameras. **After:** the
  field stays in the request and answer (old apps don't break) but meetings are always created camera-capable.
- **Who may use a camera** stays a backend rule: host, co-hosts and speakers yes; listeners no (token grant). The
  **"cameras off above N speakers"** limit stays for bandwidth, from settings (M8).
- A host who wants a voice-only meeting uses **"lock cameras"** (§9).
- **Example:** Mama Yoyo creates "Wholesale December" without picking anything → Neema turns her camera on to show
  fabric → Juma stays voice-only on mobile data → Mama Yoyo taps **Lock cameras** for the price talk ✅

## 5b. Banner: optional

✅ Owner 2026-11-24.

| App | Banner on a meeting |
|---|---|
| WhatsApp scheduled call | no (title and people) |
| Google Meet / Calendar | no |
| Zoom webinars (public sessions) | yes (banner and branding on the sign-up page) |
| NexGate live | yes (agreed) |

- **Optional, never required.** A quick team meeting needs none; a shop's meeting (wholesale session, class, launch)
  looks better with one.
- Shown wherever the meeting shows: the **invite**, the **chat card**, **My meetings / Upcoming**, the **link preview**
  (e.g. on WhatsApp).
- **No banner** → the backend returns nothing; the app draws a plain card with the title and the host's (or shop's)
  photo.
- Backend: optional **`coverMediaId`** on the meeting, stored and returned as the standard media object (fileId, status,
  URLs made at response time), like the live's banner (`StreamEntity.coverMediaId`). Set in the create form, changeable
  in Edit (a new `changedFields` key `BANNER`).
- **Example:** Asha's "Friday pricing review" has no banner → invite shows the title with Asha's photo ✅. Duka la Mama's
  "Wholesale December" has a kanga banner → invite, chat card and WhatsApp preview all show it ✅

## 6. M2: My meetings, upcoming, reminders

🟡 Proposed (reuses live doc §4).

- **`GET /meetings/mine?status=upcoming|ended`**: meetings I host or was invited to (accepted or waiting), each with
  title, start, end, kind, access, **my role**, **my answer** (accepted / waiting), counts (accepted, waiting), and
  **buttons decided by the backend** ([Join] from 10 min before, [Edit], [Cancel], [Answer], [Copy link]).
- **Calls tab** (C10): history (`GET /calls`) and upcoming meetings in one place; `CallResponse` gains `title`,
  `scheduledAt`, `endsAt`, `access`, `myRole` for meetings (fields added).
- **Reminders** to people who **accepted**: **24 h before** and **15 min before** (live's `ReminderLead` choices), and
  "starting now" at the start (exists). Host: "starts in 15 min · get ready".
- **Moved or cancelled:** accepted and waiting people are told (one notice each, keys not English).

---

## 7. M1: Invites

### 7.1 Today
Asha creates a meeting with Juma, Neema and Rose listed: **they're put straight in** (push + SSE, no accept, no privacy
check, only blocks). She can't add people later or take anyone off (P3, P4).

### 7.2 What others do (researched 2026-11-24)

| | Google Calendar / Meet | Zoom | Teams | WhatsApp (scheduled calls) |
|---|---|---|---|---|
| Answer an invite | Yes / No / Maybe; organiser notified, sees every answer | — (link or registration) | Yes / No / Maybe | — |
| Guests invite others | ✅ on by default, organiser can switch off | — | — | — |
| Guests see who's invited | ✅ on by default, can be switched off | — | ✅ | ✅ attendees |
| Guests propose a new time | ✅ organiser reviews it | — | ✅ | — |
| Invite a whole group | ✅ | — | ✅ | ✅ contacts or groups |
| People not invited | **knock**: ask, host admits or denies (one by one or all) | **waiting room**; or **signed-in only**; or registration with approval | **lobby**: invited walk in, others wait | anyone with the link |
| Lesson | — | **passcodes in links leak** (forwarded); signed-in only + waiting room work better | — | creator **told when someone joins** by the link |

### 7.2a Three ways to create a meeting (Google Meet style)

✅ Owner 2026-11-24: "we need all three; schedule is different; the later link is just a link, no people, no content".

**How Google Meet does it** (from what we know): "New meeting" → **Start an instant meeting** (you're in at once, a box
gives the link and "Add others") · **Create a meeting for later** (a link only) · **Schedule in Google Calendar** (the
full form).

```
            [ ＋ New meeting ]
   ┌──────────────────────────────────┐
   │ ⚡ Start now                      │  ← one tap, you're in
   │ 🔗 Link for later                 │  ← one tap, just a link
   │ 📅 Schedule                       │  ← the full form (below)
   └──────────────────────────────────┘
```

| | ⚡ Start now | 🔗 Link for later | 📅 Schedule |
|---|---|---|---|
| Form | **none** | **none** | the full form |
| Title | default "Mama Yoyo's meeting" (renamable later) | default | required |
| Banner, description | — | — | optional |
| Time | now, no end | **none**: opens when the host joins | a start (and end) |
| People invited | none at first; **[Add people]** inside (invites, §7.3) | **none**: the host shares the link herself | invites, whole group chat, co-hosts |
| Guest options | defaults | defaults | chosen in the form |
| Link holders | wait for the host (waiting room) | wait for the host | as chosen |
| Reminders, upcoming by time | — | — | ✅ (§6) |
| Answer of the create call | the meeting **+ link + the host's join token** (straight into the room) | the meeting **+ link** | the meeting (links on the screen after Create) |
| Life | ends when the host ends it, or the stale-meeting backstop | link valid **30 days**; unused → closed quietly; each time the host opens it, it works like Start now | as a scheduled meeting |

**Rules**
- A **link for later** is **just a link**: no time, no invites, no reminders. To set a time or invite people, use Schedule.
- The host can open a link-for-later room **any time** within its 30 days; link holders wait in the waiting room until she
  lets them in.
- Backend: `POST /meetings` gains **`mode`**: `NOW` · `LINK` · `SCHEDULED` (missing = today's behaviour). `NOW` and `LINK`
  accept an empty title (default title); `NOW` returns link + host token; `LINK` creates a meeting with **no time**
  (state stays `SCHEDULED` with no start, opens when the host joins, closed after 30 days if unused).

**Examples**
- Juma, chatting with a supplier: **⚡ Start now** → in the room within a second → **Share** → the supplier waits → Juma
  lets him in ✅
- Mama Yoyo: **🔗 Link for later** → pastes it in her WhatsApp group "meet me on this link tomorrow" → tomorrow she opens
  it → people waiting get in ✅
- Duka la Mama: **📅 Schedule** "Wholesale December", Friday 17:00, banner, 30 invites, Neema co-host → reminders 24 h
  and 15 min → doors open 16:50 ✅

### 7.2b The Schedule form (sample, 2026-11-24)

```
┌─────────────────────────────────────────┐
│  [ 👤 Mama Yoyo ▾ ]   ← Me / 🛍 Duka la Mama
│                                         │
│  🖼 [ Add a banner (optional) ]          │
│  Title: Wholesale December              │
│  Description: New stock, prices for Dec │
│                                         │
│  When                                   │
│   [ ⚡ Now ] [ Today 17:00 ] [ Tomorrow 10:00 ]
│   [ 🗓 Custom ]                          │
│  Ends   [ 1 h ✓ ] [ 2 h ] [ No end ]     │
│                                         │
│  ── Who ──────────────────────────────  │
│  Invite  [ Asha ✕ ] [ Neema ✕ ] [ + Add ]│  ← only people who allow you
│          [ 👥 + A whole group chat ]     │  ← each member gets their own invite
│  Co-hosts [ Neema ✕ ]  (up to 2)         │
│  People with the link                   │
│   [ Wait for me to let them in ✓ ]      │
│   [ Come straight in ]                  │
│                                         │
│  ── Guests can ───────────────────────  │
│  Invite others                [ OFF ]   │
│  See who's invited            [ ON ]    │
│  Ask to speak  [ Everyone ✓ ] [ People I follow ] [ Only invited ]
│  Start muted                  [ ON ]    │
│                                         │
│  ℹ 8 can speak; more join as listeners. │  ← limit from the backend
│                                         │
│             [ 📅 Create meeting ]        │
└─────────────────────────────────────────┘
          ↓
┌─────────────────────────────────────────┐
│  ✅ Wholesale December · Fri 5 Dec 17:00 │
│  Invites sent: 30 · waiting for answers │
│  [ 🔗 Listener link ] [ 🎙 Speaker link ]│
│  [ ✏️ Edit ] [ ✖ Cancel ]                │
└─────────────────────────────────────────┘
```
- No Video / Audio pick (§5a). Banner optional (§5b). In the Schedule form a start of **now** opens at once (P1 built); a
  later time opens the doors 10 min before (P2 built). One-tap meetings: ⚡ Start now or 🔗 Link for later (§7.2a).
- **Ends** must be after the start (P7 built); **No end** = the host ends it.
- Links exist only after the meeting is created (on the screen after Create), as with lives.
- Every pill, limit and switch comes from the backend.

### 7.3 NexGate meeting invites

✅ Owner 2026-11-24 ("very nice") for I1–I7; I8 later. Copied from group invites and live invites (live doc §8A.8).

| # | Rule |
|---|---|
| I1 | **Answer the invite: Accept / No thanks.** 🟡 no "Maybe" (proposed, to keep it simple). A **waiting** person **isn't in** the meeting: can't join, gets no meeting notices beyond the invite. The host sees the list ✅ ⏳ ❌ with counts |
| I2 | **Host told about answers, grouped:** "Juma and 3 others accepted" once, not one push per person |
| I3 | **Guest options per meeting:** **"Guests can invite others"** off by default (the host's list stays hers); **"Guests see who's invited"** on by default. Guest invites follow the same privacy setting |
| I4 | **Invite a whole group chat:** every member gets **their own invite** and answers for themself; privacy respected per person |
| I5 | **Invited people walk in, others wait:** link holders who weren't invited go to the **waiting room** (§9); the host can turn on **"Link joins straight in"** for open sessions |
| I6 | **Signed in only** (already our rule: every link needs a NexGate account; blocks apply) |
| I7 | **"Juma joined by your link"**: one quiet notice to the host per person, grouped if many |
| I8 | Propose a new time | ⏳ later |

**Also (from groups and live):**
- Who invites: the **host** (at create or later); **co-hosts** only people already in the meeting; guests only if I3 is on.
- **"Who can invite me"**: everyone / contacts only / nobody, default **contacts only**. 🟡 One setting shared with live
  ("Who can invite me to lives and meetings") or a separate one: **open question Q1**.
- Refused: always "This person can't be invited" (never block vs setting); the picker hides them.
- **20 invites a day** per person (as groups and live); inviting a whole group chat counts as one.
- **Later changes:** add people until it ends; **withdraw** a waiting invite; **remove** someone who accepted ("removed from
  the meeting").
- Expiry: when the meeting ends or is cancelled.
- States: **waiting · accepted · declined · withdrawn · removed · expired**.
- More than the speaker limit accepted → the rest are listeners; the host is told (P8, built).

**Example**
- Mama Yoyo creates "Wholesale December" and invites her group chat "Kanga Sellers" (30 people) → 30 invites.
- 18 accept → she gets "Asha and 17 others accepted" once. 4 No thanks. 8 haven't answered.
- "Guests can invite others" is off → Asha can't add her cousin; she sends him the **link** → he lands in the **waiting
  room** → Neema (co-host) admits him → Mama Yoyo: "Baraka joined by your link" ✅
- Rose ("Nobody") never appears in Mama Yoyo's picker ✅. Wednesday Mama Yoyo withdraws Juma's unanswered invite ✅

---

## 8. M3: Roles in the room

🟡 Proposed (live doc §8A.4, §8.1a).

| Role | Can |
|---|---|
| **Host** | everything: end, cancel, edit, invite, roles, co-hosts, locks, waiting room, selling tools (if a shop) |
| **Co-host** (max 2) | accept requests, admit from the waiting room, mute, move to listener, remove, invite people already in; **can't end** or use the host shop's money tools |
| **Speaker** | talk, camera (within the video limit), screen share |
| **Listener** | listen, react, chat, raise hand ✋ |

- **Requests:** "Who can ask to speak": everyone (default) / people I follow / only people I invite; ✋ for listeners;
  ✋ "next" for speakers; host or co-host accepts.
- **Mute, never unmute** (only the person turns their own mic back on). **Back to listener**. **Remove** (can't come back
  to this meeting) + **block**.
- New speakers start muted (default on).

---

## 9. M4: Waiting room and locks

🟡 Proposed (Google Meet, Zoom, Teams).

- **Waiting room:** link holders who weren't invited **ask to join**; host and co-hosts see the list and **Admit / Deny**,
  one by one or **Admit all**. Switch per meeting: **"Link joins straight in"** (off by default).
- **Locks** (host and co-hosts): **mute all**; **lock mics** (only host, co-hosts and people they allow can talk);
  **lock cameras**; **lock chat**; **lock screen share** (host and co-hosts only). Locks never apply to host and
  co-hosts.
- **Lock the meeting:** nobody new gets in (invites and links stop working until unlocked).
- **End for everyone** (exists).

---

## 10. M5: Chat, polls, questions, reactions

🟡 Proposed (live doc §8.2, §8.5–8.7).

- **Meeting chat** with role badges (Host / Co-host / 🛡 / On stage), reply with a quote, pin a comment; kept while the
  meeting is on, through `SendData` (and readable on join).
- **Polls** (2–4 options, products allowed, timer or open) and **questions** with Me too, as live.
- **Reactions** counted and mixed every 2 s.
- No recording (as live §2).

---

## 11. M6: Selling and gifts

🟡 Proposed.

- **Selling** in a shop's meeting: pin a product or ticket, coupon drop, flash price, group buy (live doc §7.2 rules: one
  group system, item's own clock), instalments on the card; **only the shop sells**; sales recorded with origin
  "meeting" (sale origins table).
- **Gifts:** moment gifts with `GiftPlace.MEETING` (exists, off until built); receivers = host, co-hosts, speakers;
  gift cards from a meeting like from a live.
- Pipe: §3 (API → check → `SendData`).

---

## 12. M7: Links

🟡 Proposed.

- Speaker link and listener link (exist; 30 days, never host). **Link holders not invited → waiting room** unless "Link
  joins straight in".
- **"Juma joined by your link"** notice to the host (I7), grouped.
- Host can **reset a link** (the old one stops working) and see how many joined by each link.
- Blocks apply to links (exists).

---

## 13. M8: Limits from settings

🟡 Proposed (with C5).

- Speakers per meeting (8), listeners per meeting, people per call (8), video off above (4): **admin settings in the
  database**, returned to the app; raised without a release.

---

## 14. Still open from the code review

| # | Problem | Where it goes |
|---|---|---|
| P3 | Invitees put straight in, no accept, no privacy | §7 |
| P4 | No adding people later, no remove, no mute others | §7, §8 |
| P6 | Meeting answer lacks title, time, access, my role; no upcoming list | §6, C10 |
| P9 | Only "starting" reminder | §6 |
| P10 | Never tested on real phones; TURN off | C9 + phone test |

---

## 15. Open questions waiting for the owner

| # | Question | My suggestion |
|---|---|---|
| Q1 | "Who can invite me": **one setting for lives and meetings**, or two? | one ("Who can invite me to lives and meetings"), contacts only |
| Q2 | Invite answers: Accept / No thanks only, or add **Maybe**? | no Maybe |
| Q3 | C2–C10 for calls: all, and in which order? | C9 (TURN), C2, C3, C4, C5, C6, C7, C10, C8 |
| Q4 | M2–M8 for meetings: agree one by one | M2 → M3 → M4 → M5 → M6 → M7 → M8 |

---

## 16. What the backend needs

### 16.1 Keep
Calls start / answer / end / add person, ring timeout, settle, `CALL_EVENT`, webhooks, push (Firebase + Apple VoIP),
shop and work calls, meetings create / join / links / roles / end / cancel / edit, the schedule job.

### 16.2 Change (fields only added)
| What | Change |
|---|---|
| `POST /calls` | + `inviteeAccountIds` (C2) |
| Group call join | any group member while there's room (C3) |
| Add person | any call, anyone in it (C4) |
| `CallResponse` | + `title`, `scheduledAt`, `endsAt`, `access`, `myRole` for meetings (C10, P6) |
| Missed-call notice | + `actions` (C7) |
| Second 1:1 call | rings with `waiting: true` instead of BUSY (C8) |
| Limits | from admin settings (C5, M8) |
| Meeting create | + `mode` (`NOW` / `LINK` / `SCHEDULED`, §7.2a): `NOW` returns link + host token, `LINK` has no time and no invites (30 days); empty title allowed for `NOW` / `LINK`; + optional `coverMediaId` (banner, §5b; also in Edit); no audio / video choice: always camera-capable (`kind` accepted, ignored; §5a); invitees become **invites** (waiting) instead of participants; + `guestsCanInvite`, `guestsSeeInvited`, `linkJoinsStraightIn`, `whoCanAskToSpeak`, `inviteChatId` (whole group chat) |

### 16.3 New
| Topic | Endpoints / pieces |
|---|---|
| Invites | answer (accept / no thanks), my invites list, add / withdraw / remove, grouped answers to the host, "Who can invite me" (shared with live, Q1), 20 a day |
| My meetings | `GET /meetings/mine`, Calls tab upcoming, reminders 24 h / 15 min (live `ReminderLead`) |
| Roles | `CO_HOST`; requests list; mute (server), back to listener, remove + block |
| Waiting room and locks | ask to join, admit / deny / admit all, locks, lock meeting |
| In-room tools | `SendData` in `LiveKitClient`; pins, polls, questions, chat, reactions, gifts, selling (API in → check → `SendData`) |
| Calls | "Who can call me" (C6); running call on the conversation (C3) |
| Notifications (workbook) | meeting invite answered (grouped), removed, invite withdrawn, reminder 24 h / 15 min, host get ready, joined by your link, waiting room knock (to host), call waiting |

---

## 17. Sources (read 2026-11-24)

- WhatsApp: [new ways to plan ahead and take part](https://blog.whatsapp.com/calling-on-whatsapp-new-ways-to-plan-ahead-and-take-part),
  [Engadget: schedule group calls](https://www.engadget.com/social-media/whatsapp-now-lets-you-schedule-group-calls-155001583.html),
  [The National: scheduling, reactions, raise hand](https://www.thenationalnews.com/future/technology/2025/08/15/whatsapp/)
- Google Meet: [up to 25 co-hosts](https://workspaceupdates.googleblog.com/2021/08/add-up-to-25-cohosts-expanded-safety-features-for-meet.html),
  [host controls](https://support.google.com/meet/answer/10885841),
  [lock audio and video](https://support.google.com/meet/answer/11274707)
- Google Calendar: [what others can do](https://support.google.com/calendar/answer/15716974),
  [track responses](https://support.google.com/calendar/answer/16713792),
  [invite groups](https://support.google.com/calendar/answer/172013?hl=en)
- Zoom: [meeting security (Illinois)](https://answers.illinois.edu/128366),
  [waiting room and passcode (Duke)](https://oit.duke.edu/help/articles/kb0033551/),
  [passcode shown after registration](https://community.zoom.com/t5/Meetings/How-can-I-protect-passcode-when-using-Auto-Approval-Registration/m-p/34895),
  [API security options](https://developers.zoom.us/docs/api/references/meeting-api-security-enhancements/)
- Telegram, Teams: from what we know, not re-read.
- NexGate code and staging (2026-11-24): `chat_system/calls_mng`, `chat_system/livekit`, notification server push,
  staging `calls` / `call_participants` tables and notification server logs.

---

## Change log

| Version | Date | What |
|---|---|---|
| 0.1 | 2026-11-24 | First write-up: today's calls and meetings, staging numbers, the seven fixes built today (P1, P2, P5, P7, P8, BUSY, left time), real-time pipes (LiveKit in the room, `SendData` from the backend; Centrifugo only for live viewers), calls C1 done and C2–C10, tools in calls, meetings as a private live with the live tools, M1 invites (I1–I7 agreed, research on Google, Zoom, Teams, WhatsApp), M2–M8 proposed, open questions Q1–Q4, backend list |
| 0.2 | 2026-11-24 | §5a a meeting is a meeting: no Video / Audio choice, everyone switches their own camera and mic, `kind` ignored for meetings; §7.2a the create form drawing |
| 0.3 | 2026-11-24 | §5b optional banner (`coverMediaId`, like the live banner; where it shows; plain card without one); form updated |
| 0.4 | 2026-11-24 | §7.2a three ways to create (⚡ Start now, 🔗 Link for later = just a link, 📅 Schedule = the full form), Google Meet comparison, `mode` on create |