YACS

Calls

YACS supports voice and video calls over WebRTC, using PeerJS with the signalling server built into the API.

Call flow

  1. The caller starts a call with POST /api/conversations/:conversation/call. The server creates a call message and rings the other participants (CallEvent.MAKE over Socket.IO, plus a push notification).
  2. A call rings for up to 45 seconds. If the callee's device connects while it's still ringing, it receives the call right away.
  3. The callee answers (CallEvent.ANSWER) or rejects (POST /api/calls/:message/reject). Users already on another call are reported as busy.
  4. Either side hangs up with CallEvent.DISCONNECT.

The call message is updated as the call progresses, so the conversation keeps a call history: completed, declined or missed, with duration.

While a call is active the app keeps the screen awake (Wake Lock API) and plays a ringtone for incoming calls.

ICE servers

The client fetches ICE servers from GET /api/calls/ice-servers before each call:

  • Google public STUN servers are always included.
  • If TURN_URLS and TURN_SECRET are configured, a TURN entry is added with time-limited credentials: the username is <expiry-unix-time>:<user-id> and the credential is base64(HMAC-SHA1(TURN_SECRET, username)) — the coturn REST-API scheme.

The response is marked no-store so credentials are never cached.

See Self-hosting → TURN for setup.