diff --git a/.changeset/orange-planes-roll.md b/.changeset/orange-planes-roll.md new file mode 100644 index 000000000..70e001b8d --- /dev/null +++ b/.changeset/orange-planes-roll.md @@ -0,0 +1,5 @@ +--- +"@livekit/protocol": patch +--- + +move out connector protos diff --git a/magefile.go b/magefile.go index 8679a9d6d..dad502036 100644 --- a/magefile.go +++ b/magefile.go @@ -87,8 +87,6 @@ func Proto() error { "rpc/signal.proto", "rpc/whip_signal.proto", "rpc/sip.proto", - "rpc/connector.proto", - "rpc/common.proto", } fmt.Println("generating protobuf") diff --git a/protobufs/rpc/common.proto b/protobufs/rpc/common.proto deleted file mode 100644 index 0913f193e..000000000 --- a/protobufs/rpc/common.proto +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2025 LiveKit, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package rpc; - -option go_package = "github.com/livekit/protocol/rpc"; - -message InternalRoomJoinInfo { - string ws_url = 1; - string token = 2; - string project_id = 3; - string room_svc_token = 4; -} \ No newline at end of file diff --git a/protobufs/rpc/connector.proto b/protobufs/rpc/connector.proto deleted file mode 100644 index 7e78fb920..000000000 --- a/protobufs/rpc/connector.proto +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2025 LiveKit, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package rpc; - -option go_package = "github.com/livekit/protocol/rpc"; - -import "options.proto"; -import "livekit_connector_whatsapp.proto"; -import "livekit_connector_twilio.proto"; -import "rpc/common.proto"; - -service ConnectorInternal { - rpc DialWhatsAppCall(InternalDialWhatsAppCallRequest) returns (livekit.DialWhatsAppCallResponse) { - option (psrpc.options).topics = true; - }; - - rpc AcceptWhatsAppCall(InternalAcceptWhatsAppCallRequest) returns (livekit.AcceptWhatsAppCallResponse) { - option (psrpc.options).topics = true; - }; - - rpc ConnectTwilioCall(InternalConnectTwilioCallRequest) returns (livekit.ConnectTwilioCallResponse) { - option (psrpc.options).topics = true; - }; -} - -service ConnectorHandler { - rpc ConnectWhatsAppCall(livekit.ConnectWhatsAppCallRequest) returns (livekit.ConnectWhatsAppCallResponse) { - option (psrpc.options) = { - topics: true - topic_params: { - names: ["whatsapp_call_id"] - typed: false - } - }; - }; - - rpc DisconnectWhatsAppCall(livekit.DisconnectWhatsAppCallRequest) returns (livekit.DisconnectWhatsAppCallResponse) { - option (psrpc.options) = { - topics: true - topic_params: { - names: ["whatsapp_call_id"] - typed: false - } - }; - }; -} - -message InternalDialWhatsAppCallRequest { - livekit.DialWhatsAppCallRequest request = 1; - InternalRoomJoinInfo room_join_info = 2; -} - -message InternalAcceptWhatsAppCallRequest { - livekit.AcceptWhatsAppCallRequest request = 1; - InternalRoomJoinInfo room_join_info = 2; -} - -message InternalConnectTwilioCallRequest { - livekit.ConnectTwilioCallRequest request = 1; - InternalRoomJoinInfo room_join_info = 2; -} diff --git a/rpc/common.pb.go b/rpc/common.pb.go deleted file mode 100644 index ad823512d..000000000 --- a/rpc/common.pb.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2025 LiveKit, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.11 -// protoc v4.23.4 -// source: rpc/common.proto - -package rpc - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type InternalRoomJoinInfo struct { - state protoimpl.MessageState `protogen:"open.v1"` - WsUrl string `protobuf:"bytes,1,opt,name=ws_url,json=wsUrl,proto3" json:"ws_url,omitempty"` - Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` - ProjectId string `protobuf:"bytes,3,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` - RoomSvcToken string `protobuf:"bytes,4,opt,name=room_svc_token,json=roomSvcToken,proto3" json:"room_svc_token,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InternalRoomJoinInfo) Reset() { - *x = InternalRoomJoinInfo{} - mi := &file_rpc_common_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InternalRoomJoinInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InternalRoomJoinInfo) ProtoMessage() {} - -func (x *InternalRoomJoinInfo) ProtoReflect() protoreflect.Message { - mi := &file_rpc_common_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InternalRoomJoinInfo.ProtoReflect.Descriptor instead. -func (*InternalRoomJoinInfo) Descriptor() ([]byte, []int) { - return file_rpc_common_proto_rawDescGZIP(), []int{0} -} - -func (x *InternalRoomJoinInfo) GetWsUrl() string { - if x != nil { - return x.WsUrl - } - return "" -} - -func (x *InternalRoomJoinInfo) GetToken() string { - if x != nil { - return x.Token - } - return "" -} - -func (x *InternalRoomJoinInfo) GetProjectId() string { - if x != nil { - return x.ProjectId - } - return "" -} - -func (x *InternalRoomJoinInfo) GetRoomSvcToken() string { - if x != nil { - return x.RoomSvcToken - } - return "" -} - -var File_rpc_common_proto protoreflect.FileDescriptor - -const file_rpc_common_proto_rawDesc = "" + - "\n" + - "\x10rpc/common.proto\x12\x03rpc\"\x88\x01\n" + - "\x14InternalRoomJoinInfo\x12\x15\n" + - "\x06ws_url\x18\x01 \x01(\tR\x05wsUrl\x12\x14\n" + - "\x05token\x18\x02 \x01(\tR\x05token\x12\x1d\n" + - "\n" + - "project_id\x18\x03 \x01(\tR\tprojectId\x12$\n" + - "\x0eroom_svc_token\x18\x04 \x01(\tR\froomSvcTokenB!Z\x1fgithub.com/livekit/protocol/rpcb\x06proto3" - -var ( - file_rpc_common_proto_rawDescOnce sync.Once - file_rpc_common_proto_rawDescData []byte -) - -func file_rpc_common_proto_rawDescGZIP() []byte { - file_rpc_common_proto_rawDescOnce.Do(func() { - file_rpc_common_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_rpc_common_proto_rawDesc), len(file_rpc_common_proto_rawDesc))) - }) - return file_rpc_common_proto_rawDescData -} - -var file_rpc_common_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_rpc_common_proto_goTypes = []any{ - (*InternalRoomJoinInfo)(nil), // 0: rpc.InternalRoomJoinInfo -} -var file_rpc_common_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_rpc_common_proto_init() } -func file_rpc_common_proto_init() { - if File_rpc_common_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_common_proto_rawDesc), len(file_rpc_common_proto_rawDesc)), - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_rpc_common_proto_goTypes, - DependencyIndexes: file_rpc_common_proto_depIdxs, - MessageInfos: file_rpc_common_proto_msgTypes, - }.Build() - File_rpc_common_proto = out.File - file_rpc_common_proto_goTypes = nil - file_rpc_common_proto_depIdxs = nil -} diff --git a/rpc/connector.pb.go b/rpc/connector.pb.go deleted file mode 100644 index a40a66e96..000000000 --- a/rpc/connector.pb.go +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2025 LiveKit, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.11 -// protoc v4.23.4 -// source: rpc/connector.proto - -package rpc - -import ( - livekit "github.com/livekit/protocol/livekit" - _ "github.com/livekit/psrpc/protoc-gen-psrpc/options" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" - unsafe "unsafe" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type InternalDialWhatsAppCallRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Request *livekit.DialWhatsAppCallRequest `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` - RoomJoinInfo *InternalRoomJoinInfo `protobuf:"bytes,2,opt,name=room_join_info,json=roomJoinInfo,proto3" json:"room_join_info,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InternalDialWhatsAppCallRequest) Reset() { - *x = InternalDialWhatsAppCallRequest{} - mi := &file_rpc_connector_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InternalDialWhatsAppCallRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InternalDialWhatsAppCallRequest) ProtoMessage() {} - -func (x *InternalDialWhatsAppCallRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_connector_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InternalDialWhatsAppCallRequest.ProtoReflect.Descriptor instead. -func (*InternalDialWhatsAppCallRequest) Descriptor() ([]byte, []int) { - return file_rpc_connector_proto_rawDescGZIP(), []int{0} -} - -func (x *InternalDialWhatsAppCallRequest) GetRequest() *livekit.DialWhatsAppCallRequest { - if x != nil { - return x.Request - } - return nil -} - -func (x *InternalDialWhatsAppCallRequest) GetRoomJoinInfo() *InternalRoomJoinInfo { - if x != nil { - return x.RoomJoinInfo - } - return nil -} - -type InternalAcceptWhatsAppCallRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Request *livekit.AcceptWhatsAppCallRequest `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` - RoomJoinInfo *InternalRoomJoinInfo `protobuf:"bytes,2,opt,name=room_join_info,json=roomJoinInfo,proto3" json:"room_join_info,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InternalAcceptWhatsAppCallRequest) Reset() { - *x = InternalAcceptWhatsAppCallRequest{} - mi := &file_rpc_connector_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InternalAcceptWhatsAppCallRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InternalAcceptWhatsAppCallRequest) ProtoMessage() {} - -func (x *InternalAcceptWhatsAppCallRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_connector_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InternalAcceptWhatsAppCallRequest.ProtoReflect.Descriptor instead. -func (*InternalAcceptWhatsAppCallRequest) Descriptor() ([]byte, []int) { - return file_rpc_connector_proto_rawDescGZIP(), []int{1} -} - -func (x *InternalAcceptWhatsAppCallRequest) GetRequest() *livekit.AcceptWhatsAppCallRequest { - if x != nil { - return x.Request - } - return nil -} - -func (x *InternalAcceptWhatsAppCallRequest) GetRoomJoinInfo() *InternalRoomJoinInfo { - if x != nil { - return x.RoomJoinInfo - } - return nil -} - -type InternalConnectTwilioCallRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - Request *livekit.ConnectTwilioCallRequest `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"` - RoomJoinInfo *InternalRoomJoinInfo `protobuf:"bytes,2,opt,name=room_join_info,json=roomJoinInfo,proto3" json:"room_join_info,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *InternalConnectTwilioCallRequest) Reset() { - *x = InternalConnectTwilioCallRequest{} - mi := &file_rpc_connector_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *InternalConnectTwilioCallRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*InternalConnectTwilioCallRequest) ProtoMessage() {} - -func (x *InternalConnectTwilioCallRequest) ProtoReflect() protoreflect.Message { - mi := &file_rpc_connector_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use InternalConnectTwilioCallRequest.ProtoReflect.Descriptor instead. -func (*InternalConnectTwilioCallRequest) Descriptor() ([]byte, []int) { - return file_rpc_connector_proto_rawDescGZIP(), []int{2} -} - -func (x *InternalConnectTwilioCallRequest) GetRequest() *livekit.ConnectTwilioCallRequest { - if x != nil { - return x.Request - } - return nil -} - -func (x *InternalConnectTwilioCallRequest) GetRoomJoinInfo() *InternalRoomJoinInfo { - if x != nil { - return x.RoomJoinInfo - } - return nil -} - -var File_rpc_connector_proto protoreflect.FileDescriptor - -const file_rpc_connector_proto_rawDesc = "" + - "\n" + - "\x13rpc/connector.proto\x12\x03rpc\x1a\roptions.proto\x1a livekit_connector_whatsapp.proto\x1a\x1elivekit_connector_twilio.proto\x1a\x10rpc/common.proto\"\x9e\x01\n" + - "\x1fInternalDialWhatsAppCallRequest\x12:\n" + - "\arequest\x18\x01 \x01(\v2 .livekit.DialWhatsAppCallRequestR\arequest\x12?\n" + - "\x0eroom_join_info\x18\x02 \x01(\v2\x19.rpc.InternalRoomJoinInfoR\froomJoinInfo\"\xa2\x01\n" + - "!InternalAcceptWhatsAppCallRequest\x12<\n" + - "\arequest\x18\x01 \x01(\v2\".livekit.AcceptWhatsAppCallRequestR\arequest\x12?\n" + - "\x0eroom_join_info\x18\x02 \x01(\v2\x19.rpc.InternalRoomJoinInfoR\froomJoinInfo\"\xa0\x01\n" + - " InternalConnectTwilioCallRequest\x12;\n" + - "\arequest\x18\x01 \x01(\v2!.livekit.ConnectTwilioCallRequestR\arequest\x12?\n" + - "\x0eroom_join_info\x18\x02 \x01(\v2\x19.rpc.InternalRoomJoinInfoR\froomJoinInfo2\xcb\x02\n" + - "\x11ConnectorInternal\x12c\n" + - "\x10DialWhatsAppCall\x12$.rpc.InternalDialWhatsAppCallRequest\x1a!.livekit.DialWhatsAppCallResponse\"\x06\xb2\x89\x01\x02\x10\x01\x12i\n" + - "\x12AcceptWhatsAppCall\x12&.rpc.InternalAcceptWhatsAppCallRequest\x1a#.livekit.AcceptWhatsAppCallResponse\"\x06\xb2\x89\x01\x02\x10\x01\x12f\n" + - "\x11ConnectTwilioCall\x12%.rpc.InternalConnectTwilioCallRequest\x1a\".livekit.ConnectTwilioCallResponse\"\x06\xb2\x89\x01\x02\x10\x012\x98\x02\n" + - "\x10ConnectorHandler\x12|\n" + - "\x13ConnectWhatsAppCall\x12#.livekit.ConnectWhatsAppCallRequest\x1a$.livekit.ConnectWhatsAppCallResponse\"\x1a\xb2\x89\x01\x16\x10\x01\x1a\x12\x12\x10whatsapp_call_id\x12\x85\x01\n" + - "\x16DisconnectWhatsAppCall\x12&.livekit.DisconnectWhatsAppCallRequest\x1a'.livekit.DisconnectWhatsAppCallResponse\"\x1a\xb2\x89\x01\x16\x10\x01\x1a\x12\x12\x10whatsapp_call_idB!Z\x1fgithub.com/livekit/protocol/rpcb\x06proto3" - -var ( - file_rpc_connector_proto_rawDescOnce sync.Once - file_rpc_connector_proto_rawDescData []byte -) - -func file_rpc_connector_proto_rawDescGZIP() []byte { - file_rpc_connector_proto_rawDescOnce.Do(func() { - file_rpc_connector_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_rpc_connector_proto_rawDesc), len(file_rpc_connector_proto_rawDesc))) - }) - return file_rpc_connector_proto_rawDescData -} - -var file_rpc_connector_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_rpc_connector_proto_goTypes = []any{ - (*InternalDialWhatsAppCallRequest)(nil), // 0: rpc.InternalDialWhatsAppCallRequest - (*InternalAcceptWhatsAppCallRequest)(nil), // 1: rpc.InternalAcceptWhatsAppCallRequest - (*InternalConnectTwilioCallRequest)(nil), // 2: rpc.InternalConnectTwilioCallRequest - (*livekit.DialWhatsAppCallRequest)(nil), // 3: livekit.DialWhatsAppCallRequest - (*InternalRoomJoinInfo)(nil), // 4: rpc.InternalRoomJoinInfo - (*livekit.AcceptWhatsAppCallRequest)(nil), // 5: livekit.AcceptWhatsAppCallRequest - (*livekit.ConnectTwilioCallRequest)(nil), // 6: livekit.ConnectTwilioCallRequest - (*livekit.ConnectWhatsAppCallRequest)(nil), // 7: livekit.ConnectWhatsAppCallRequest - (*livekit.DisconnectWhatsAppCallRequest)(nil), // 8: livekit.DisconnectWhatsAppCallRequest - (*livekit.DialWhatsAppCallResponse)(nil), // 9: livekit.DialWhatsAppCallResponse - (*livekit.AcceptWhatsAppCallResponse)(nil), // 10: livekit.AcceptWhatsAppCallResponse - (*livekit.ConnectTwilioCallResponse)(nil), // 11: livekit.ConnectTwilioCallResponse - (*livekit.ConnectWhatsAppCallResponse)(nil), // 12: livekit.ConnectWhatsAppCallResponse - (*livekit.DisconnectWhatsAppCallResponse)(nil), // 13: livekit.DisconnectWhatsAppCallResponse -} -var file_rpc_connector_proto_depIdxs = []int32{ - 3, // 0: rpc.InternalDialWhatsAppCallRequest.request:type_name -> livekit.DialWhatsAppCallRequest - 4, // 1: rpc.InternalDialWhatsAppCallRequest.room_join_info:type_name -> rpc.InternalRoomJoinInfo - 5, // 2: rpc.InternalAcceptWhatsAppCallRequest.request:type_name -> livekit.AcceptWhatsAppCallRequest - 4, // 3: rpc.InternalAcceptWhatsAppCallRequest.room_join_info:type_name -> rpc.InternalRoomJoinInfo - 6, // 4: rpc.InternalConnectTwilioCallRequest.request:type_name -> livekit.ConnectTwilioCallRequest - 4, // 5: rpc.InternalConnectTwilioCallRequest.room_join_info:type_name -> rpc.InternalRoomJoinInfo - 0, // 6: rpc.ConnectorInternal.DialWhatsAppCall:input_type -> rpc.InternalDialWhatsAppCallRequest - 1, // 7: rpc.ConnectorInternal.AcceptWhatsAppCall:input_type -> rpc.InternalAcceptWhatsAppCallRequest - 2, // 8: rpc.ConnectorInternal.ConnectTwilioCall:input_type -> rpc.InternalConnectTwilioCallRequest - 7, // 9: rpc.ConnectorHandler.ConnectWhatsAppCall:input_type -> livekit.ConnectWhatsAppCallRequest - 8, // 10: rpc.ConnectorHandler.DisconnectWhatsAppCall:input_type -> livekit.DisconnectWhatsAppCallRequest - 9, // 11: rpc.ConnectorInternal.DialWhatsAppCall:output_type -> livekit.DialWhatsAppCallResponse - 10, // 12: rpc.ConnectorInternal.AcceptWhatsAppCall:output_type -> livekit.AcceptWhatsAppCallResponse - 11, // 13: rpc.ConnectorInternal.ConnectTwilioCall:output_type -> livekit.ConnectTwilioCallResponse - 12, // 14: rpc.ConnectorHandler.ConnectWhatsAppCall:output_type -> livekit.ConnectWhatsAppCallResponse - 13, // 15: rpc.ConnectorHandler.DisconnectWhatsAppCall:output_type -> livekit.DisconnectWhatsAppCallResponse - 11, // [11:16] is the sub-list for method output_type - 6, // [6:11] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_rpc_connector_proto_init() } -func file_rpc_connector_proto_init() { - if File_rpc_connector_proto != nil { - return - } - file_rpc_common_proto_init() - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_rpc_connector_proto_rawDesc), len(file_rpc_connector_proto_rawDesc)), - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 2, - }, - GoTypes: file_rpc_connector_proto_goTypes, - DependencyIndexes: file_rpc_connector_proto_depIdxs, - MessageInfos: file_rpc_connector_proto_msgTypes, - }.Build() - File_rpc_connector_proto = out.File - file_rpc_connector_proto_goTypes = nil - file_rpc_connector_proto_depIdxs = nil -} diff --git a/rpc/connector.psrpc.go b/rpc/connector.psrpc.go deleted file mode 100644 index bca4c392a..000000000 --- a/rpc/connector.psrpc.go +++ /dev/null @@ -1,365 +0,0 @@ -// Code generated by protoc-gen-psrpc v0.7.0, DO NOT EDIT. -// source: rpc/connector.proto - -package rpc - -import ( - "context" - - "github.com/livekit/psrpc" - "github.com/livekit/psrpc/pkg/client" - "github.com/livekit/psrpc/pkg/info" - "github.com/livekit/psrpc/pkg/rand" - "github.com/livekit/psrpc/pkg/server" - "github.com/livekit/psrpc/version" -) -import livekit10 "github.com/livekit/protocol/livekit" -import livekit11 "github.com/livekit/protocol/livekit" - -var _ = version.PsrpcVersion_0_7 - -// ================================== -// ConnectorInternal Client Interface -// ================================== - -type ConnectorInternalClient interface { - DialWhatsAppCall(ctx context.Context, topic string, req *InternalDialWhatsAppCallRequest, opts ...psrpc.RequestOption) (*livekit10.DialWhatsAppCallResponse, error) - - AcceptWhatsAppCall(ctx context.Context, topic string, req *InternalAcceptWhatsAppCallRequest, opts ...psrpc.RequestOption) (*livekit10.AcceptWhatsAppCallResponse, error) - - ConnectTwilioCall(ctx context.Context, topic string, req *InternalConnectTwilioCallRequest, opts ...psrpc.RequestOption) (*livekit11.ConnectTwilioCallResponse, error) - - // Close immediately, without waiting for pending RPCs - Close() -} - -// ====================================== -// ConnectorInternal ServerImpl Interface -// ====================================== - -type ConnectorInternalServerImpl interface { - DialWhatsAppCall(context.Context, *InternalDialWhatsAppCallRequest) (*livekit10.DialWhatsAppCallResponse, error) - - AcceptWhatsAppCall(context.Context, *InternalAcceptWhatsAppCallRequest) (*livekit10.AcceptWhatsAppCallResponse, error) - - ConnectTwilioCall(context.Context, *InternalConnectTwilioCallRequest) (*livekit11.ConnectTwilioCallResponse, error) -} - -// ================================== -// ConnectorInternal Server Interface -// ================================== - -type ConnectorInternalServer interface { - RegisterDialWhatsAppCallTopic(topic string) error - DeregisterDialWhatsAppCallTopic(topic string) - RegisterAcceptWhatsAppCallTopic(topic string) error - DeregisterAcceptWhatsAppCallTopic(topic string) - RegisterConnectTwilioCallTopic(topic string) error - DeregisterConnectTwilioCallTopic(topic string) - - // Close and wait for pending RPCs to complete - Shutdown() - - // Close immediately, without waiting for pending RPCs - Kill() -} - -// ======================== -// ConnectorInternal Client -// ======================== - -type connectorInternalClient struct { - client *client.RPCClient -} - -// NewConnectorInternalClient creates a psrpc client that implements the ConnectorInternalClient interface. -func NewConnectorInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (ConnectorInternalClient, error) { - sd := &info.ServiceDefinition{ - Name: "ConnectorInternal", - ID: rand.NewClientID(), - } - - sd.RegisterMethod("DialWhatsAppCall", false, false, true, true) - sd.RegisterMethod("AcceptWhatsAppCall", false, false, true, true) - sd.RegisterMethod("ConnectTwilioCall", false, false, true, true) - - rpcClient, err := client.NewRPCClient(sd, bus, opts...) - if err != nil { - return nil, err - } - - return &connectorInternalClient{ - client: rpcClient, - }, nil -} - -func (c *connectorInternalClient) DialWhatsAppCall(ctx context.Context, topic string, req *InternalDialWhatsAppCallRequest, opts ...psrpc.RequestOption) (*livekit10.DialWhatsAppCallResponse, error) { - return client.RequestSingle[*livekit10.DialWhatsAppCallResponse](ctx, c.client, "DialWhatsAppCall", []string{topic}, req, opts...) -} - -func (c *connectorInternalClient) AcceptWhatsAppCall(ctx context.Context, topic string, req *InternalAcceptWhatsAppCallRequest, opts ...psrpc.RequestOption) (*livekit10.AcceptWhatsAppCallResponse, error) { - return client.RequestSingle[*livekit10.AcceptWhatsAppCallResponse](ctx, c.client, "AcceptWhatsAppCall", []string{topic}, req, opts...) -} - -func (c *connectorInternalClient) ConnectTwilioCall(ctx context.Context, topic string, req *InternalConnectTwilioCallRequest, opts ...psrpc.RequestOption) (*livekit11.ConnectTwilioCallResponse, error) { - return client.RequestSingle[*livekit11.ConnectTwilioCallResponse](ctx, c.client, "ConnectTwilioCall", []string{topic}, req, opts...) -} - -func (s *connectorInternalClient) Close() { - s.client.Close() -} - -// ======================== -// ConnectorInternal Server -// ======================== - -type connectorInternalServer struct { - svc ConnectorInternalServerImpl - rpc *server.RPCServer -} - -// NewConnectorInternalServer builds a RPCServer that will route requests -// to the corresponding method in the provided svc implementation. -func NewConnectorInternalServer(svc ConnectorInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (ConnectorInternalServer, error) { - sd := &info.ServiceDefinition{ - Name: "ConnectorInternal", - ID: rand.NewServerID(), - } - - s := server.NewRPCServer(sd, bus, opts...) - - sd.RegisterMethod("DialWhatsAppCall", false, false, true, true) - sd.RegisterMethod("AcceptWhatsAppCall", false, false, true, true) - sd.RegisterMethod("ConnectTwilioCall", false, false, true, true) - return &connectorInternalServer{ - svc: svc, - rpc: s, - }, nil -} - -func (s *connectorInternalServer) RegisterDialWhatsAppCallTopic(topic string) error { - return server.RegisterHandler(s.rpc, "DialWhatsAppCall", []string{topic}, s.svc.DialWhatsAppCall, nil) -} - -func (s *connectorInternalServer) DeregisterDialWhatsAppCallTopic(topic string) { - s.rpc.DeregisterHandler("DialWhatsAppCall", []string{topic}) -} - -func (s *connectorInternalServer) RegisterAcceptWhatsAppCallTopic(topic string) error { - return server.RegisterHandler(s.rpc, "AcceptWhatsAppCall", []string{topic}, s.svc.AcceptWhatsAppCall, nil) -} - -func (s *connectorInternalServer) DeregisterAcceptWhatsAppCallTopic(topic string) { - s.rpc.DeregisterHandler("AcceptWhatsAppCall", []string{topic}) -} - -func (s *connectorInternalServer) RegisterConnectTwilioCallTopic(topic string) error { - return server.RegisterHandler(s.rpc, "ConnectTwilioCall", []string{topic}, s.svc.ConnectTwilioCall, nil) -} - -func (s *connectorInternalServer) DeregisterConnectTwilioCallTopic(topic string) { - s.rpc.DeregisterHandler("ConnectTwilioCall", []string{topic}) -} - -func (s *connectorInternalServer) Shutdown() { - s.rpc.Close(false) -} - -func (s *connectorInternalServer) Kill() { - s.rpc.Close(true) -} - -// ====================================== -// ConnectorInternal Unimplemented Server -// ====================================== - -type UnimplementedConnectorInternalServer struct{} - -func (UnimplementedConnectorInternalServer) DialWhatsAppCall(context.Context, *InternalDialWhatsAppCallRequest) (*livekit10.DialWhatsAppCallResponse, error) { - return nil, psrpc.ErrUnimplemented -} - -func (UnimplementedConnectorInternalServer) AcceptWhatsAppCall(context.Context, *InternalAcceptWhatsAppCallRequest) (*livekit10.AcceptWhatsAppCallResponse, error) { - return nil, psrpc.ErrUnimplemented -} - -func (UnimplementedConnectorInternalServer) ConnectTwilioCall(context.Context, *InternalConnectTwilioCallRequest) (*livekit11.ConnectTwilioCallResponse, error) { - return nil, psrpc.ErrUnimplemented -} - -// ================================= -// ConnectorHandler Client Interface -// ================================= - -type ConnectorHandlerClient interface { - ConnectWhatsAppCall(ctx context.Context, whatsappCallId string, req *livekit10.ConnectWhatsAppCallRequest, opts ...psrpc.RequestOption) (*livekit10.ConnectWhatsAppCallResponse, error) - - DisconnectWhatsAppCall(ctx context.Context, whatsappCallId string, req *livekit10.DisconnectWhatsAppCallRequest, opts ...psrpc.RequestOption) (*livekit10.DisconnectWhatsAppCallResponse, error) - - // Close immediately, without waiting for pending RPCs - Close() -} - -// ===================================== -// ConnectorHandler ServerImpl Interface -// ===================================== - -type ConnectorHandlerServerImpl interface { - ConnectWhatsAppCall(context.Context, *livekit10.ConnectWhatsAppCallRequest) (*livekit10.ConnectWhatsAppCallResponse, error) - - DisconnectWhatsAppCall(context.Context, *livekit10.DisconnectWhatsAppCallRequest) (*livekit10.DisconnectWhatsAppCallResponse, error) -} - -// ================================= -// ConnectorHandler Server Interface -// ================================= - -type ConnectorHandlerServer interface { - RegisterConnectWhatsAppCallTopic(whatsappCallId string) error - DeregisterConnectWhatsAppCallTopic(whatsappCallId string) - RegisterDisconnectWhatsAppCallTopic(whatsappCallId string) error - DeregisterDisconnectWhatsAppCallTopic(whatsappCallId string) - - // Close and wait for pending RPCs to complete - Shutdown() - - // Close immediately, without waiting for pending RPCs - Kill() -} - -// ======================= -// ConnectorHandler Client -// ======================= - -type connectorHandlerClient struct { - client *client.RPCClient -} - -// NewConnectorHandlerClient creates a psrpc client that implements the ConnectorHandlerClient interface. -func NewConnectorHandlerClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (ConnectorHandlerClient, error) { - sd := &info.ServiceDefinition{ - Name: "ConnectorHandler", - ID: rand.NewClientID(), - } - - sd.RegisterMethod("ConnectWhatsAppCall", false, false, true, true) - sd.RegisterMethod("DisconnectWhatsAppCall", false, false, true, true) - - rpcClient, err := client.NewRPCClient(sd, bus, opts...) - if err != nil { - return nil, err - } - - return &connectorHandlerClient{ - client: rpcClient, - }, nil -} - -func (c *connectorHandlerClient) ConnectWhatsAppCall(ctx context.Context, whatsappCallId string, req *livekit10.ConnectWhatsAppCallRequest, opts ...psrpc.RequestOption) (*livekit10.ConnectWhatsAppCallResponse, error) { - return client.RequestSingle[*livekit10.ConnectWhatsAppCallResponse](ctx, c.client, "ConnectWhatsAppCall", []string{whatsappCallId}, req, opts...) -} - -func (c *connectorHandlerClient) DisconnectWhatsAppCall(ctx context.Context, whatsappCallId string, req *livekit10.DisconnectWhatsAppCallRequest, opts ...psrpc.RequestOption) (*livekit10.DisconnectWhatsAppCallResponse, error) { - return client.RequestSingle[*livekit10.DisconnectWhatsAppCallResponse](ctx, c.client, "DisconnectWhatsAppCall", []string{whatsappCallId}, req, opts...) -} - -func (s *connectorHandlerClient) Close() { - s.client.Close() -} - -// ======================= -// ConnectorHandler Server -// ======================= - -type connectorHandlerServer struct { - svc ConnectorHandlerServerImpl - rpc *server.RPCServer -} - -// NewConnectorHandlerServer builds a RPCServer that will route requests -// to the corresponding method in the provided svc implementation. -func NewConnectorHandlerServer(svc ConnectorHandlerServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (ConnectorHandlerServer, error) { - sd := &info.ServiceDefinition{ - Name: "ConnectorHandler", - ID: rand.NewServerID(), - } - - s := server.NewRPCServer(sd, bus, opts...) - - sd.RegisterMethod("ConnectWhatsAppCall", false, false, true, true) - sd.RegisterMethod("DisconnectWhatsAppCall", false, false, true, true) - return &connectorHandlerServer{ - svc: svc, - rpc: s, - }, nil -} - -func (s *connectorHandlerServer) RegisterConnectWhatsAppCallTopic(whatsappCallId string) error { - return server.RegisterHandler(s.rpc, "ConnectWhatsAppCall", []string{whatsappCallId}, s.svc.ConnectWhatsAppCall, nil) -} - -func (s *connectorHandlerServer) DeregisterConnectWhatsAppCallTopic(whatsappCallId string) { - s.rpc.DeregisterHandler("ConnectWhatsAppCall", []string{whatsappCallId}) -} - -func (s *connectorHandlerServer) RegisterDisconnectWhatsAppCallTopic(whatsappCallId string) error { - return server.RegisterHandler(s.rpc, "DisconnectWhatsAppCall", []string{whatsappCallId}, s.svc.DisconnectWhatsAppCall, nil) -} - -func (s *connectorHandlerServer) DeregisterDisconnectWhatsAppCallTopic(whatsappCallId string) { - s.rpc.DeregisterHandler("DisconnectWhatsAppCall", []string{whatsappCallId}) -} - -func (s *connectorHandlerServer) Shutdown() { - s.rpc.Close(false) -} - -func (s *connectorHandlerServer) Kill() { - s.rpc.Close(true) -} - -// ===================================== -// ConnectorHandler Unimplemented Server -// ===================================== - -type UnimplementedConnectorHandlerServer struct{} - -func (UnimplementedConnectorHandlerServer) ConnectWhatsAppCall(context.Context, *livekit10.ConnectWhatsAppCallRequest) (*livekit10.ConnectWhatsAppCallResponse, error) { - return nil, psrpc.ErrUnimplemented -} - -func (UnimplementedConnectorHandlerServer) DisconnectWhatsAppCall(context.Context, *livekit10.DisconnectWhatsAppCallRequest) (*livekit10.DisconnectWhatsAppCallResponse, error) { - return nil, psrpc.ErrUnimplemented -} - -var psrpcFileDescriptor12 = []byte{ - // 444 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4f, 0x8f, 0x94, 0x30, - 0x18, 0xc6, 0x53, 0x4c, 0x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0x4b, 0x5e, 0xd0, 0x1e, 0x82, 0xf3, 0x8d, 0xac, 0xfa, 0x04, 0x16, 0xe2, 0xc9, 0x4e, - 0xdd, 0x6e, 0x8e, 0xd7, 0xc1, 0x87, 0x93, 0x8f, 0xdc, 0xcc, 0x17, 0xd7, 0x11, 0x85, 0x3c, 0xae, - 0x1b, 0xc6, 0xe5, 0xdf, 0x86, 0x82, 0x88, 0xb5, 0xa2, 0xd7, 0x07, 0xe5, 0xea, 0xd9, 0xdf, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x7b, 0xb1, 0x7d, 0x3e, 0xfa, 0x04, 0x00, 0x00, -} diff --git a/rpc/connector_client.go b/rpc/connector_client.go deleted file mode 100644 index af8be9fff..000000000 --- a/rpc/connector_client.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2025 LiveKit, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package rpc - -type ConnectorClient interface { - ConnectorInternalClient - ConnectorHandlerClient -} - -type connectorClient struct { - ConnectorInternalClient - ConnectorHandlerClient -} - -func NewConnectorClient(params ClientParams) (ConnectorClient, error) { - if params.Bus == nil { - return nil, nil - } - opts := params.Options() - - internalClient, err := NewConnectorInternalClient(params.Bus, opts...) - if err != nil { - return nil, err - } - - handlerClient, err := NewConnectorHandlerClient(params.Bus, opts...) - if err != nil { - return nil, err - } - - return &connectorClient{ - internalClient, - handlerClient, - }, nil -} - -func (c *connectorClient) Close() { - c.ConnectorInternalClient.Close() - c.ConnectorHandlerClient.Close() -}