voice_calls.proto 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. syntax = "proto3";
  2. package chatto.api.v1;
  3. import "buf/validate/validate.proto";
  4. import "chatto/api/v1/rooms.proto";
  5. import "chatto/api/v1/users.proto";
  6. import "google/protobuf/timestamp.proto";
  7. // Voice-call request/response APIs backed by Chatto call-state projections.
  8. service VoiceCallService {
  9. // Lists member rooms that currently have active calls as a finite
  10. // runtime snapshot. Rooms the caller is not a member of are omitted.
  11. //
  12. // Returns an empty list when LiveKit is not configured.
  13. rpc ListActiveCalls(ListActiveCallsRequest) returns (ListActiveCallsResponse);
  14. // Gets the current active call snapshot for one room.
  15. //
  16. // The caller must be a member of the room. Returns NOT_FOUND when the room
  17. // does not exist, currently has no active call, or voice calls are not
  18. // configured. The returned call_id lets clients ignore stale realtime call
  19. // events from previous calls in the same room.
  20. rpc GetActiveCall(GetActiveCallRequest) returns (GetActiveCallResponse);
  21. // Gets current active call snapshots for many rooms.
  22. //
  23. // Rooms that do not exist, are inaccessible, or currently have no active call
  24. // are omitted. Results preserve first-seen request order and repeated room
  25. // IDs are de-duplicated. Returns an empty list when LiveKit is not configured.
  26. rpc BatchGetActiveCalls(BatchGetActiveCallsRequest) returns (BatchGetActiveCallsResponse);
  27. // Lists participants currently observed in a room's active call as a finite
  28. // runtime snapshot.
  29. //
  30. // The caller must be a member of the room.
  31. // Returns NOT_FOUND when the room does not exist and PERMISSION_DENIED when
  32. // the caller is not a room member.
  33. rpc ListCallParticipants(ListCallParticipantsRequest) returns (ListCallParticipantsResponse);
  34. // Records the caller's intent to join a room call.
  35. //
  36. // Returns joined=false when LiveKit is not configured.
  37. rpc JoinCall(JoinCallRequest) returns (JoinCallResponse);
  38. // Issues a LiveKit token for joining the room's active call.
  39. //
  40. // The caller must be a member of the room and a call must already be active.
  41. // Returns NOT_FOUND when the room does not exist, PERMISSION_DENIED when the
  42. // caller is not a room member, and FAILED_PRECONDITION when no call is active
  43. // or voice and video calls are not configured.
  44. rpc GetCallToken(GetCallTokenRequest) returns (GetCallTokenResponse);
  45. // Issues a short-lived LiveKit token for a native companion publisher owned
  46. // by the caller. Companion publishers contribute media to the caller's
  47. // logical participant without becoming call participants themselves.
  48. //
  49. // The caller must already participate in the active call. Returns
  50. // FAILED_PRECONDITION when no call is active, the caller has not joined it,
  51. // or voice and video calls are not configured.
  52. rpc CreateCallMediaPublisherToken(CreateCallMediaPublisherTokenRequest) returns (CreateCallMediaPublisherTokenResponse);
  53. // Records the caller's intent to leave a room call.
  54. //
  55. // Returns left=false when LiveKit is not configured.
  56. rpc LeaveCall(LeaveCallRequest) returns (LeaveCallResponse);
  57. }
  58. // Request for active room call snapshots.
  59. message ListActiveCallsRequest {}
  60. // Finite runtime snapshot of active room calls.
  61. message ListActiveCallsResponse {
  62. // Active calls in room order returned by the call-state projection.
  63. repeated ActiveCall calls = 1;
  64. }
  65. // Current active call snapshot for one room.
  66. message ActiveCall {
  67. reserved 1;
  68. reserved "room_id";
  69. // Room containing the active call.
  70. RoomSummary room = 4;
  71. // Active call session ID.
  72. string call_id = 2;
  73. // Participants currently projected for this call.
  74. repeated CallParticipant participants = 3;
  75. }
  76. // Request for one room's active call snapshot.
  77. message GetActiveCallRequest {
  78. // Required. Room whose active call should be inspected.
  79. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  80. }
  81. // Response for one room's active call snapshot.
  82. message GetActiveCallResponse {
  83. // Current active call.
  84. ActiveCall call = 1;
  85. }
  86. // Request active call snapshots for many rooms.
  87. message BatchGetActiveCallsRequest {
  88. // Required room IDs. Unknown, inaccessible, and inactive rooms are omitted.
  89. repeated string room_ids = 1 [(buf.validate.field).repeated = {
  90. min_items: 1
  91. max_items: 100
  92. items: {
  93. string: {min_len: 1}
  94. }
  95. }];
  96. }
  97. // Active call batch response.
  98. message BatchGetActiveCallsResponse {
  99. // Active calls in first-seen request order.
  100. repeated ActiveCall calls = 1;
  101. }
  102. // Request for participants in a room call.
  103. message ListCallParticipantsRequest {
  104. // Required. Room whose active call should be inspected.
  105. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  106. }
  107. // Finite runtime snapshot of participants in one room call.
  108. message ListCallParticipantsResponse {
  109. // Participants currently projected for the room call.
  110. repeated CallParticipant participants = 1;
  111. }
  112. // User currently participating in a room call.
  113. message CallParticipant {
  114. // Participant user.
  115. User user = 1;
  116. // When the user joined this call.
  117. google.protobuf.Timestamp joined_at = 2;
  118. // Active call session ID.
  119. string call_id = 3;
  120. }
  121. // Request to record joining a room call.
  122. message JoinCallRequest {
  123. // Required. Room whose call is being joined.
  124. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  125. }
  126. // Response from recording a join intent.
  127. message JoinCallResponse {
  128. // True when a join fact was recorded.
  129. bool joined = 1;
  130. }
  131. // Request for a LiveKit token for a room call.
  132. message GetCallTokenRequest {
  133. // Required. Room whose active call should be joined.
  134. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  135. }
  136. // LiveKit token details for joining a room call.
  137. message GetCallTokenResponse {
  138. // LiveKit JWT token.
  139. string token = 1;
  140. // Shared E2EE key for this active call.
  141. string e2ee_key = 2;
  142. // Active call session ID.
  143. string call_id = 3;
  144. }
  145. // Native companion publisher kind.
  146. enum CallMediaPublisherKind {
  147. // The publisher kind was not specified.
  148. CALL_MEDIA_PUBLISHER_KIND_UNSPECIFIED = 0;
  149. // Native game-window video and application audio.
  150. CALL_MEDIA_PUBLISHER_KIND_GAME_SHARE = 1;
  151. }
  152. // Request for a native companion publisher credential.
  153. message CreateCallMediaPublisherTokenRequest {
  154. // Required. Room whose active call receives the media.
  155. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  156. // Required. Kind of native media publisher being started.
  157. CallMediaPublisherKind kind = 2 [(buf.validate.field).enum = {defined_only: true not_in: [0]}];
  158. }
  159. // Credential for one native companion publisher connection.
  160. message CreateCallMediaPublisherTokenResponse {
  161. reserved 4;
  162. reserved "publisher_identity";
  163. // Short-lived LiveKit JWT token.
  164. string token = 1;
  165. // Shared E2EE key for this active call.
  166. string e2ee_key = 2;
  167. // Active call session ID.
  168. string call_id = 3;
  169. }
  170. // Request to record leaving a room call.
  171. message LeaveCallRequest {
  172. // Required. Room whose call is being left.
  173. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  174. }
  175. // Response from recording a leave intent.
  176. message LeaveCallResponse {
  177. // True when a leave fact was recorded.
  178. bool left = 1;
  179. }