voice_calls.proto 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. // Records the caller's intent to leave a room call.
  46. //
  47. // Returns left=false when LiveKit is not configured.
  48. rpc LeaveCall(LeaveCallRequest) returns (LeaveCallResponse);
  49. }
  50. // Request for active room call snapshots.
  51. message ListActiveCallsRequest {}
  52. // Finite runtime snapshot of active room calls.
  53. message ListActiveCallsResponse {
  54. // Active calls in room order returned by the call-state projection.
  55. repeated ActiveCall calls = 1;
  56. }
  57. // Current active call snapshot for one room.
  58. message ActiveCall {
  59. reserved 1;
  60. reserved "room_id";
  61. // Room containing the active call.
  62. RoomSummary room = 4;
  63. // Active call session ID.
  64. string call_id = 2;
  65. // Participants currently projected for this call.
  66. repeated CallParticipant participants = 3;
  67. }
  68. // Request for one room's active call snapshot.
  69. message GetActiveCallRequest {
  70. // Required. Room whose active call should be inspected.
  71. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  72. }
  73. // Response for one room's active call snapshot.
  74. message GetActiveCallResponse {
  75. // Current active call.
  76. ActiveCall call = 1;
  77. }
  78. // Request active call snapshots for many rooms.
  79. message BatchGetActiveCallsRequest {
  80. // Required room IDs. Unknown, inaccessible, and inactive rooms are omitted.
  81. repeated string room_ids = 1 [(buf.validate.field).repeated = {
  82. min_items: 1
  83. max_items: 100
  84. items: {
  85. string: {min_len: 1}
  86. }
  87. }];
  88. }
  89. // Active call batch response.
  90. message BatchGetActiveCallsResponse {
  91. // Active calls in first-seen request order.
  92. repeated ActiveCall calls = 1;
  93. }
  94. // Request for participants in a room call.
  95. message ListCallParticipantsRequest {
  96. // Required. Room whose active call should be inspected.
  97. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  98. }
  99. // Finite runtime snapshot of participants in one room call.
  100. message ListCallParticipantsResponse {
  101. // Participants currently projected for the room call.
  102. repeated CallParticipant participants = 1;
  103. }
  104. // User currently participating in a room call.
  105. message CallParticipant {
  106. // Participant user.
  107. User user = 1;
  108. // When the user joined this call.
  109. google.protobuf.Timestamp joined_at = 2;
  110. // Active call session ID.
  111. string call_id = 3;
  112. }
  113. // Request to record joining a room call.
  114. message JoinCallRequest {
  115. // Required. Room whose call is being joined.
  116. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  117. }
  118. // Response from recording a join intent.
  119. message JoinCallResponse {
  120. // True when a join fact was recorded.
  121. bool joined = 1;
  122. }
  123. // Request for a LiveKit token for a room call.
  124. message GetCallTokenRequest {
  125. // Required. Room whose active call should be joined.
  126. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  127. }
  128. // LiveKit token details for joining a room call.
  129. message GetCallTokenResponse {
  130. // LiveKit JWT token.
  131. string token = 1;
  132. // Shared E2EE key for this active call.
  133. string e2ee_key = 2;
  134. // Active call session ID.
  135. string call_id = 3;
  136. }
  137. // Request to record leaving a room call.
  138. message LeaveCallRequest {
  139. // Required. Room whose call is being left.
  140. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  141. }
  142. // Response from recording a leave intent.
  143. message LeaveCallResponse {
  144. // True when a leave fact was recorded.
  145. bool left = 1;
  146. }