diff --git a/livekit-ffi/protocol/audio_frame.proto b/livekit-ffi/protocol/audio_frame.proto index e5bccc27..d10f3a38 100644 --- a/livekit-ffi/protocol/audio_frame.proto +++ b/livekit-ffi/protocol/audio_frame.proto @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; @@ -23,106 +23,109 @@ import "track.proto"; // Create a new AudioStream // AudioStream is used to receive audio frames from a track message NewAudioStreamRequest { - uint64 track_handle = 1; - AudioStreamType type = 2; - uint32 sample_rate = 3; - uint32 num_channels = 4; + required uint64 track_handle = 1; + required AudioStreamType type = 2; + required uint32 sample_rate = 3; + required uint32 num_channels = 4; } -message NewAudioStreamResponse { OwnedAudioStream stream = 1; } +message NewAudioStreamResponse { required OwnedAudioStream stream = 1; } message AudioStreamFromParticipantRequest { - uint64 participant_handle = 1; - AudioStreamType type = 2; + required uint64 participant_handle = 1; + required AudioStreamType type = 2; optional TrackSource track_source = 3; - uint32 sample_rate = 5; - uint32 num_channels = 6; + required uint32 sample_rate = 5; + required uint32 num_channels = 6; } -message AudioStreamFromParticipantResponse { OwnedAudioStream stream = 1; } +message AudioStreamFromParticipantResponse { required OwnedAudioStream stream = 1; } // Create a new AudioSource message NewAudioSourceRequest { - AudioSourceType type = 1; + required AudioSourceType type = 1; optional AudioSourceOptions options = 2; - uint32 sample_rate = 3; - uint32 num_channels = 4; - uint32 queue_size_ms = 5; + required uint32 sample_rate = 3; + required uint32 num_channels = 4; + required uint32 queue_size_ms = 5; } -message NewAudioSourceResponse { OwnedAudioSource source = 1; } +message NewAudioSourceResponse { required OwnedAudioSource source = 1; } // Push a frame to an AudioSource // The data provided must be available as long as the client receive the callback. message CaptureAudioFrameRequest { - uint64 source_handle = 1; - AudioFrameBufferInfo buffer = 2; + required uint64 source_handle = 1; + required AudioFrameBufferInfo buffer = 2; } message CaptureAudioFrameResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message CaptureAudioFrameCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; } message ClearAudioBufferRequest { - uint64 source_handle = 1; + required uint64 source_handle = 1; } message ClearAudioBufferResponse {} // Create a new AudioResampler message NewAudioResamplerRequest {} message NewAudioResamplerResponse { - OwnedAudioResampler resampler = 1; + required OwnedAudioResampler resampler = 1; } // Remix and resample an audio frame message RemixAndResampleRequest { - uint64 resampler_handle = 1; - AudioFrameBufferInfo buffer = 2; - uint32 num_channels = 3; - uint32 sample_rate = 4; + required uint64 resampler_handle = 1; + required AudioFrameBufferInfo buffer = 2; + required uint32 num_channels = 3; + required uint32 sample_rate = 4; } message RemixAndResampleResponse { - OwnedAudioFrameBuffer buffer = 1; + required OwnedAudioFrameBuffer buffer = 1; } // New resampler using SoX (much better quality) message NewSoxResamplerRequest { - double input_rate = 1; - double output_rate = 2; - uint32 num_channels = 3; - SoxResamplerDataType input_data_type = 4; - SoxResamplerDataType output_data_type = 5; - SoxQualityRecipe quality_recipe = 6; - uint32 flags = 7; + required double input_rate = 1; + required double output_rate = 2; + required uint32 num_channels = 3; + required SoxResamplerDataType input_data_type = 4; + required SoxResamplerDataType output_data_type = 5; + required SoxQualityRecipe quality_recipe = 6; + required uint32 flags = 7; } message NewSoxResamplerResponse { - OwnedSoxResampler resampler = 1; - optional string error = 2; + oneof message { + OwnedSoxResampler resampler = 1; + string error = 2; + } + } message PushSoxResamplerRequest { - uint64 resampler_handle = 1; - uint64 data_ptr = 2; // *const i16 - uint32 size = 3; // in bytes + required uint64 resampler_handle = 1; + required uint64 data_ptr = 2; // *const i16 + required uint32 size = 3; // in bytes } message PushSoxResamplerResponse { - uint64 output_ptr = 1; // *const i16 (could be null) - uint32 size = 2; // in bytes + required uint64 output_ptr = 1; // *const i16 (could be null) + required uint32 size = 2; // in bytes optional string error = 3; } message FlushSoxResamplerRequest { - uint64 resampler_handle = 1; + required uint64 resampler_handle = 1; } message FlushSoxResamplerResponse { - uint64 output_ptr = 1; // *const i16 (could be null) - uint32 size = 2; // in bytes + required uint64 output_ptr = 1; // *const i16 (could be null) + required uint32 size = 2; // in bytes optional string error = 3; } @@ -156,15 +159,15 @@ enum SoxFlagBits { // message AudioFrameBufferInfo { - uint64 data_ptr = 1; // *const i16 - uint32 num_channels = 2; - uint32 sample_rate = 3; - uint32 samples_per_channel = 4; + required uint64 data_ptr = 1; // *const i16 + required uint32 num_channels = 2; + required uint32 sample_rate = 3; + required uint32 samples_per_channel = 4; } message OwnedAudioFrameBuffer { - FfiOwnedHandle handle = 1; - AudioFrameBufferInfo info = 2; + required FfiOwnedHandle handle = 1; + required AudioFrameBufferInfo info = 2; } // @@ -177,16 +180,16 @@ enum AudioStreamType { } message AudioStreamInfo { - AudioStreamType type = 1; + required AudioStreamType type = 1; } message OwnedAudioStream { - FfiOwnedHandle handle = 1; - AudioStreamInfo info = 2; + required FfiOwnedHandle handle = 1; + required AudioStreamInfo info = 2; } message AudioStreamEvent { - uint64 stream_handle = 1; + required uint64 stream_handle = 1; oneof message { AudioFrameReceived frame_received = 2; AudioStreamEOS eos = 3; @@ -194,7 +197,7 @@ message AudioStreamEvent { } message AudioFrameReceived { - OwnedAudioFrameBuffer frame = 1; + required OwnedAudioFrameBuffer frame = 1; } message AudioStreamEOS {} @@ -204,9 +207,9 @@ message AudioStreamEOS {} // message AudioSourceOptions { - bool echo_cancellation = 1; - bool noise_suppression = 2; - bool auto_gain_control = 3; + required bool echo_cancellation = 1; + required bool noise_suppression = 2; + required bool auto_gain_control = 3; } enum AudioSourceType { @@ -214,12 +217,12 @@ enum AudioSourceType { } message AudioSourceInfo { - AudioSourceType type = 2; + required AudioSourceType type = 2; } message OwnedAudioSource { - FfiOwnedHandle handle = 1; - AudioSourceInfo info = 2; + required FfiOwnedHandle handle = 1; + required AudioSourceInfo info = 2; } // @@ -229,8 +232,8 @@ message OwnedAudioSource { message AudioResamplerInfo { } message OwnedAudioResampler { - FfiOwnedHandle handle = 1; - AudioResamplerInfo info = 2; + required FfiOwnedHandle handle = 1; + required AudioResamplerInfo info = 2; } @@ -243,6 +246,6 @@ message OwnedAudioResampler { message SoxResamplerInfo {} message OwnedSoxResampler { - FfiOwnedHandle handle = 1; - SoxResamplerInfo info = 2; + required FfiOwnedHandle handle = 1; + required SoxResamplerInfo info = 2; } diff --git a/livekit-ffi/protocol/e2ee.proto b/livekit-ffi/protocol/e2ee.proto index 39f142bb..bdc20140 100644 --- a/livekit-ffi/protocol/e2ee.proto +++ b/livekit-ffi/protocol/e2ee.proto @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; @@ -26,23 +26,23 @@ enum EncryptionType { } message FrameCryptor { - string participant_identity = 1; - string track_sid = 2; - int32 key_index = 3; - bool enabled = 4; + required string participant_identity = 1; + required string track_sid = 2; + required int32 key_index = 3; + required bool enabled = 4; } message KeyProviderOptions { // Only specify if you want to use a shared_key optional bytes shared_key = 1; - int32 ratchet_window_size = 2; - bytes ratchet_salt = 3; - int32 failure_tolerance = 4; // -1 = no tolerence + required int32 ratchet_window_size = 2; + required bytes ratchet_salt = 3; + required int32 failure_tolerance = 4; // -1 = no tolerance } message E2eeOptions { - EncryptionType encryption_type = 1; - KeyProviderOptions key_provider_options = 2; + required EncryptionType encryption_type = 1; + required KeyProviderOptions key_provider_options = 2; } enum EncryptionState { @@ -56,7 +56,7 @@ enum EncryptionState { } message E2eeManagerSetEnabledRequest { - bool enabled = 1; + required bool enabled = 1; } message E2eeManagerSetEnabledResponse {} @@ -66,64 +66,64 @@ message E2eeManagerGetFrameCryptorsResponse { } message FrameCryptorSetEnabledRequest { - string participant_identity = 1; - string track_sid = 2; - bool enabled = 3; + required string participant_identity = 1; + required string track_sid = 2; + required bool enabled = 3; } -message FrameCryptorSetEnabledResponse { } +message FrameCryptorSetEnabledResponse {} message FrameCryptorSetKeyIndexRequest { - string participant_identity = 1; - string track_sid = 2; - int32 key_index = 3; + required string participant_identity = 1; + required string track_sid = 2; + required int32 key_index = 3; } -message FrameCryptorSetKeyIndexResponse { } +message FrameCryptorSetKeyIndexResponse {} message SetSharedKeyRequest { - bytes shared_key = 1; - int32 key_index = 2; + required bytes shared_key = 1; + required int32 key_index = 2; } -message SetSharedKeyResponse { } +message SetSharedKeyResponse {} message RatchetSharedKeyRequest { - int32 key_index = 1; + required int32 key_index = 1; } message RatchetSharedKeyResponse { optional bytes new_key = 1; } message GetSharedKeyRequest { - int32 key_index = 1; + required int32 key_index = 1; } message GetSharedKeyResponse { optional bytes key = 1; } message SetKeyRequest { - string participant_identity = 1; - bytes key = 2; - int32 key_index = 3; + required string participant_identity = 1; + required bytes key = 2; + required int32 key_index = 3; } message SetKeyResponse {} message RatchetKeyRequest { - string participant_identity = 1; - int32 key_index = 2; + required string participant_identity = 1; + required int32 key_index = 2; } message RatchetKeyResponse { optional bytes new_key = 1; } message GetKeyRequest { - string participant_identity = 1; - int32 key_index = 2; + required string participant_identity = 1; + required int32 key_index = 2; } message GetKeyResponse { optional bytes key = 1; } message E2eeRequest { - uint64 room_handle = 1; + required uint64 room_handle = 1; oneof message { E2eeManagerSetEnabledRequest manager_set_enabled = 2; E2eeManagerGetFrameCryptorsRequest manager_get_frame_cryptors = 3; diff --git a/livekit-ffi/protocol/ffi.proto b/livekit-ffi/protocol/ffi.proto index fed3c991..5a751798 100644 --- a/livekit-ffi/protocol/ffi.proto +++ b/livekit-ffi/protocol/ffi.proto @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; @@ -201,14 +201,14 @@ message FfiEvent { // e.g: This is used for the Unity Editor after each assemblies reload. // TODO(theomonnom): Implement a debug mode where we can find all leaked handles? message DisposeRequest { - bool async = 1; + required bool async = 1; } message DisposeResponse { optional uint64 async_id = 1; // None if sync } message DisposeCallback { - uint64 async_id = 1; + required uint64 async_id = 1; } enum LogLevel { @@ -220,12 +220,12 @@ enum LogLevel { } message LogRecord { - LogLevel level = 1; - string target = 2; // e.g "livekit", "libwebrtc", "tokio-tungstenite", etc... + required LogLevel level = 1; + required string target = 2; // e.g "livekit", "libwebrtc", "tokio-tungstenite", etc... optional string module_path = 3; optional string file = 4; optional uint32 line = 5; - string message = 6; + required string message = 6; } message LogBatch { @@ -233,7 +233,7 @@ message LogBatch { } message Panic { - string message = 1; + required string message = 1; } // TODO(theomonnom): Debug messages (Print handles). diff --git a/livekit-ffi/protocol/handle.proto b/livekit-ffi/protocol/handle.proto index f86ee9d3..90c74671 100644 --- a/livekit-ffi/protocol/handle.proto +++ b/livekit-ffi/protocol/handle.proto @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; @@ -27,5 +27,5 @@ option csharp_namespace = "LiveKit.Proto"; // When refering to a handle without owning it, we just use a uint32 without this message. // (the variable name is suffixed with "_handle") message FfiOwnedHandle { - uint64 id = 1; + required uint64 id = 1; } diff --git a/livekit-ffi/protocol/participant.proto b/livekit-ffi/protocol/participant.proto index a089d86e..c0a480f2 100644 --- a/livekit-ffi/protocol/participant.proto +++ b/livekit-ffi/protocol/participant.proto @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; @@ -20,17 +20,17 @@ option csharp_namespace = "LiveKit.Proto"; import "handle.proto"; message ParticipantInfo { - string sid = 1; - string name = 2; - string identity = 3; - string metadata = 4; + required string sid = 1; + required string name = 2; + required string identity = 3; + required string metadata = 4; map attributes = 5; - ParticipantKind kind = 6; + required ParticipantKind kind = 6; } message OwnedParticipant { - FfiOwnedHandle handle = 1; - ParticipantInfo info = 2; + required FfiOwnedHandle handle = 1; + required ParticipantInfo info = 2; } enum ParticipantKind { diff --git a/livekit-ffi/protocol/room.proto b/livekit-ffi/protocol/room.proto index 6c46e6d9..b2b295d0 100644 --- a/livekit-ffi/protocol/room.proto +++ b/livekit-ffi/protocol/room.proto @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; @@ -26,190 +26,215 @@ import "stats.proto"; // Connect to a new LiveKit room message ConnectRequest { - string url = 1; - string token = 2; - RoomOptions options = 3; + required string url = 1; + required string token = 2; + required RoomOptions options = 3; } message ConnectResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message ConnectCallback { message ParticipantWithTracks { - OwnedParticipant participant = 1; + required OwnedParticipant participant = 1; // TrackInfo are not needed here, if we're subscribed to a track, the FfiServer will send // a TrackSubscribed event repeated OwnedTrackPublication publications = 2; } - uint64 async_id = 1; - optional string error = 2; - OwnedRoom room = 3; - OwnedParticipant local_participant = 4; - repeated ParticipantWithTracks participants = 5; + message Result { + required OwnedRoom room = 1; + required OwnedParticipant local_participant = 2; + repeated ParticipantWithTracks participants = 3; + } + + required uint64 async_id = 1; + oneof message { + string error = 2; + Result result = 3; + } + } // Disconnect from the a room -message DisconnectRequest { uint64 room_handle = 1; } -message DisconnectResponse { uint64 async_id = 1; } -message DisconnectCallback { uint64 async_id = 1; } +message DisconnectRequest { required uint64 room_handle = 1; } +message DisconnectResponse { required uint64 async_id = 1; } +message DisconnectCallback { required uint64 async_id = 1; } // Publish a track to the room message PublishTrackRequest { - uint64 local_participant_handle = 1; - uint64 track_handle = 2; - TrackPublishOptions options = 3; + required uint64 local_participant_handle = 1; + required uint64 track_handle = 2; + required TrackPublishOptions options = 3; } message PublishTrackResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message PublishTrackCallback { - uint64 async_id = 1; - optional string error = 2; - OwnedTrackPublication publication = 3; + required uint64 async_id = 1; + oneof message { + string error = 2; + OwnedTrackPublication publication = 3; + } + } // Unpublish a track from the room message UnpublishTrackRequest { - uint64 local_participant_handle = 1; - string track_sid = 2; - bool stop_on_unpublish = 3; + required uint64 local_participant_handle = 1; + required string track_sid = 2; + required bool stop_on_unpublish = 3; } message UnpublishTrackResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message UnpublishTrackCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; } // Publish data to other participants message PublishDataRequest { - uint64 local_participant_handle = 1; - uint64 data_ptr = 2; - uint64 data_len = 3; - bool reliable = 4; + required uint64 local_participant_handle = 1; + required uint64 data_ptr = 2; + required uint64 data_len = 3; + required bool reliable = 4; repeated string destination_sids = 5 [deprecated=true]; optional string topic = 6; repeated string destination_identities = 7; } message PublishDataResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message PublishDataCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; } // Publish transcription messages to room message PublishTranscriptionRequest { - uint64 local_participant_handle = 1; - string participant_identity = 2; - string track_id = 3; + required uint64 local_participant_handle = 1; + required string participant_identity = 2; + required string track_id = 3; repeated TranscriptionSegment segments = 4; } message PublishTranscriptionResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message PublishTranscriptionCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; } // Publish Sip DTMF messages to other participants message PublishSipDtmfRequest { - uint64 local_participant_handle = 1; - uint32 code = 2; - string digit = 3; + required uint64 local_participant_handle = 1; + required uint32 code = 2; + required string digit = 3; repeated string destination_identities = 4; } message PublishSipDtmfResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message PublishSipDtmfCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; } // Change the local participant's metadata message SetLocalMetadataRequest { - uint64 local_participant_handle = 1; - string metadata = 2; + required uint64 local_participant_handle = 1; + required string metadata = 2; } message SetLocalMetadataResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message SetLocalMetadataCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; } message SendChatMessageRequest { - uint64 local_participant_handle = 1; - string message = 2; + required uint64 local_participant_handle = 1; + required string message = 2; repeated string destination_identities = 3; optional string sender_identity = 4; } message EditChatMessageRequest { - uint64 local_participant_handle = 1; - string edit_text = 2; - ChatMessage original_message = 3; + required uint64 local_participant_handle = 1; + required string edit_text = 2; + required ChatMessage original_message = 3; repeated string destination_identities = 4; optional string sender_identity = 5; } message SendChatMessageResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message SendChatMessageCallback { - uint64 async_id = 1; - optional string error = 2; - optional ChatMessage chat_message = 3; + required uint64 async_id = 1; + oneof message { + string error = 2; + ChatMessage chat_message = 3; + } } // Change the local participant's attributes message SetLocalAttributesRequest { - uint64 local_participant_handle = 1; - map attributes = 2; + required uint64 local_participant_handle = 1; + repeated AttributesEntry attributes = 2; } + +message AttributesEntry { + required string key = 1; + required string value = 2; +} + message SetLocalAttributesResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message SetLocalAttributesCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; } // Change the local participant's name message SetLocalNameRequest { - uint64 local_participant_handle = 1; - string name = 2; + required uint64 local_participant_handle = 1; + required string name = 2; } message SetLocalNameResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message SetLocalNameCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; } // Change the "desire" to subs2ribe to a track message SetSubscribedRequest { - bool subscribe = 1; - uint64 publication_handle = 2; + required bool subscribe = 1; + required uint64 publication_handle = 2; } message SetSubscribedResponse {} message GetSessionStatsRequest { - uint64 room_handle = 1; + required uint64 room_handle = 1; } message GetSessionStatsResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message GetSessionStatsCallback { - uint64 async_id = 1; - optional string error = 2; - repeated RtcStats publisher_stats = 3; - repeated RtcStats subscriber_stats = 4; + message Result { + repeated RtcStats publisher_stats = 1; + repeated RtcStats subscriber_stats = 2; + } + + required uint64 async_id = 1; + + oneof message { + string error = 2; + Result result = 3; + } } // @@ -217,24 +242,24 @@ message GetSessionStatsCallback { // message VideoEncoding { - uint64 max_bitrate = 1; - double max_framerate = 2; + required uint64 max_bitrate = 1; + required double max_framerate = 2; } message AudioEncoding { - uint64 max_bitrate = 1; + required uint64 max_bitrate = 1; } message TrackPublishOptions { // encodings are optional - VideoEncoding video_encoding = 1; - AudioEncoding audio_encoding = 2; - VideoCodec video_codec = 3; - bool dtx = 4; - bool red = 5; - bool simulcast = 6; - TrackSource source = 7; - string stream = 8; + optional VideoEncoding video_encoding = 1; + optional AudioEncoding audio_encoding = 2; + required VideoCodec video_codec = 3; + required bool dtx = 4; + required bool red = 5; + required bool simulcast = 6; + required TrackSource source = 7; + required string stream = 8; } enum IceTransportType { @@ -250,8 +275,8 @@ enum ContinualGatheringPolicy { message IceServer { repeated string urls = 1; - string username = 2; - string password = 3; + optional string username = 2; + optional string password = 3; } message RtcConfig { @@ -261,12 +286,12 @@ message RtcConfig { } message RoomOptions { - bool auto_subscribe = 1; - bool adaptive_stream = 2; - bool dynacast = 3; + required bool auto_subscribe = 1; + required bool adaptive_stream = 2; + required bool dynacast = 3; optional E2eeOptions e2ee = 4; optional RtcConfig rtc_config = 5; // allow to setup a custom RtcConfiguration - uint32 join_retries = 6; + required uint32 join_retries = 6; } // @@ -316,26 +341,26 @@ enum DisconnectReason { } message TranscriptionSegment { - string id = 1; - string text = 2; - uint64 start_time = 3; - uint64 end_time = 4; - bool final = 5; - string language = 6; + required string id = 1; + required string text = 2; + required uint64 start_time = 3; + required uint64 end_time = 4; + required bool final = 5; + required string language = 6; } message BufferInfo { - uint64 data_ptr = 1; - uint64 data_len = 2; + required uint64 data_ptr = 1; + required uint64 data_len = 2; } message OwnedBuffer { - FfiOwnedHandle handle = 1; - BufferInfo data = 2; + required FfiOwnedHandle handle = 1; + required BufferInfo data = 2; } message RoomEvent { - uint64 room_handle = 1; + required uint64 room_handle = 1; oneof message { ParticipantConnected participant_connected = 2; ParticipantDisconnected participant_disconnected = 3; @@ -371,137 +396,137 @@ message RoomEvent { message RoomInfo { optional string sid = 1; - string name = 2; - string metadata = 3; + required string name = 2; + required string metadata = 3; } message OwnedRoom { - FfiOwnedHandle handle = 1; - RoomInfo info = 2; + required FfiOwnedHandle handle = 1; + required RoomInfo info = 2; } -message ParticipantConnected { OwnedParticipant info = 1; } +message ParticipantConnected { required OwnedParticipant info = 1; } message ParticipantDisconnected { - string participant_identity = 1; + required string participant_identity = 1; } message LocalTrackPublished { // The TrackPublicationInfo comes from the PublishTrack response // and the FfiClient musts wait for it before firing this event - string track_sid = 1; + required string track_sid = 1; } message LocalTrackUnpublished { - string publication_sid = 1; + required string publication_sid = 1; } message LocalTrackSubscribed { - string track_sid = 2; + required string track_sid = 2; } message TrackPublished { - string participant_identity = 1; - OwnedTrackPublication publication = 2; + required string participant_identity = 1; + required OwnedTrackPublication publication = 2; } message TrackUnpublished { - string participant_identity = 1; - string publication_sid = 2; + required string participant_identity = 1; + required string publication_sid = 2; } // Publication isn't needed for subscription events on the FFI // The FFI will retrieve the publication using the Track sid message TrackSubscribed { - string participant_identity = 1; - OwnedTrack track = 2; + required string participant_identity = 1; + required OwnedTrack track = 2; } message TrackUnsubscribed { // The FFI language can dispose/remove the VideoSink here - string participant_identity = 1; - string track_sid = 2; + required string participant_identity = 1; + required string track_sid = 2; } message TrackSubscriptionFailed { - string participant_identity = 1; - string track_sid = 2; - string error = 3; + required string participant_identity = 1; + required string track_sid = 2; + required string error = 3; } message TrackMuted { - string participant_identity = 1; - string track_sid = 2; + required string participant_identity = 1; + required string track_sid = 2; } message TrackUnmuted { - string participant_identity = 1; - string track_sid = 2; + required string participant_identity = 1; + required string track_sid = 2; } message E2eeStateChanged { - string participant_identity = 1; // Using sid instead of identity for ffi communication - EncryptionState state = 2; + required string participant_identity = 1; // Using sid instead of identity for ffi communication + required EncryptionState state = 2; } message ActiveSpeakersChanged { repeated string participant_identities = 1; } message RoomMetadataChanged { - string metadata = 1; + required string metadata = 1; } message RoomSidChanged { - string sid = 1; + required string sid = 1; } message ParticipantMetadataChanged { - string participant_identity = 1; - string metadata = 2; + required string participant_identity = 1; + required string metadata = 2; } message ParticipantAttributesChanged { - string participant_identity = 1; - map attributes = 2; - map changed_attributes = 3; + required string participant_identity = 1; + repeated AttributesEntry attributes = 2; + repeated AttributesEntry changed_attributes = 3; } message ParticipantNameChanged { - string participant_identity = 1; - string name = 2; + required string participant_identity = 1; + required string name = 2; } message ConnectionQualityChanged { - string participant_identity = 1; - ConnectionQuality quality = 2; + required string participant_identity = 1; + required ConnectionQuality quality = 2; } message UserPacket { - OwnedBuffer data = 1; + required OwnedBuffer data = 1; optional string topic = 2; } message ChatMessage { - string id = 1; - int64 timestamp = 2; - string message = 3; + required string id = 1; + required int64 timestamp = 2; + required string message = 3; optional int64 edit_timestamp = 4; optional bool deleted = 5; optional bool generated = 6; } message ChatMessageReceived { - ChatMessage message = 1; - string participant_identity = 2; + required ChatMessage message = 1; + required string participant_identity = 2; } message SipDTMF { - uint32 code = 1; + required uint32 code = 1; optional string digit = 2; } message DataPacketReceived { - DataPacketKind kind = 1; - string participant_identity = 2; // Can be empty if the data is sent a server SDK + required DataPacketKind kind = 1; + required string participant_identity = 2; // Can be empty if the data is sent a server SDK oneof value { UserPacket user = 4; SipDTMF sip_dtmf = 5; @@ -514,13 +539,14 @@ message TranscriptionReceived { repeated TranscriptionSegment segments = 3; } -message ConnectionStateChanged { ConnectionState state = 1; } +message ConnectionStateChanged { required ConnectionState state = 1; } message Connected {} message Disconnected { - DisconnectReason reason = 1; + required DisconnectReason reason = 1; } message Reconnecting {} message Reconnected {} message RoomEOS {} + diff --git a/livekit-ffi/protocol/rpc.proto b/livekit-ffi/protocol/rpc.proto index 7f2a8948..1502365c 100644 --- a/livekit-ffi/protocol/rpc.proto +++ b/livekit-ffi/protocol/rpc.proto @@ -12,87 +12,87 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; message RpcError { - uint32 code = 1; - string message = 2; + required uint32 code = 1; + required string message = 2; optional string data = 3; } // FFI Requests message PerformRpcRequest { - uint64 local_participant_handle = 1; - string destination_identity = 2; - string method = 3; - string payload = 4; + required uint64 local_participant_handle = 1; + required string destination_identity = 2; + required string method = 3; + required string payload = 4; optional uint32 response_timeout_ms = 5; } message RegisterRpcMethodRequest { - uint64 local_participant_handle = 1; - string method = 2; + required uint64 local_participant_handle = 1; + required string method = 2; } message UnregisterRpcMethodRequest { - uint64 local_participant_handle = 1; - string method = 2; + required uint64 local_participant_handle = 1; + required string method = 2; } message RpcMethodInvocationResponseRequest { - uint64 local_participant_handle = 1; - uint64 invocation_id = 2; + required uint64 local_participant_handle = 1; + required uint64 invocation_id = 2; optional string payload = 3; optional RpcError error = 4; } // FFI Responses message PerformRpcResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message RegisterRpcMethodResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message UnregisterRpcMethodResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message RpcMethodInvocationResponseResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } // FFI Callbacks message PerformRpcCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string payload = 2; optional RpcError error = 3; } message RegisterRpcMethodCallback { - uint64 async_id = 1; + required uint64 async_id = 1; } message UnregisterRpcMethodCallback { - uint64 async_id = 1; + required uint64 async_id = 1; } message RpcMethodInvocationResponseCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; } // FFI Events message RpcMethodInvocationEvent { - uint64 local_participant_handle = 1; - uint64 invocation_id = 2; - string method = 3; - string request_id = 4; - string caller_identity = 5; - string payload = 6; - uint32 response_timeout_ms = 7; + required uint64 local_participant_handle = 1; + required uint64 invocation_id = 2; + required string method = 3; + required string request_id = 4; + required string caller_identity = 5; + required string payload = 6; + required uint32 response_timeout_ms = 7; } diff --git a/livekit-ffi/protocol/stats.proto b/livekit-ffi/protocol/stats.proto index 45df5c9b..f4771f3e 100644 --- a/livekit-ffi/protocol/stats.proto +++ b/livekit-ffi/protocol/stats.proto @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; @@ -91,83 +91,83 @@ enum IceTcpCandidateType { message RtcStats { message Codec { - RtcStatsData rtc = 1; - CodecStats codec = 2; + required RtcStatsData rtc = 1; + required CodecStats codec = 2; } message InboundRtp { - RtcStatsData rtc = 1; - RtpStreamStats stream = 2; - ReceivedRtpStreamStats received = 3; - InboundRtpStreamStats inbound = 4; + required RtcStatsData rtc = 1; + required RtpStreamStats stream = 2; + required ReceivedRtpStreamStats received = 3; + required InboundRtpStreamStats inbound = 4; } message OutboundRtp { - RtcStatsData rtc = 1; - RtpStreamStats stream = 2; - SentRtpStreamStats sent = 3; - OutboundRtpStreamStats outbound = 4; + required RtcStatsData rtc = 1; + required RtpStreamStats stream = 2; + required SentRtpStreamStats sent = 3; + required OutboundRtpStreamStats outbound = 4; } message RemoteInboundRtp { - RtcStatsData rtc = 1; - RtpStreamStats stream = 2; - ReceivedRtpStreamStats received = 3; - RemoteInboundRtpStreamStats remote_inbound = 4; + required RtcStatsData rtc = 1; + required RtpStreamStats stream = 2; + required ReceivedRtpStreamStats received = 3; + required RemoteInboundRtpStreamStats remote_inbound = 4; } message RemoteOutboundRtp { - RtcStatsData rtc = 1; - RtpStreamStats stream = 2; - SentRtpStreamStats sent = 3; - RemoteOutboundRtpStreamStats remote_outbound = 4; + required RtcStatsData rtc = 1; + required RtpStreamStats stream = 2; + required SentRtpStreamStats sent = 3; + required RemoteOutboundRtpStreamStats remote_outbound = 4; } message MediaSource { - RtcStatsData rtc = 1; - MediaSourceStats source = 2; - AudioSourceStats audio = 3; - VideoSourceStats video = 4; + required RtcStatsData rtc = 1; + required MediaSourceStats source = 2; + required AudioSourceStats audio = 3; + required VideoSourceStats video = 4; } message MediaPlayout { - RtcStatsData rtc = 1; - AudioPlayoutStats audio_playout = 2; + required RtcStatsData rtc = 1; + required AudioPlayoutStats audio_playout = 2; } message PeerConnection { - RtcStatsData rtc = 1; - PeerConnectionStats pc = 2; + required RtcStatsData rtc = 1; + required PeerConnectionStats pc = 2; } message DataChannel { - RtcStatsData rtc = 1; - DataChannelStats dc = 2; + required RtcStatsData rtc = 1; + required DataChannelStats dc = 2; } message Transport { - RtcStatsData rtc = 1; - TransportStats transport = 2; + required RtcStatsData rtc = 1; + required TransportStats transport = 2; } message CandidatePair { - RtcStatsData rtc = 1; - CandidatePairStats candidate_pair = 2; + required RtcStatsData rtc = 1; + required CandidatePairStats candidate_pair = 2; } message LocalCandidate { - RtcStatsData rtc = 1; - IceCandidateStats candidate = 2; + required RtcStatsData rtc = 1; + required IceCandidateStats candidate = 2; } message RemoteCandidate { - RtcStatsData rtc = 1; - IceCandidateStats candidate = 2; + required RtcStatsData rtc = 1; + required IceCandidateStats candidate = 2; } message Certificate { - RtcStatsData rtc = 1; - CertificateStats certificate = 2; + required RtcStatsData rtc = 1; + required CertificateStats certificate = 2; } message Track { @@ -194,256 +194,256 @@ message RtcStats { } message RtcStatsData { - string id = 1; - int64 timestamp = 2; + required string id = 1; + required int64 timestamp = 2; } message CodecStats { - uint32 payload_type = 1; - string transport_id = 2; - string mime_type = 3; - uint32 clock_rate = 4; - uint32 channels = 5; - string sdp_fmtp_line = 6; + required uint32 payload_type = 1; + required string transport_id = 2; + required string mime_type = 3; + required uint32 clock_rate = 4; + required uint32 channels = 5; + required string sdp_fmtp_line = 6; } message RtpStreamStats { - uint32 ssrc = 1; - string kind = 2; - string transport_id = 3; - string codec_id = 4; + required uint32 ssrc = 1; + required string kind = 2; + required string transport_id = 3; + required string codec_id = 4; } message ReceivedRtpStreamStats { - uint64 packets_received = 1; - int64 packets_lost = 2; - double jitter = 3; + required uint64 packets_received = 1; + required int64 packets_lost = 2; + required double jitter = 3; } message InboundRtpStreamStats { - string track_identifier = 1; - string mid = 2; - string remote_id = 3; - uint32 frames_decoded = 4; - uint32 key_frames_decoded = 5; - uint32 frames_rendered = 6; - uint32 frames_dropped = 7; - uint32 frame_width = 8; - uint32 frame_height = 9; - double frames_per_second = 10; - uint64 qp_sum = 11; - double total_decode_time = 12; - double total_inter_frame_delay = 13; - double total_squared_inter_frame_delay = 14; - uint32 pause_count = 15; - double total_pause_duration = 16; - uint32 freeze_count = 17; - double total_freeze_duration = 18; - double last_packet_received_timestamp = 19; - uint64 header_bytes_received = 20; - uint64 packets_discarded = 21; - uint64 fec_bytes_received = 22; - uint64 fec_packets_received = 23; - uint64 fec_packets_discarded = 24; - uint64 bytes_received = 25; - uint32 nack_count = 26; - uint32 fir_count = 27; - uint32 pli_count = 28; - double total_processing_delay = 29; - double estimated_playout_timestamp = 30; - double jitter_buffer_delay = 31; - double jitter_buffer_target_delay = 32; - uint64 jitter_buffer_emitted_count = 33; - double jitter_buffer_minimum_delay = 34; - uint64 total_samples_received = 35; - uint64 concealed_samples = 36; - uint64 silent_concealed_samples = 37; - uint64 concealment_events = 38; - uint64 inserted_samples_for_deceleration = 39; - uint64 removed_samples_for_acceleration = 40; - double audio_level = 41; - double total_audio_energy = 42; - double total_samples_duration = 43; - uint64 frames_received = 44; - string decoder_implementation = 45; - string playout_id = 46; - bool power_efficient_decoder = 47; - uint64 frames_assembled_from_multiple_packets = 48; - double total_assembly_time = 49; - uint64 retransmitted_packets_received = 50; - uint64 retransmitted_bytes_received = 51; - uint32 rtx_ssrc = 52; - uint32 fec_ssrc = 53; + required string track_identifier = 1; + required string mid = 2; + required string remote_id = 3; + required uint32 frames_decoded = 4; + required uint32 key_frames_decoded = 5; + required uint32 frames_rendered = 6; + required uint32 frames_dropped = 7; + required uint32 frame_width = 8; + required uint32 frame_height = 9; + required double frames_per_second = 10; + required uint64 qp_sum = 11; + required double total_decode_time = 12; + required double total_inter_frame_delay = 13; + required double total_squared_inter_frame_delay = 14; + required uint32 pause_count = 15; + required double total_pause_duration = 16; + required uint32 freeze_count = 17; + required double total_freeze_duration = 18; + required double last_packet_received_timestamp = 19; + required uint64 header_bytes_received = 20; + required uint64 packets_discarded = 21; + required uint64 fec_bytes_received = 22; + required uint64 fec_packets_received = 23; + required uint64 fec_packets_discarded = 24; + required uint64 bytes_received = 25; + required uint32 nack_count = 26; + required uint32 fir_count = 27; + required uint32 pli_count = 28; + required double total_processing_delay = 29; + required double estimated_playout_timestamp = 30; + required double jitter_buffer_delay = 31; + required double jitter_buffer_target_delay = 32; + required uint64 jitter_buffer_emitted_count = 33; + required double jitter_buffer_minimum_delay = 34; + required uint64 total_samples_received = 35; + required uint64 concealed_samples = 36; + required uint64 silent_concealed_samples = 37; + required uint64 concealment_events = 38; + required uint64 inserted_samples_for_deceleration = 39; + required uint64 removed_samples_for_acceleration = 40; + required double audio_level = 41; + required double total_audio_energy = 42; + required double total_samples_duration = 43; + required uint64 frames_received = 44; + required string decoder_implementation = 45; + required string playout_id = 46; + required bool power_efficient_decoder = 47; + required uint64 frames_assembled_from_multiple_packets = 48; + required double total_assembly_time = 49; + required uint64 retransmitted_packets_received = 50; + required uint64 retransmitted_bytes_received = 51; + required uint32 rtx_ssrc = 52; + required uint32 fec_ssrc = 53; } message SentRtpStreamStats { - uint64 packets_sent = 1; - uint64 bytes_sent = 2; + required uint64 packets_sent = 1; + required uint64 bytes_sent = 2; } message OutboundRtpStreamStats { - string mid = 1; - string media_source_id = 2; - string remote_id = 3; - string rid = 4; - uint64 header_bytes_sent = 5; - uint64 retransmitted_packets_sent = 6; - uint64 retransmitted_bytes_sent = 7; - uint32 rtx_ssrc = 8; - double target_bitrate = 9; - uint64 total_encoded_bytes_target = 10; - uint32 frame_width = 11; - uint32 frame_height = 12; - double frames_per_second = 13; - uint32 frames_sent = 14; - uint32 huge_frames_sent = 15; - uint32 frames_encoded = 16; - uint32 key_frames_encoded = 17; - uint64 qp_sum = 18; - double total_encode_time = 19; - double total_packet_send_delay = 20; - QualityLimitationReason quality_limitation_reason = 21; + required string mid = 1; + required string media_source_id = 2; + required string remote_id = 3; + required string rid = 4; + required uint64 header_bytes_sent = 5; + required uint64 retransmitted_packets_sent = 6; + required uint64 retransmitted_bytes_sent = 7; + required uint32 rtx_ssrc = 8; + required double target_bitrate = 9; + required uint64 total_encoded_bytes_target = 10; + required uint32 frame_width = 11; + required uint32 frame_height = 12; + required double frames_per_second = 13; + required uint32 frames_sent = 14; + required uint32 huge_frames_sent = 15; + required uint32 frames_encoded = 16; + required uint32 key_frames_encoded = 17; + required uint64 qp_sum = 18; + required double total_encode_time = 19; + required double total_packet_send_delay = 20; + required QualityLimitationReason quality_limitation_reason = 21; map quality_limitation_durations = 22; - uint32 quality_limitation_resolution_changes = 23; - uint32 nack_count = 24; - uint32 fir_count = 25; - uint32 pli_count = 26; - string encoder_implementation = 27; - bool power_efficient_encoder = 28; - bool active = 29; - string scalibility_mode = 30; + required uint32 quality_limitation_resolution_changes = 23; + required uint32 nack_count = 24; + required uint32 fir_count = 25; + required uint32 pli_count = 26; + required string encoder_implementation = 27; + required bool power_efficient_encoder = 28; + required bool active = 29; + required string scalability_mode = 30; } message RemoteInboundRtpStreamStats { - string local_id = 1; - double round_trip_time = 2; - double total_round_trip_time = 3; - double fraction_lost = 4; - uint64 round_trip_time_measurements = 5; + required string local_id = 1; + required double round_trip_time = 2; + required double total_round_trip_time = 3; + required double fraction_lost = 4; + required uint64 round_trip_time_measurements = 5; } message RemoteOutboundRtpStreamStats { - string local_id = 1; - double remote_timestamp = 2; - uint64 reports_sent = 3; - double round_trip_time = 4; - double total_round_trip_time = 5; - uint64 round_trip_time_measurements = 6; + required string local_id = 1; + required double remote_timestamp = 2; + required uint64 reports_sent = 3; + required double round_trip_time = 4; + required double total_round_trip_time = 5; + required uint64 round_trip_time_measurements = 6; } message MediaSourceStats { - string track_identifier = 1; - string kind = 2; + required string track_identifier = 1; + required string kind = 2; } message AudioSourceStats { - double audio_level = 1; - double total_audio_energy = 2; - double total_samples_duration = 3; - double echo_return_loss = 4; - double echo_return_loss_enhancement = 5; - double dropped_samples_duration = 6; - uint32 dropped_samples_events = 7; - double total_capture_delay = 8; - uint64 total_samples_captured = 9; + required double audio_level = 1; + required double total_audio_energy = 2; + required double total_samples_duration = 3; + required double echo_return_loss = 4; + required double echo_return_loss_enhancement = 5; + required double dropped_samples_duration = 6; + required uint32 dropped_samples_events = 7; + required double total_capture_delay = 8; + required uint64 total_samples_captured = 9; } message VideoSourceStats { - uint32 width = 1; - uint32 height = 2; - uint32 frames = 3; - double frames_per_second = 4; + required uint32 width = 1; + required uint32 height = 2; + required uint32 frames = 3; + required double frames_per_second = 4; } message AudioPlayoutStats { - string kind = 1; - double synthesized_samples_duration = 2; - uint32 synthesized_samples_events = 3; - double total_samples_duration = 4; - double total_playout_delay = 5; - uint64 total_samples_count = 6; + required string kind = 1; + required double synthesized_samples_duration = 2; + required uint32 synthesized_samples_events = 3; + required double total_samples_duration = 4; + required double total_playout_delay = 5; + required uint64 total_samples_count = 6; } message PeerConnectionStats { - uint32 data_channels_opened = 1; - uint32 data_channels_closed = 2; + required uint32 data_channels_opened = 1; + required uint32 data_channels_closed = 2; } message DataChannelStats { - string label = 1; - string protocol = 2; - int32 data_channel_identifier = 3; + required string label = 1; + required string protocol = 2; + required int32 data_channel_identifier = 3; optional DataChannelState state = 4; - uint32 messages_sent = 5; - uint64 bytes_sent = 6; - uint32 messages_received = 7; - uint64 bytes_received = 8; + required uint32 messages_sent = 5; + required uint64 bytes_sent = 6; + required uint32 messages_received = 7; + required uint64 bytes_received = 8; } message TransportStats { - uint64 packets_sent = 1; - uint64 packets_received = 2; - uint64 bytes_sent = 3; - uint64 bytes_received = 4; - IceRole ice_role = 5; - string ice_local_username_fragment = 6; + required uint64 packets_sent = 1; + required uint64 packets_received = 2; + required uint64 bytes_sent = 3; + required uint64 bytes_received = 4; + required IceRole ice_role = 5; + required string ice_local_username_fragment = 6; optional DtlsTransportState dtls_state = 7; optional IceTransportState ice_state = 8; - string selected_candidate_pair_id = 9; - string local_certificate_id = 10; - string remote_certificate_id = 11; - string tls_version = 12; - string dtls_cipher = 13; - DtlsRole dtls_role = 14; - string srtp_cipher = 15; - uint32 selected_candidate_pair_changes = 16; + required string selected_candidate_pair_id = 9; + required string local_certificate_id = 10; + required string remote_certificate_id = 11; + required string tls_version = 12; + required string dtls_cipher = 13; + required DtlsRole dtls_role = 14; + required string srtp_cipher = 15; + required uint32 selected_candidate_pair_changes = 16; } message CandidatePairStats { - string transport_id = 1; - string local_candidate_id = 2; - string remote_candidate_id = 3; + required string transport_id = 1; + required string local_candidate_id = 2; + required string remote_candidate_id = 3; optional IceCandidatePairState state = 4; - bool nominated = 5; - uint64 packets_sent = 6; - uint64 packets_received = 7; - uint64 bytes_sent = 8; - uint64 bytes_received = 9; - double last_packet_sent_timestamp = 10; - double last_packet_received_timestamp = 11; - double total_round_trip_time = 12; - double current_round_trip_time = 13; - double available_outgoing_bitrate = 14; - double available_incoming_bitrate = 15; - uint64 requests_received = 16; - uint64 requests_sent = 17; - uint64 responses_received = 18; - uint64 responses_sent = 19; - uint64 consent_requests_sent = 20; - uint32 packets_discarded_on_send = 21; - uint64 bytes_discarded_on_send = 22; + required bool nominated = 5; + required uint64 packets_sent = 6; + required uint64 packets_received = 7; + required uint64 bytes_sent = 8; + required uint64 bytes_received = 9; + required double last_packet_sent_timestamp = 10; + required double last_packet_received_timestamp = 11; + required double total_round_trip_time = 12; + required double current_round_trip_time = 13; + required double available_outgoing_bitrate = 14; + required double available_incoming_bitrate = 15; + required uint64 requests_received = 16; + required uint64 requests_sent = 17; + required uint64 responses_received = 18; + required uint64 responses_sent = 19; + required uint64 consent_requests_sent = 20; + required uint32 packets_discarded_on_send = 21; + required uint64 bytes_discarded_on_send = 22; } message IceCandidateStats { - string transport_id = 1; - string address = 2; - int32 port = 3; - string protocol = 4; + required string transport_id = 1; + required string address = 2; + required int32 port = 3; + required string protocol = 4; optional IceCandidateType candidate_type = 5; - int32 priority = 6; - string url = 7; + required int32 priority = 6; + required string url = 7; optional IceServerTransportProtocol relay_protocol = 8; - string foundation = 9; - string related_address = 10; - int32 related_port = 11; - string username_fragment = 12; + required string foundation = 9; + required string related_address = 10; + required int32 related_port = 11; + required string username_fragment = 12; optional IceTcpCandidateType tcp_type = 13; } message CertificateStats { - string fingerprint = 1; - string fingerprint_algorithm = 2; - string base64_certificate = 3; - string issuer_certificate_id = 4; + required string fingerprint = 1; + required string fingerprint_algorithm = 2; + required string base64_certificate = 3; + required string issuer_certificate_id = 4; } diff --git a/livekit-ffi/protocol/track.proto b/livekit-ffi/protocol/track.proto index ee9e1ff0..4bebd399 100644 --- a/livekit-ffi/protocol/track.proto +++ b/livekit-ffi/protocol/track.proto @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; @@ -23,30 +23,30 @@ import "stats.proto"; // Create a new VideoTrack from a VideoSource message CreateVideoTrackRequest { - string name = 1; - uint64 source_handle = 2; + required string name = 1; + required uint64 source_handle = 2; } message CreateVideoTrackResponse { - OwnedTrack track = 1; + required OwnedTrack track = 1; } // Create a new AudioTrack from a AudioSource message CreateAudioTrackRequest { - string name = 1; - uint64 source_handle = 2; + required string name = 1; + required uint64 source_handle = 2; } message CreateAudioTrackResponse { - OwnedTrack track = 1; + required OwnedTrack track = 1; } message GetStatsRequest { - uint64 track_handle = 1; + required uint64 track_handle = 1; } message GetStatsResponse { - uint64 async_id = 1; + required uint64 async_id = 1; } message GetStatsCallback { - uint64 async_id = 1; + required uint64 async_id = 1; optional string error = 2; repeated RtcStats stats = 3; } @@ -78,54 +78,54 @@ enum StreamState { } message TrackPublicationInfo { - string sid = 1; - string name = 2; - TrackKind kind = 3; - TrackSource source = 4; - bool simulcasted = 5; - uint32 width = 6; - uint32 height = 7; - string mime_type = 8; - bool muted = 9; - bool remote = 10; - EncryptionType encryption_type = 11; + required string sid = 1; + required string name = 2; + required TrackKind kind = 3; + required TrackSource source = 4; + required bool simulcasted = 5; + required uint32 width = 6; + required uint32 height = 7; + required string mime_type = 8; + required bool muted = 9; + required bool remote = 10; + required EncryptionType encryption_type = 11; } message OwnedTrackPublication { - FfiOwnedHandle handle = 1; - TrackPublicationInfo info = 2; + required FfiOwnedHandle handle = 1; + required TrackPublicationInfo info = 2; } message TrackInfo { - string sid = 1; - string name = 2; - TrackKind kind = 3; - StreamState stream_state = 4; - bool muted = 5; - bool remote = 6; + required string sid = 1; + required string name = 2; + required TrackKind kind = 3; + required StreamState stream_state = 4; + required bool muted = 5; + required bool remote = 6; } message OwnedTrack { - FfiOwnedHandle handle = 1; - TrackInfo info = 2; + required FfiOwnedHandle handle = 1; + required TrackInfo info = 2; } // Mute/UnMute a track message LocalTrackMuteRequest { - uint64 track_handle = 1; - bool mute = 2; + required uint64 track_handle = 1; + required bool mute = 2; } message LocalTrackMuteResponse { - bool muted = 1; + required bool muted = 1; } // Enable/Disable a remote track message EnableRemoteTrackRequest { - uint64 track_handle = 1; - bool enabled = 2; + required uint64 track_handle = 1; + required bool enabled = 2; } message EnableRemoteTrackResponse { - bool enabled = 1; + required bool enabled = 1; } diff --git a/livekit-ffi/protocol/video_frame.proto b/livekit-ffi/protocol/video_frame.proto index 090518b5..1291ccc4 100644 --- a/livekit-ffi/protocol/video_frame.proto +++ b/livekit-ffi/protocol/video_frame.proto @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -syntax = "proto3"; +syntax = "proto2"; package livekit.proto; option csharp_namespace = "LiveKit.Proto"; @@ -23,53 +23,55 @@ import "track.proto"; // Create a new VideoStream // VideoStream is used to receive video frames from a track message NewVideoStreamRequest { - uint64 track_handle = 1; - VideoStreamType type = 2; + required uint64 track_handle = 1; + required VideoStreamType type = 2; // Get the frame on a specific format optional VideoBufferType format = 3; - bool normalize_stride = 4; // if true, stride will be set to width/chroma_width + required bool normalize_stride = 4; // if true, stride will be set to width/chroma_width } -message NewVideoStreamResponse { OwnedVideoStream stream = 1; } +message NewVideoStreamResponse { required OwnedVideoStream stream = 1; } // Request a video stream from a participant message VideoStreamFromParticipantRequest { - uint64 participant_handle = 1; - VideoStreamType type = 2; - TrackSource track_source = 3; + required uint64 participant_handle = 1; + required VideoStreamType type = 2; + required TrackSource track_source = 3; optional VideoBufferType format = 4; - bool normalize_stride = 5; + required bool normalize_stride = 5; } -message VideoStreamFromParticipantResponse { OwnedVideoStream stream = 1;} +message VideoStreamFromParticipantResponse { required OwnedVideoStream stream = 1;} // Create a new VideoSource // VideoSource is used to send video frame to a track message NewVideoSourceRequest { - VideoSourceType type = 1; + required VideoSourceType type = 1; // Used to determine which encodings to use + simulcast layers // Most of the time it corresponds to the source resolution - VideoSourceResolution resolution = 2; + required VideoSourceResolution resolution = 2; } -message NewVideoSourceResponse { OwnedVideoSource source = 1; } +message NewVideoSourceResponse { required OwnedVideoSource source = 1; } // Push a frame to a VideoSource message CaptureVideoFrameRequest { - uint64 source_handle = 1; - VideoBufferInfo buffer = 2; - int64 timestamp_us = 3; // In microseconds - VideoRotation rotation = 4; + required uint64 source_handle = 1; + required VideoBufferInfo buffer = 2; + required int64 timestamp_us = 3; // In microseconds + required VideoRotation rotation = 4; } message CaptureVideoFrameResponse {} message VideoConvertRequest { - bool flip_y = 1; - VideoBufferInfo buffer = 2; - VideoBufferType dst_type = 3; -} -message VideoConvertResponse { - optional string error = 1; - OwnedVideoBuffer buffer = 2; + required bool flip_y = 1; + required VideoBufferInfo buffer = 2; + required VideoBufferType dst_type = 3; +} +message VideoConvertResponse { + oneof message { + string error = 1; + OwnedVideoBuffer buffer = 2; + } } // @@ -77,9 +79,9 @@ message VideoConvertResponse { // message VideoResolution { - uint32 width = 1; - uint32 height = 2; - double frame_rate = 3; + required uint32 width = 1; + required uint32 height = 2; + required double frame_rate = 3; } enum VideoCodec { @@ -112,21 +114,21 @@ enum VideoBufferType { message VideoBufferInfo { message ComponentInfo { - uint64 data_ptr = 1; - uint32 stride = 2; - uint32 size = 3; + required uint64 data_ptr = 1; + required uint32 stride = 2; + required uint32 size = 3; } - VideoBufferType type = 1; - uint32 width = 2; - uint32 height = 3; - uint64 data_ptr = 4; - uint32 stride = 6; // only for packed formats + required VideoBufferType type = 1; + required uint32 width = 2; + required uint32 height = 3; + required uint64 data_ptr = 4; + required uint32 stride = 6; // only for packed formats repeated ComponentInfo components = 7; } message OwnedVideoBuffer { - FfiOwnedHandle handle = 1; - VideoBufferInfo info = 2; + required FfiOwnedHandle handle = 1; + required VideoBufferInfo info = 2; } // @@ -140,16 +142,16 @@ enum VideoStreamType { } message VideoStreamInfo { - VideoStreamType type = 1; + required VideoStreamType type = 1; } message OwnedVideoStream { - FfiOwnedHandle handle = 1; - VideoStreamInfo info = 2; + required FfiOwnedHandle handle = 1; + required VideoStreamInfo info = 2; } message VideoStreamEvent { - uint64 stream_handle = 1; + required uint64 stream_handle = 1; oneof message { VideoFrameReceived frame_received = 2; VideoStreamEOS eos = 3; @@ -157,9 +159,9 @@ message VideoStreamEvent { } message VideoFrameReceived { - OwnedVideoBuffer buffer = 1; - int64 timestamp_us = 2; // In microseconds - VideoRotation rotation = 3; + required OwnedVideoBuffer buffer = 1; + required int64 timestamp_us = 2; // In microseconds + required VideoRotation rotation = 3; } message VideoStreamEOS {} @@ -169,8 +171,8 @@ message VideoStreamEOS {} // message VideoSourceResolution { - uint32 width = 1; - uint32 height = 2; + required uint32 width = 1; + required uint32 height = 2; } enum VideoSourceType { @@ -178,10 +180,10 @@ enum VideoSourceType { } message VideoSourceInfo { - VideoSourceType type = 1; + required VideoSourceType type = 1; } message OwnedVideoSource { - FfiOwnedHandle handle = 1; - VideoSourceInfo info = 2; + required FfiOwnedHandle handle = 1; + required VideoSourceInfo info = 2; } diff --git a/livekit-protocol/protocol b/livekit-protocol/protocol index a601adc5..c0c2e6e0 160000 --- a/livekit-protocol/protocol +++ b/livekit-protocol/protocol @@ -1 +1 @@ -Subproject commit a601adc5e9027820857a6d445b32a868b19d4184 +Subproject commit c0c2e6e03dcc9e8b5d75568b78b91f73d8fd0d6e diff --git a/livekit-protocol/src/livekit.rs b/livekit-protocol/src/livekit.rs index 19181c25..eea49a99 100644 --- a/livekit-protocol/src/livekit.rs +++ b/livekit-protocol/src/livekit.rs @@ -1371,6 +1371,10 @@ pub enum DisconnectReason { SignalClose = 9, /// the room was closed, due to all Standard and Ingress participants having left RoomClosed = 10, + /// SIP callee did not respond in time + UserUnavailable = 11, + /// SIP callee rejected the call (busy) + UserRejected = 12, } impl DisconnectReason { /// String value of the enum field names used in the ProtoBuf definition. @@ -1390,6 +1394,8 @@ impl DisconnectReason { DisconnectReason::Migration => "MIGRATION", DisconnectReason::SignalClose => "SIGNAL_CLOSE", DisconnectReason::RoomClosed => "ROOM_CLOSED", + DisconnectReason::UserUnavailable => "USER_UNAVAILABLE", + DisconnectReason::UserRejected => "USER_REJECTED", } } /// Creates an enum from field names used in the ProtoBuf definition. @@ -1406,6 +1412,8 @@ impl DisconnectReason { "MIGRATION" => Some(Self::Migration), "SIGNAL_CLOSE" => Some(Self::SignalClose), "ROOM_CLOSED" => Some(Self::RoomClosed), + "USER_UNAVAILABLE" => Some(Self::UserUnavailable), + "USER_REJECTED" => Some(Self::UserRejected), _ => None, } } @@ -3471,8 +3479,8 @@ pub struct UpdateWorkerStatus { /// optional string metadata = 2 \[deprecated=true\]; #[prost(float, tag="3")] pub load: f32, - #[prost(int32, tag="4")] - pub job_count: i32, + #[prost(uint32, tag="4")] + pub job_count: u32, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -4469,6 +4477,12 @@ pub struct SipInboundTrunkInfo { /// Map SIP X-* headers from INVITE to SIP participant attributes. #[prost(map="string, string", tag="10")] pub headers_to_attributes: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>, + /// Max time for the caller to wait for track subscription. + #[prost(message, optional, tag="11")] + pub ringing_timeout: ::core::option::Option<::pbjson_types::Duration>, + /// Max call duration. + #[prost(message, optional, tag="12")] + pub max_call_duration: ::core::option::Option<::pbjson_types::Duration>, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -4737,6 +4751,12 @@ pub struct CreateSipParticipantRequest { /// If true, a random value for identity will be used and numbers will be omitted from attributes. #[prost(bool, tag="10")] pub hide_phone_number: bool, + /// Max time for the callee to answer the call. + #[prost(message, optional, tag="11")] + pub ringing_timeout: ::core::option::Option<::pbjson_types::Duration>, + /// Max call duration. + #[prost(message, optional, tag="12")] + pub max_call_duration: ::core::option::Option<::pbjson_types::Duration>, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -4760,6 +4780,47 @@ pub struct TransferSipParticipantRequest { #[prost(string, tag="3")] pub transfer_to: ::prost::alloc::string::String, } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SipCallInfo { + #[prost(string, tag="1")] + pub call_id: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub trunk_id: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub room_name: ::prost::alloc::string::String, + /// ID of the current/previous room published to + #[prost(string, tag="4")] + pub room_id: ::prost::alloc::string::String, + #[prost(string, tag="5")] + pub participant_identity: ::prost::alloc::string::String, + #[prost(message, optional, tag="6")] + pub from_uri: ::core::option::Option, + #[prost(message, optional, tag="7")] + pub to_uri: ::core::option::Option, + #[prost(enumeration="SipCallStatus", tag="8")] + pub call_status: i32, + #[prost(int64, tag="9")] + pub started_at: i64, + #[prost(int64, tag="10")] + pub ended_at: i64, + #[prost(enumeration="DisconnectReason", tag="11")] + pub disconnect_reason: i32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SipUri { + #[prost(string, tag="1")] + pub user: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub host: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub ip: ::prost::alloc::string::String, + #[prost(string, tag="4")] + pub port: ::prost::alloc::string::String, + #[prost(enumeration="SipTransport", tag="5")] + pub transport: i32, +} #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum SipTransport { @@ -4792,5 +4853,41 @@ impl SipTransport { } } } +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum SipCallStatus { + /// Incoming call is being handled by the SIP service. The SIP participant hasn't joined a LiveKit room yet + ScsCallIncoming = 0, + /// SIP participant for outgoing call has been created. The SIP outgoing call is being established + ScsParticipantJoined = 1, + /// Call is ongoing. SIP participant is active in the LiveKit room + ScsActive = 2, + /// Call has ended + ScsDisconnected = 3, +} +impl SipCallStatus { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + SipCallStatus::ScsCallIncoming => "SCS_CALL_INCOMING", + SipCallStatus::ScsParticipantJoined => "SCS_PARTICIPANT_JOINED", + SipCallStatus::ScsActive => "SCS_ACTIVE", + SipCallStatus::ScsDisconnected => "SCS_DISCONNECTED", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "SCS_CALL_INCOMING" => Some(Self::ScsCallIncoming), + "SCS_PARTICIPANT_JOINED" => Some(Self::ScsParticipantJoined), + "SCS_ACTIVE" => Some(Self::ScsActive), + "SCS_DISCONNECTED" => Some(Self::ScsDisconnected), + _ => None, + } + } +} include!("livekit.serde.rs"); // @@protoc_insertion_point(module) diff --git a/livekit-protocol/src/livekit.serde.rs b/livekit-protocol/src/livekit.serde.rs index 4e6a0fb0..4146fd9d 100644 --- a/livekit-protocol/src/livekit.serde.rs +++ b/livekit-protocol/src/livekit.serde.rs @@ -4292,6 +4292,12 @@ impl serde::Serialize for CreateSipParticipantRequest { if self.hide_phone_number { len += 1; } + if self.ringing_timeout.is_some() { + len += 1; + } + if self.max_call_duration.is_some() { + len += 1; + } let mut struct_ser = serializer.serialize_struct("livekit.CreateSIPParticipantRequest", len)?; if !self.sip_trunk_id.is_empty() { struct_ser.serialize_field("sipTrunkId", &self.sip_trunk_id)?; @@ -4323,6 +4329,12 @@ impl serde::Serialize for CreateSipParticipantRequest { if self.hide_phone_number { struct_ser.serialize_field("hidePhoneNumber", &self.hide_phone_number)?; } + if let Some(v) = self.ringing_timeout.as_ref() { + struct_ser.serialize_field("ringingTimeout", v)?; + } + if let Some(v) = self.max_call_duration.as_ref() { + struct_ser.serialize_field("maxCallDuration", v)?; + } struct_ser.end() } } @@ -4352,6 +4364,10 @@ impl<'de> serde::Deserialize<'de> for CreateSipParticipantRequest { "playRingtone", "hide_phone_number", "hidePhoneNumber", + "ringing_timeout", + "ringingTimeout", + "max_call_duration", + "maxCallDuration", ]; #[allow(clippy::enum_variant_names)] @@ -4366,6 +4382,8 @@ impl<'de> serde::Deserialize<'de> for CreateSipParticipantRequest { Dtmf, PlayRingtone, HidePhoneNumber, + RingingTimeout, + MaxCallDuration, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -4398,6 +4416,8 @@ impl<'de> serde::Deserialize<'de> for CreateSipParticipantRequest { "dtmf" => Ok(GeneratedField::Dtmf), "playRingtone" | "play_ringtone" => Ok(GeneratedField::PlayRingtone), "hidePhoneNumber" | "hide_phone_number" => Ok(GeneratedField::HidePhoneNumber), + "ringingTimeout" | "ringing_timeout" => Ok(GeneratedField::RingingTimeout), + "maxCallDuration" | "max_call_duration" => Ok(GeneratedField::MaxCallDuration), _ => Ok(GeneratedField::__SkipField__), } } @@ -4427,6 +4447,8 @@ impl<'de> serde::Deserialize<'de> for CreateSipParticipantRequest { let mut dtmf__ = None; let mut play_ringtone__ = None; let mut hide_phone_number__ = None; + let mut ringing_timeout__ = None; + let mut max_call_duration__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::SipTrunkId => { @@ -4491,6 +4513,18 @@ impl<'de> serde::Deserialize<'de> for CreateSipParticipantRequest { } hide_phone_number__ = Some(map_.next_value()?); } + GeneratedField::RingingTimeout => { + if ringing_timeout__.is_some() { + return Err(serde::de::Error::duplicate_field("ringingTimeout")); + } + ringing_timeout__ = map_.next_value()?; + } + GeneratedField::MaxCallDuration => { + if max_call_duration__.is_some() { + return Err(serde::de::Error::duplicate_field("maxCallDuration")); + } + max_call_duration__ = map_.next_value()?; + } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } @@ -4507,6 +4541,8 @@ impl<'de> serde::Deserialize<'de> for CreateSipParticipantRequest { dtmf: dtmf__.unwrap_or_default(), play_ringtone: play_ringtone__.unwrap_or_default(), hide_phone_number: hide_phone_number__.unwrap_or_default(), + ringing_timeout: ringing_timeout__, + max_call_duration: max_call_duration__, }) } } @@ -6127,6 +6163,8 @@ impl serde::Serialize for DisconnectReason { Self::Migration => "MIGRATION", Self::SignalClose => "SIGNAL_CLOSE", Self::RoomClosed => "ROOM_CLOSED", + Self::UserUnavailable => "USER_UNAVAILABLE", + Self::UserRejected => "USER_REJECTED", }; serializer.serialize_str(variant) } @@ -6149,6 +6187,8 @@ impl<'de> serde::Deserialize<'de> for DisconnectReason { "MIGRATION", "SIGNAL_CLOSE", "ROOM_CLOSED", + "USER_UNAVAILABLE", + "USER_REJECTED", ]; struct GeneratedVisitor; @@ -6200,6 +6240,8 @@ impl<'de> serde::Deserialize<'de> for DisconnectReason { "MIGRATION" => Ok(DisconnectReason::Migration), "SIGNAL_CLOSE" => Ok(DisconnectReason::SignalClose), "ROOM_CLOSED" => Ok(DisconnectReason::RoomClosed), + "USER_UNAVAILABLE" => Ok(DisconnectReason::UserUnavailable), + "USER_REJECTED" => Ok(DisconnectReason::UserRejected), _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } } @@ -21858,6 +21900,371 @@ impl<'de> serde::Deserialize<'de> for S3Upload { deserializer.deserialize_struct("livekit.S3Upload", FIELDS, GeneratedVisitor) } } +impl serde::Serialize for SipCallInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.call_id.is_empty() { + len += 1; + } + if !self.trunk_id.is_empty() { + len += 1; + } + if !self.room_name.is_empty() { + len += 1; + } + if !self.room_id.is_empty() { + len += 1; + } + if !self.participant_identity.is_empty() { + len += 1; + } + if self.from_uri.is_some() { + len += 1; + } + if self.to_uri.is_some() { + len += 1; + } + if self.call_status != 0 { + len += 1; + } + if self.started_at != 0 { + len += 1; + } + if self.ended_at != 0 { + len += 1; + } + if self.disconnect_reason != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.SIPCallInfo", len)?; + if !self.call_id.is_empty() { + struct_ser.serialize_field("callId", &self.call_id)?; + } + if !self.trunk_id.is_empty() { + struct_ser.serialize_field("trunkId", &self.trunk_id)?; + } + if !self.room_name.is_empty() { + struct_ser.serialize_field("roomName", &self.room_name)?; + } + if !self.room_id.is_empty() { + struct_ser.serialize_field("roomId", &self.room_id)?; + } + if !self.participant_identity.is_empty() { + struct_ser.serialize_field("participantIdentity", &self.participant_identity)?; + } + if let Some(v) = self.from_uri.as_ref() { + struct_ser.serialize_field("fromUri", v)?; + } + if let Some(v) = self.to_uri.as_ref() { + struct_ser.serialize_field("toUri", v)?; + } + if self.call_status != 0 { + let v = SipCallStatus::try_from(self.call_status) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.call_status)))?; + struct_ser.serialize_field("callStatus", &v)?; + } + if self.started_at != 0 { + #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] + struct_ser.serialize_field("startedAt", ToString::to_string(&self.started_at).as_str())?; + } + if self.ended_at != 0 { + #[allow(clippy::needless_borrow)] + #[allow(clippy::needless_borrows_for_generic_args)] + struct_ser.serialize_field("endedAt", ToString::to_string(&self.ended_at).as_str())?; + } + if self.disconnect_reason != 0 { + let v = DisconnectReason::try_from(self.disconnect_reason) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.disconnect_reason)))?; + struct_ser.serialize_field("disconnectReason", &v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for SipCallInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "call_id", + "callId", + "trunk_id", + "trunkId", + "room_name", + "roomName", + "room_id", + "roomId", + "participant_identity", + "participantIdentity", + "from_uri", + "fromUri", + "to_uri", + "toUri", + "call_status", + "callStatus", + "started_at", + "startedAt", + "ended_at", + "endedAt", + "disconnect_reason", + "disconnectReason", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CallId, + TrunkId, + RoomName, + RoomId, + ParticipantIdentity, + FromUri, + ToUri, + CallStatus, + StartedAt, + EndedAt, + DisconnectReason, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "callId" | "call_id" => Ok(GeneratedField::CallId), + "trunkId" | "trunk_id" => Ok(GeneratedField::TrunkId), + "roomName" | "room_name" => Ok(GeneratedField::RoomName), + "roomId" | "room_id" => Ok(GeneratedField::RoomId), + "participantIdentity" | "participant_identity" => Ok(GeneratedField::ParticipantIdentity), + "fromUri" | "from_uri" => Ok(GeneratedField::FromUri), + "toUri" | "to_uri" => Ok(GeneratedField::ToUri), + "callStatus" | "call_status" => Ok(GeneratedField::CallStatus), + "startedAt" | "started_at" => Ok(GeneratedField::StartedAt), + "endedAt" | "ended_at" => Ok(GeneratedField::EndedAt), + "disconnectReason" | "disconnect_reason" => Ok(GeneratedField::DisconnectReason), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SipCallInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.SIPCallInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut call_id__ = None; + let mut trunk_id__ = None; + let mut room_name__ = None; + let mut room_id__ = None; + let mut participant_identity__ = None; + let mut from_uri__ = None; + let mut to_uri__ = None; + let mut call_status__ = None; + let mut started_at__ = None; + let mut ended_at__ = None; + let mut disconnect_reason__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CallId => { + if call_id__.is_some() { + return Err(serde::de::Error::duplicate_field("callId")); + } + call_id__ = Some(map_.next_value()?); + } + GeneratedField::TrunkId => { + if trunk_id__.is_some() { + return Err(serde::de::Error::duplicate_field("trunkId")); + } + trunk_id__ = Some(map_.next_value()?); + } + GeneratedField::RoomName => { + if room_name__.is_some() { + return Err(serde::de::Error::duplicate_field("roomName")); + } + room_name__ = Some(map_.next_value()?); + } + GeneratedField::RoomId => { + if room_id__.is_some() { + return Err(serde::de::Error::duplicate_field("roomId")); + } + room_id__ = Some(map_.next_value()?); + } + GeneratedField::ParticipantIdentity => { + if participant_identity__.is_some() { + return Err(serde::de::Error::duplicate_field("participantIdentity")); + } + participant_identity__ = Some(map_.next_value()?); + } + GeneratedField::FromUri => { + if from_uri__.is_some() { + return Err(serde::de::Error::duplicate_field("fromUri")); + } + from_uri__ = map_.next_value()?; + } + GeneratedField::ToUri => { + if to_uri__.is_some() { + return Err(serde::de::Error::duplicate_field("toUri")); + } + to_uri__ = map_.next_value()?; + } + GeneratedField::CallStatus => { + if call_status__.is_some() { + return Err(serde::de::Error::duplicate_field("callStatus")); + } + call_status__ = Some(map_.next_value::()? as i32); + } + GeneratedField::StartedAt => { + if started_at__.is_some() { + return Err(serde::de::Error::duplicate_field("startedAt")); + } + started_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::EndedAt => { + if ended_at__.is_some() { + return Err(serde::de::Error::duplicate_field("endedAt")); + } + ended_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::DisconnectReason => { + if disconnect_reason__.is_some() { + return Err(serde::de::Error::duplicate_field("disconnectReason")); + } + disconnect_reason__ = Some(map_.next_value::()? as i32); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(SipCallInfo { + call_id: call_id__.unwrap_or_default(), + trunk_id: trunk_id__.unwrap_or_default(), + room_name: room_name__.unwrap_or_default(), + room_id: room_id__.unwrap_or_default(), + participant_identity: participant_identity__.unwrap_or_default(), + from_uri: from_uri__, + to_uri: to_uri__, + call_status: call_status__.unwrap_or_default(), + started_at: started_at__.unwrap_or_default(), + ended_at: ended_at__.unwrap_or_default(), + disconnect_reason: disconnect_reason__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.SIPCallInfo", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for SipCallStatus { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::ScsCallIncoming => "SCS_CALL_INCOMING", + Self::ScsParticipantJoined => "SCS_PARTICIPANT_JOINED", + Self::ScsActive => "SCS_ACTIVE", + Self::ScsDisconnected => "SCS_DISCONNECTED", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for SipCallStatus { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "SCS_CALL_INCOMING", + "SCS_PARTICIPANT_JOINED", + "SCS_ACTIVE", + "SCS_DISCONNECTED", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SipCallStatus; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "SCS_CALL_INCOMING" => Ok(SipCallStatus::ScsCallIncoming), + "SCS_PARTICIPANT_JOINED" => Ok(SipCallStatus::ScsParticipantJoined), + "SCS_ACTIVE" => Ok(SipCallStatus::ScsActive), + "SCS_DISCONNECTED" => Ok(SipCallStatus::ScsDisconnected), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} impl serde::Serialize for SipDispatchRule { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result @@ -22601,6 +23008,12 @@ impl serde::Serialize for SipInboundTrunkInfo { if !self.headers_to_attributes.is_empty() { len += 1; } + if self.ringing_timeout.is_some() { + len += 1; + } + if self.max_call_duration.is_some() { + len += 1; + } let mut struct_ser = serializer.serialize_struct("livekit.SIPInboundTrunkInfo", len)?; if !self.sip_trunk_id.is_empty() { struct_ser.serialize_field("sipTrunkId", &self.sip_trunk_id)?; @@ -22632,6 +23045,12 @@ impl serde::Serialize for SipInboundTrunkInfo { if !self.headers_to_attributes.is_empty() { struct_ser.serialize_field("headersToAttributes", &self.headers_to_attributes)?; } + if let Some(v) = self.ringing_timeout.as_ref() { + struct_ser.serialize_field("ringingTimeout", v)?; + } + if let Some(v) = self.max_call_duration.as_ref() { + struct_ser.serialize_field("maxCallDuration", v)?; + } struct_ser.end() } } @@ -22658,6 +23077,10 @@ impl<'de> serde::Deserialize<'de> for SipInboundTrunkInfo { "headers", "headers_to_attributes", "headersToAttributes", + "ringing_timeout", + "ringingTimeout", + "max_call_duration", + "maxCallDuration", ]; #[allow(clippy::enum_variant_names)] @@ -22672,6 +23095,8 @@ impl<'de> serde::Deserialize<'de> for SipInboundTrunkInfo { AuthPassword, Headers, HeadersToAttributes, + RingingTimeout, + MaxCallDuration, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -22704,6 +23129,8 @@ impl<'de> serde::Deserialize<'de> for SipInboundTrunkInfo { "authPassword" | "auth_password" => Ok(GeneratedField::AuthPassword), "headers" => Ok(GeneratedField::Headers), "headersToAttributes" | "headers_to_attributes" => Ok(GeneratedField::HeadersToAttributes), + "ringingTimeout" | "ringing_timeout" => Ok(GeneratedField::RingingTimeout), + "maxCallDuration" | "max_call_duration" => Ok(GeneratedField::MaxCallDuration), _ => Ok(GeneratedField::__SkipField__), } } @@ -22733,6 +23160,8 @@ impl<'de> serde::Deserialize<'de> for SipInboundTrunkInfo { let mut auth_password__ = None; let mut headers__ = None; let mut headers_to_attributes__ = None; + let mut ringing_timeout__ = None; + let mut max_call_duration__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::SipTrunkId => { @@ -22799,6 +23228,18 @@ impl<'de> serde::Deserialize<'de> for SipInboundTrunkInfo { map_.next_value::>()? ); } + GeneratedField::RingingTimeout => { + if ringing_timeout__.is_some() { + return Err(serde::de::Error::duplicate_field("ringingTimeout")); + } + ringing_timeout__ = map_.next_value()?; + } + GeneratedField::MaxCallDuration => { + if max_call_duration__.is_some() { + return Err(serde::de::Error::duplicate_field("maxCallDuration")); + } + max_call_duration__ = map_.next_value()?; + } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } @@ -22815,6 +23256,8 @@ impl<'de> serde::Deserialize<'de> for SipInboundTrunkInfo { auth_password: auth_password__.unwrap_or_default(), headers: headers__.unwrap_or_default(), headers_to_attributes: headers_to_attributes__.unwrap_or_default(), + ringing_timeout: ringing_timeout__, + max_call_duration: max_call_duration__, }) } } @@ -23710,6 +24153,171 @@ impl<'de> serde::Deserialize<'de> for sip_trunk_info::TrunkKind { deserializer.deserialize_any(GeneratedVisitor) } } +impl serde::Serialize for SipUri { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.user.is_empty() { + len += 1; + } + if !self.host.is_empty() { + len += 1; + } + if !self.ip.is_empty() { + len += 1; + } + if !self.port.is_empty() { + len += 1; + } + if self.transport != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.SIPUri", len)?; + if !self.user.is_empty() { + struct_ser.serialize_field("user", &self.user)?; + } + if !self.host.is_empty() { + struct_ser.serialize_field("host", &self.host)?; + } + if !self.ip.is_empty() { + struct_ser.serialize_field("ip", &self.ip)?; + } + if !self.port.is_empty() { + struct_ser.serialize_field("port", &self.port)?; + } + if self.transport != 0 { + let v = SipTransport::try_from(self.transport) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.transport)))?; + struct_ser.serialize_field("transport", &v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for SipUri { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "user", + "host", + "ip", + "port", + "transport", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + User, + Host, + Ip, + Port, + Transport, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "user" => Ok(GeneratedField::User), + "host" => Ok(GeneratedField::Host), + "ip" => Ok(GeneratedField::Ip), + "port" => Ok(GeneratedField::Port), + "transport" => Ok(GeneratedField::Transport), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SipUri; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.SIPUri") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut user__ = None; + let mut host__ = None; + let mut ip__ = None; + let mut port__ = None; + let mut transport__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::User => { + if user__.is_some() { + return Err(serde::de::Error::duplicate_field("user")); + } + user__ = Some(map_.next_value()?); + } + GeneratedField::Host => { + if host__.is_some() { + return Err(serde::de::Error::duplicate_field("host")); + } + host__ = Some(map_.next_value()?); + } + GeneratedField::Ip => { + if ip__.is_some() { + return Err(serde::de::Error::duplicate_field("ip")); + } + ip__ = Some(map_.next_value()?); + } + GeneratedField::Port => { + if port__.is_some() { + return Err(serde::de::Error::duplicate_field("port")); + } + port__ = Some(map_.next_value()?); + } + GeneratedField::Transport => { + if transport__.is_some() { + return Err(serde::de::Error::duplicate_field("transport")); + } + transport__ = Some(map_.next_value::()? as i32); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(SipUri { + user: user__.unwrap_or_default(), + host: host__.unwrap_or_default(), + ip: ip__.unwrap_or_default(), + port: port__.unwrap_or_default(), + transport: transport__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.SIPUri", FIELDS, GeneratedVisitor) + } +} impl serde::Serialize for SegmentedFileOutput { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result