CUPLAJ

CUPLAJ protocol (v1)

Documentation language: English only (the app UI, README and user guide are available in 8 languages).

Transport

Handshake

Client → hub: {"t":"hello","id":<device id>,"name":…,"role":"spectator|actor|regie","pin":…,"room":…,"tok":<session token>}

Hub → client: {"t":"welcome","number":…,"group":…,"tok":…,"hub":…} or {"t":"denied","why":"bad_room|bad_pin|dup|full"} followed by close.

Client → hub messages

t Fields Meaning
offhook / onhook   lift / replace the handset
dial number place a call (also used while on a party line)
answer   answer a ringing call
hangup   end the call (same effect as onhook)
intervene on a listener starts/stops speaking into the call
msg to, text message to a target
cue to, kind, text control only — send a cue
monitor number control only — silent listening
couple / uncouple / autocouple a,b / id control only — party‑line management
setnum / setgroup / mute / forget id, … control only
opt listen, click, peerMsg control only — global options
peers / getlog   control only — request roster / event log
stat bat battery level (every 60 s)

Targets (to): all, staff, spectators, actors, num:<number>, id:<device id>, grp:<group>.

Cue kinds: text, vibrate, ring, flash, speaker, era, contact, say, sound, blackout, fakecall. Non‑control senders are ignored for cue.

Hub → client messages

welcome, denied, line (line, slot, partner), peers (roster for the control), log (event line for the control), msg, cue, dialtone, ringback, busy, unknown, ring (num, name, pat 0 1, party), stopring, connected (peer, name, forNum), listening, ended (why: hangup, rejected, noanswer, …), click.

Party‑line rules

  1. A coupled pair shares line N with slots 0 and 1; each subscriber keeps their own number.
  2. A call to number X rings X and, if idle, X’s neighbour; the ring pattern follows the called number’s slot (pat 0 = one long ring, 1 = two short).
  3. Whoever sends answer takes the call (forNum tells them which number was called); the other ring stops (stopring).
  4. While one subscriber is in a call, the neighbour’s offhook makes them a listener (listening); parties receive a click if enabled.
  5. A listener may intervene; their audio is mixed to both parties.
  6. A call to a number whose line is in use gets busy. An unanswered call ends after 40 s (ended/noanswer).
  7. The control may monitor any number: it listens without a click.

Limits

Security model

Plain TCP on a trusted local network. The room code and PIN are access gates, not cryptography; the session token prevents identity takeover. Do not run the hub on an untrusted network.