Chatto.Api.V1.VoiceCallService (chatto v0.1.0)

Copy Markdown View Source

Room-scoped voice and video calls.

Summary

Functions

Gets current active call snapshots for many rooms.

Issues a short-lived LiveKit token for a native companion publisher owned by the caller. Companion publishers contribute media to the caller's logical participant without becoming call participants themselves.

Issues a LiveKit token for joining the room's active call.

Gets the current active call snapshot for one room.

Records the caller's intent to join a room call.

Records the caller's intent to leave a room call.

Lists member rooms that currently have active calls as a finite runtime snapshot. Rooms the caller is not a member of are omitted.

Lists participants currently observed in a room's active call as a finite runtime snapshot.

Functions

batch_get_active_calls(client, request)

@spec batch_get_active_calls(
  Req.Request.t(),
  Chatto.Api.V1.BatchGetActiveCallsRequest.t()
) ::
  {:ok, Chatto.Api.V1.BatchGetActiveCallsResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Gets current active call snapshots for many rooms.

Rooms that do not exist, are inaccessible, or currently have no active call are omitted. Results preserve first-seen request order and repeated room IDs are de-duplicated. Returns an empty list when LiveKit is not configured.

create_call_media_publisher_token(client, request)

@spec create_call_media_publisher_token(
  Req.Request.t(),
  Chatto.Api.V1.CreateCallMediaPublisherTokenRequest.t()
) ::
  {:ok, Chatto.Api.V1.CreateCallMediaPublisherTokenResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Issues a short-lived LiveKit token for a native companion publisher owned by the caller. Companion publishers contribute media to the caller's logical participant without becoming call participants themselves.

Requires room membership, call.join, call.screenshare, and participation in the active call. Captured application audio does not need call.voice. The credential expires after one minute; an established publisher is checked by the same permission reconciliation as the main participant. Returns FAILED_PRECONDITION when no call is active, the caller has not joined it, or voice and video calls are not configured.

create_call_token(client, request)

@spec create_call_token(Req.Request.t(), Chatto.Api.V1.CreateCallTokenRequest.t()) ::
  {:ok, Chatto.Api.V1.CreateCallTokenResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Issues a LiveKit token for joining the room's active call.

Requires room membership and call.join. A call must already be active. On a server with a participant limit, this request also reserves a place in the call. It returns RESOURCE_EXHAUSTED if the call needs a new place and the server is full. The token permits microphone, camera, and screen-share sources only when call.voice, call.camera, and call.screenshare respectively allow them. A caller without publishing permissions can listen and watch. Tokens expire after five minutes. Expiry does not end an established call. Chatto checks connected participant permissions on its 30-second LiveKit reconciliation cycle. Failed checks retry on subsequent cycles. Returns NOT_FOUND when the room does not exist, PERMISSION_DENIED when the caller is not a room member, and FAILED_PRECONDITION when no call is active or voice and video calls are not configured.

get_active_call(client, request)

@spec get_active_call(Req.Request.t(), Chatto.Api.V1.GetActiveCallRequest.t()) ::
  {:ok, Chatto.Api.V1.GetActiveCallResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Gets the current active call snapshot for one room.

The caller must be a member of the room. Returns NOT_FOUND when the room does not exist, currently has no active call, or voice calls are not configured. The returned call_id lets clients ignore stale realtime call events from previous calls in the same room.

join_call(client, request)

@spec join_call(Req.Request.t(), Chatto.Api.V1.JoinCallRequest.t()) ::
  {:ok, Chatto.Api.V1.JoinCallResponse.t()} | {:error, Chatto.Connect.Error.t()}

Records the caller's intent to join a room call.

Requires room membership and call.join. If no call is active, also requires call.start. Publishing permissions do not grant admission.

Returns RESOURCE_EXHAUSTED if a new participant would exceed the server limit. Returns joined=false when LiveKit is not configured.

leave_call(client, request)

@spec leave_call(Req.Request.t(), Chatto.Api.V1.LeaveCallRequest.t()) ::
  {:ok, Chatto.Api.V1.LeaveCallResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Records the caller's intent to leave a room call.

Requires room membership, but not call.join or a publishing permission.

Returns left=false when LiveKit is not configured.

list_active_calls(client, request)

@spec list_active_calls(Req.Request.t(), Chatto.Api.V1.ListActiveCallsRequest.t()) ::
  {:ok, Chatto.Api.V1.ListActiveCallsResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Lists member rooms that currently have active calls as a finite runtime snapshot. Rooms the caller is not a member of are omitted.

Returns an empty list when LiveKit is not configured.

list_call_participants(client, request)

@spec list_call_participants(
  Req.Request.t(),
  Chatto.Api.V1.ListCallParticipantsRequest.t()
) ::
  {:ok, Chatto.Api.V1.ListCallParticipantsResponse.t()}
  | {:error, Chatto.Connect.Error.t()}

Lists participants currently observed in a room's active call as a finite runtime snapshot.

The caller must be a member of the room. Returns NOT_FOUND when the room does not exist and PERMISSION_DENIED when the caller is not a room member.