diff --git a/infra/link.pb.go b/infra/link.pb.go index d5d033a41..059150f08 100644 --- a/infra/link.pb.go +++ b/infra/link.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: infra/link.proto package infra diff --git a/infra/link_grpc.pb.go b/infra/link_grpc.pb.go index a7d8284ed..6b1a20101 100644 --- a/infra/link_grpc.pb.go +++ b/infra/link_grpc.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.4 // source: infra/link.proto package infra diff --git a/livekit/livekit_analytics.pb.go b/livekit/livekit_analytics.pb.go index 44525de78..a6d7b7f4c 100644 --- a/livekit/livekit_analytics.pb.go +++ b/livekit/livekit_analytics.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: livekit_analytics.proto package livekit diff --git a/livekit/livekit_analytics_grpc.pb.go b/livekit/livekit_analytics_grpc.pb.go index 7fdbbe64b..778b50901 100644 --- a/livekit/livekit_analytics_grpc.pb.go +++ b/livekit/livekit_analytics_grpc.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.23.4 +// - protoc v4.24.4 // source: livekit_analytics.proto package livekit diff --git a/livekit/livekit_egress.pb.go b/livekit/livekit_egress.pb.go index 1d4f43f88..f61abfbd9 100644 --- a/livekit/livekit_egress.pb.go +++ b/livekit/livekit_egress.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: livekit_egress.proto package livekit diff --git a/livekit/livekit_ingress.pb.go b/livekit/livekit_ingress.pb.go index 0b2861085..2f6c3741e 100644 --- a/livekit/livekit_ingress.pb.go +++ b/livekit/livekit_ingress.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: livekit_ingress.proto package livekit diff --git a/livekit/livekit_internal.pb.go b/livekit/livekit_internal.pb.go index b557334a1..91b2bac75 100644 --- a/livekit/livekit_internal.pb.go +++ b/livekit/livekit_internal.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: livekit_internal.proto package livekit diff --git a/livekit/livekit_models.pb.go b/livekit/livekit_models.pb.go index 44256dda2..99129a9b6 100644 --- a/livekit/livekit_models.pb.go +++ b/livekit/livekit_models.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: livekit_models.proto package livekit diff --git a/livekit/livekit_room.pb.go b/livekit/livekit_room.pb.go index 487fe826a..21baf163f 100644 --- a/livekit/livekit_room.pb.go +++ b/livekit/livekit_room.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: livekit_room.proto package livekit diff --git a/livekit/livekit_rtc.pb.go b/livekit/livekit_rtc.pb.go index cff98c889..dd2cb33cf 100644 --- a/livekit/livekit_rtc.pb.go +++ b/livekit/livekit_rtc.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: livekit_rtc.proto package livekit diff --git a/livekit/livekit_sip.pb.go b/livekit/livekit_sip.pb.go new file mode 100644 index 000000000..b0e9ffa5a --- /dev/null +++ b/livekit/livekit_sip.pb.go @@ -0,0 +1,1348 @@ +// Copyright 2023 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.31.0 +// protoc v4.24.4 +// source: livekit_sip.proto + +package livekit + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +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) +) + +// A SIP Trunk is used to accept incoming traffic or make outbound calls +// The handling of the inbound traffic is configured with a SIPBridge +type CreateSIPTrunkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // CIDR or IPs that are allowed to send INVITEs and where Invites will be sent too + Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"` + // To value that will be used when sending an Invite + To string `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` +} + +func (x *CreateSIPTrunkRequest) Reset() { + *x = CreateSIPTrunkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateSIPTrunkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSIPTrunkRequest) ProtoMessage() {} + +func (x *CreateSIPTrunkRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSIPTrunkRequest.ProtoReflect.Descriptor instead. +func (*CreateSIPTrunkRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateSIPTrunkRequest) GetAddresses() []string { + if x != nil { + return x.Addresses + } + return nil +} + +func (x *CreateSIPTrunkRequest) GetTo() string { + if x != nil { + return x.To + } + return "" +} + +type SIPTrunkInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SipTrunkId string `protobuf:"bytes,1,opt,name=sip_trunk_id,json=sipTrunkId,proto3" json:"sip_trunk_id,omitempty"` +} + +func (x *SIPTrunkInfo) Reset() { + *x = SIPTrunkInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SIPTrunkInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SIPTrunkInfo) ProtoMessage() {} + +func (x *SIPTrunkInfo) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SIPTrunkInfo.ProtoReflect.Descriptor instead. +func (*SIPTrunkInfo) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{1} +} + +func (x *SIPTrunkInfo) GetSipTrunkId() string { + if x != nil { + return x.SipTrunkId + } + return "" +} + +type ListSIPTrunkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListSIPTrunkRequest) Reset() { + *x = ListSIPTrunkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSIPTrunkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSIPTrunkRequest) ProtoMessage() {} + +func (x *ListSIPTrunkRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSIPTrunkRequest.ProtoReflect.Descriptor instead. +func (*ListSIPTrunkRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{2} +} + +type ListSIPTrunkResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items []*SIPTrunkInfo `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` +} + +func (x *ListSIPTrunkResponse) Reset() { + *x = ListSIPTrunkResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSIPTrunkResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSIPTrunkResponse) ProtoMessage() {} + +func (x *ListSIPTrunkResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSIPTrunkResponse.ProtoReflect.Descriptor instead. +func (*ListSIPTrunkResponse) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{3} +} + +func (x *ListSIPTrunkResponse) GetItems() []*SIPTrunkInfo { + if x != nil { + return x.Items + } + return nil +} + +type DeleteSIPTrunkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SipTrunkId string `protobuf:"bytes,1,opt,name=sip_trunk_id,json=sipTrunkId,proto3" json:"sip_trunk_id,omitempty"` +} + +func (x *DeleteSIPTrunkRequest) Reset() { + *x = DeleteSIPTrunkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteSIPTrunkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSIPTrunkRequest) ProtoMessage() {} + +func (x *DeleteSIPTrunkRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSIPTrunkRequest.ProtoReflect.Descriptor instead. +func (*DeleteSIPTrunkRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{4} +} + +func (x *DeleteSIPTrunkRequest) GetSipTrunkId() string { + if x != nil { + return x.SipTrunkId + } + return "" +} + +// A SIP Bridge is used to route traffic to a LiveKit room. A bridge +// can have many different behaviors +// +// - `auto_bridge_trunk` is set +// The call is routed into the configured LiveKit Room automatically +// if received on the configured trunk +// +// - `auto_bridge_trunk` and `pin` is set +// The call is routed into the configured LiveKit Room automatically +// if received on the configured trunk and the correct pin is entered +// +// - Only `pin` is set +// User is prompted for a Pin. User is put into the room matching the pinh +// +// - `auto_bridge_from` is set +// User is added to a room if value matches calling phone number +// +// - `auto_bridge_from` is set and `pin` is set +// User is added to a room if value matches calling phone number and the +// correct pin is entered +type CreateSIPBridgeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // What Room is this SIP Traffic Bridged into + RoomName string `protobuf:"bytes,1,opt,name=room_name,json=roomName,proto3" json:"room_name,omitempty"` + // If call is received on specified Trunk bridge into the room + AutoBridgeTrunk string `protobuf:"bytes,2,opt,name=auto_bridge_trunk,json=autoBridgeTrunk,proto3" json:"auto_bridge_trunk,omitempty"` + // If call is received from a specific number bridge into the room + AutoBridgeFrom string `protobuf:"bytes,3,opt,name=auto_bridge_from,json=autoBridgeFrom,proto3" json:"auto_bridge_from,omitempty"` + // Pin required to use this bridge + Pin string `protobuf:"bytes,4,opt,name=pin,proto3" json:"pin,omitempty"` + // By default the From value (Phone number) is used as the participant identity + // If true a random value will be used instead + UseRandomParticipantIdentity bool `protobuf:"varint,5,opt,name=use_random_participant_identity,json=useRandomParticipantIdentity,proto3" json:"use_random_participant_identity,omitempty"` +} + +func (x *CreateSIPBridgeRequest) Reset() { + *x = CreateSIPBridgeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateSIPBridgeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSIPBridgeRequest) ProtoMessage() {} + +func (x *CreateSIPBridgeRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSIPBridgeRequest.ProtoReflect.Descriptor instead. +func (*CreateSIPBridgeRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateSIPBridgeRequest) GetRoomName() string { + if x != nil { + return x.RoomName + } + return "" +} + +func (x *CreateSIPBridgeRequest) GetAutoBridgeTrunk() string { + if x != nil { + return x.AutoBridgeTrunk + } + return "" +} + +func (x *CreateSIPBridgeRequest) GetAutoBridgeFrom() string { + if x != nil { + return x.AutoBridgeFrom + } + return "" +} + +func (x *CreateSIPBridgeRequest) GetPin() string { + if x != nil { + return x.Pin + } + return "" +} + +func (x *CreateSIPBridgeRequest) GetUseRandomParticipantIdentity() bool { + if x != nil { + return x.UseRandomParticipantIdentity + } + return false +} + +type SIPBridgeInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SipBridgeId string `protobuf:"bytes,1,opt,name=sip_bridge_id,json=sipBridgeId,proto3" json:"sip_bridge_id,omitempty"` +} + +func (x *SIPBridgeInfo) Reset() { + *x = SIPBridgeInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SIPBridgeInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SIPBridgeInfo) ProtoMessage() {} + +func (x *SIPBridgeInfo) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SIPBridgeInfo.ProtoReflect.Descriptor instead. +func (*SIPBridgeInfo) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{6} +} + +func (x *SIPBridgeInfo) GetSipBridgeId() string { + if x != nil { + return x.SipBridgeId + } + return "" +} + +type ListSIPBridgeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListSIPBridgeRequest) Reset() { + *x = ListSIPBridgeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSIPBridgeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSIPBridgeRequest) ProtoMessage() {} + +func (x *ListSIPBridgeRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSIPBridgeRequest.ProtoReflect.Descriptor instead. +func (*ListSIPBridgeRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{7} +} + +type ListSIPBridgeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items []*SIPBridgeInfo `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` +} + +func (x *ListSIPBridgeResponse) Reset() { + *x = ListSIPBridgeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSIPBridgeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSIPBridgeResponse) ProtoMessage() {} + +func (x *ListSIPBridgeResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSIPBridgeResponse.ProtoReflect.Descriptor instead. +func (*ListSIPBridgeResponse) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{8} +} + +func (x *ListSIPBridgeResponse) GetItems() []*SIPBridgeInfo { + if x != nil { + return x.Items + } + return nil +} + +type DeleteSIPBridgeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SipBridgeId string `protobuf:"bytes,1,opt,name=sip_bridge_id,json=sipBridgeId,proto3" json:"sip_bridge_id,omitempty"` +} + +func (x *DeleteSIPBridgeRequest) Reset() { + *x = DeleteSIPBridgeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteSIPBridgeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSIPBridgeRequest) ProtoMessage() {} + +func (x *DeleteSIPBridgeRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSIPBridgeRequest.ProtoReflect.Descriptor instead. +func (*DeleteSIPBridgeRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{9} +} + +func (x *DeleteSIPBridgeRequest) GetSipBridgeId() string { + if x != nil { + return x.SipBridgeId + } + return "" +} + +// A SIP Participant is a singular SIP session connected to a LiveKit room via +// a SIP Trunk into a SIP Bridge +type CreateSIPParticipantRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // What LiveKit room should this participant be connected too + RoomName string `protobuf:"bytes,1,opt,name=room_name,json=roomName,proto3" json:"room_name,omitempty"` + // What SIP Trunk should be used to dial the user + SipTrunkId string `protobuf:"bytes,2,opt,name=sip_trunk_id,json=sipTrunkId,proto3" json:"sip_trunk_id,omitempty"` + // What To value should be used + To string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` +} + +func (x *CreateSIPParticipantRequest) Reset() { + *x = CreateSIPParticipantRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateSIPParticipantRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSIPParticipantRequest) ProtoMessage() {} + +func (x *CreateSIPParticipantRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSIPParticipantRequest.ProtoReflect.Descriptor instead. +func (*CreateSIPParticipantRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{10} +} + +func (x *CreateSIPParticipantRequest) GetRoomName() string { + if x != nil { + return x.RoomName + } + return "" +} + +func (x *CreateSIPParticipantRequest) GetSipTrunkId() string { + if x != nil { + return x.SipTrunkId + } + return "" +} + +func (x *CreateSIPParticipantRequest) GetTo() string { + if x != nil { + return x.To + } + return "" +} + +type SIPParticipantInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SipParticipantId string `protobuf:"bytes,1,opt,name=sip_participant_id,json=sipParticipantId,proto3" json:"sip_participant_id,omitempty"` +} + +func (x *SIPParticipantInfo) Reset() { + *x = SIPParticipantInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SIPParticipantInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SIPParticipantInfo) ProtoMessage() {} + +func (x *SIPParticipantInfo) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SIPParticipantInfo.ProtoReflect.Descriptor instead. +func (*SIPParticipantInfo) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{11} +} + +func (x *SIPParticipantInfo) GetSipParticipantId() string { + if x != nil { + return x.SipParticipantId + } + return "" +} + +// DTMF Request lets you send a DTMF message for a SIP Participant +type SendSIPParticipantDTMFRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // What SIP Participant to send this DTMF for + SipParticipantId string `protobuf:"bytes,1,opt,name=sip_participant_id,json=sipParticipantId,proto3" json:"sip_participant_id,omitempty"` + // Digits that will be sent via DTMF + Digits string `protobuf:"bytes,2,opt,name=digits,proto3" json:"digits,omitempty"` +} + +func (x *SendSIPParticipantDTMFRequest) Reset() { + *x = SendSIPParticipantDTMFRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendSIPParticipantDTMFRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendSIPParticipantDTMFRequest) ProtoMessage() {} + +func (x *SendSIPParticipantDTMFRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[12] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendSIPParticipantDTMFRequest.ProtoReflect.Descriptor instead. +func (*SendSIPParticipantDTMFRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{12} +} + +func (x *SendSIPParticipantDTMFRequest) GetSipParticipantId() string { + if x != nil { + return x.SipParticipantId + } + return "" +} + +func (x *SendSIPParticipantDTMFRequest) GetDigits() string { + if x != nil { + return x.Digits + } + return "" +} + +type SIPParticipantDTMFInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SipParticipantId string `protobuf:"bytes,1,opt,name=sip_participant_id,json=sipParticipantId,proto3" json:"sip_participant_id,omitempty"` +} + +func (x *SIPParticipantDTMFInfo) Reset() { + *x = SIPParticipantDTMFInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SIPParticipantDTMFInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SIPParticipantDTMFInfo) ProtoMessage() {} + +func (x *SIPParticipantDTMFInfo) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SIPParticipantDTMFInfo.ProtoReflect.Descriptor instead. +func (*SIPParticipantDTMFInfo) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{13} +} + +func (x *SIPParticipantDTMFInfo) GetSipParticipantId() string { + if x != nil { + return x.SipParticipantId + } + return "" +} + +type ListSIPParticipantRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListSIPParticipantRequest) Reset() { + *x = ListSIPParticipantRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSIPParticipantRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSIPParticipantRequest) ProtoMessage() {} + +func (x *ListSIPParticipantRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSIPParticipantRequest.ProtoReflect.Descriptor instead. +func (*ListSIPParticipantRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{14} +} + +type ListSIPParticipantResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Items []*SIPParticipantInfo `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` +} + +func (x *ListSIPParticipantResponse) Reset() { + *x = ListSIPParticipantResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListSIPParticipantResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSIPParticipantResponse) ProtoMessage() {} + +func (x *ListSIPParticipantResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListSIPParticipantResponse.ProtoReflect.Descriptor instead. +func (*ListSIPParticipantResponse) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{15} +} + +func (x *ListSIPParticipantResponse) GetItems() []*SIPParticipantInfo { + if x != nil { + return x.Items + } + return nil +} + +type DeleteSIPParticipantRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SipParticipantId string `protobuf:"bytes,1,opt,name=sip_participant_id,json=sipParticipantId,proto3" json:"sip_participant_id,omitempty"` +} + +func (x *DeleteSIPParticipantRequest) Reset() { + *x = DeleteSIPParticipantRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_livekit_sip_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteSIPParticipantRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteSIPParticipantRequest) ProtoMessage() {} + +func (x *DeleteSIPParticipantRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_sip_proto_msgTypes[16] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteSIPParticipantRequest.ProtoReflect.Descriptor instead. +func (*DeleteSIPParticipantRequest) Descriptor() ([]byte, []int) { + return file_livekit_sip_proto_rawDescGZIP(), []int{16} +} + +func (x *DeleteSIPParticipantRequest) GetSipParticipantId() string { + if x != nil { + return x.SipParticipantId + } + return "" +} + +var File_livekit_sip_proto protoreflect.FileDescriptor + +var file_livekit_sip_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x73, 0x69, 0x70, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x1a, 0x14, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x45, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x49, 0x50, 0x54, + 0x72, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, 0x22, 0x30, 0x0a, 0x0c, 0x53, 0x49, 0x50, + 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0c, 0x73, 0x69, 0x70, + 0x5f, 0x74, 0x72, 0x75, 0x6e, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0a, 0x73, 0x69, 0x70, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x22, 0x15, 0x0a, 0x13, 0x4c, + 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x43, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, + 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x69, 0x74, + 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, + 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x39, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x20, 0x0a, 0x0c, 0x73, 0x69, 0x70, 0x5f, 0x74, 0x72, 0x75, 0x6e, 0x6b, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x69, 0x70, 0x54, 0x72, 0x75, 0x6e, 0x6b, + 0x49, 0x64, 0x22, 0xe4, 0x01, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x49, 0x50, + 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, + 0x09, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x72, 0x6f, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x75, + 0x74, 0x6f, 0x5f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x75, 0x6e, 0x6b, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x75, 0x74, 0x6f, 0x42, 0x72, 0x69, 0x64, 0x67, + 0x65, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x62, + 0x72, 0x69, 0x64, 0x67, 0x65, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0e, 0x61, 0x75, 0x74, 0x6f, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x46, 0x72, 0x6f, 0x6d, + 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, + 0x69, 0x6e, 0x12, 0x45, 0x0a, 0x1f, 0x75, 0x73, 0x65, 0x5f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, + 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x1c, 0x75, 0x73, 0x65, + 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, + 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x22, 0x33, 0x0a, 0x0d, 0x53, 0x49, 0x50, + 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x69, + 0x70, 0x5f, 0x62, 0x72, 0x69, 0x64, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x73, 0x69, 0x70, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x49, 0x64, 0x22, 0x16, + 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x45, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, + 0x50, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x2c, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, + 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, 0x64, + 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x3c, 0x0a, + 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x69, 0x70, 0x5f, 0x62, + 0x72, 0x69, 0x64, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x73, 0x69, 0x70, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x49, 0x64, 0x22, 0x6c, 0x0a, 0x1b, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, + 0x6f, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, + 0x6f, 0x6f, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x73, 0x69, 0x70, 0x5f, 0x74, + 0x72, 0x75, 0x6e, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, + 0x69, 0x70, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, 0x22, 0x42, 0x0a, 0x12, 0x53, 0x49, 0x50, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, + 0x2c, 0x0a, 0x12, 0x73, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, + 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x69, 0x70, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x65, 0x0a, + 0x1d, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x44, 0x54, 0x4d, 0x46, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, + 0x0a, 0x12, 0x73, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x69, 0x70, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, + 0x64, 0x69, 0x67, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x69, + 0x67, 0x69, 0x74, 0x73, 0x22, 0x46, 0x0a, 0x16, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, + 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x44, 0x54, 0x4d, 0x46, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, + 0x0a, 0x12, 0x73, 0x69, 0x70, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x69, 0x70, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x1b, 0x0a, 0x19, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, + 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4f, 0x0a, 0x1a, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, + 0x2e, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x4b, 0x0a, 0x1b, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, + 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x69, 0x70, + 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x73, 0x69, 0x70, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, + 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x64, 0x32, 0xc4, 0x06, 0x0a, 0x03, 0x53, 0x49, 0x50, 0x12, + 0x47, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, + 0x6b, 0x12, 0x1e, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x49, 0x50, 0x54, + 0x72, 0x75, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4b, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x12, 0x1c, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, + 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, + 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x12, 0x1e, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, + 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, + 0x74, 0x2e, 0x53, 0x49, 0x50, 0x54, 0x72, 0x75, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4a, + 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, 0x64, 0x67, + 0x65, 0x12, 0x1f, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x49, 0x50, + 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x4e, 0x0a, 0x0d, 0x4c, 0x69, + 0x73, 0x74, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x12, 0x1d, 0x2e, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, + 0x64, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6c, 0x69, 0x76, + 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, 0x64, + 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x44, 0x65, + 0x6c, 0x65, 0x74, 0x65, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x12, 0x1f, 0x2e, + 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x49, + 0x50, 0x42, 0x72, 0x69, 0x64, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, + 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x49, 0x50, 0x42, 0x72, 0x69, 0x64, + 0x67, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x59, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x24, + 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, + 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, + 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x61, 0x0a, 0x16, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x44, 0x54, 0x4d, 0x46, 0x12, 0x26, 0x2e, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, + 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x44, 0x54, 0x4d, 0x46, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x49, + 0x50, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x44, 0x54, 0x4d, 0x46, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x5d, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x22, 0x2e, 0x6c, 0x69, 0x76, + 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, 0x50, 0x61, 0x72, 0x74, + 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, + 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x49, 0x50, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x49, 0x50, + 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x12, 0x24, 0x2e, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x49, 0x50, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x69, 0x76, 0x65, 0x6b, 0x69, 0x74, 0x2e, 0x53, 0x49, 0x50, 0x50, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x46, + 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x76, + 0x65, 0x6b, 0x69, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x6c, 0x69, + 0x76, 0x65, 0x6b, 0x69, 0x74, 0xaa, 0x02, 0x0d, 0x4c, 0x69, 0x76, 0x65, 0x4b, 0x69, 0x74, 0x2e, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0xea, 0x02, 0x0e, 0x4c, 0x69, 0x76, 0x65, 0x4b, 0x69, 0x74, 0x3a, + 0x3a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_livekit_sip_proto_rawDescOnce sync.Once + file_livekit_sip_proto_rawDescData = file_livekit_sip_proto_rawDesc +) + +func file_livekit_sip_proto_rawDescGZIP() []byte { + file_livekit_sip_proto_rawDescOnce.Do(func() { + file_livekit_sip_proto_rawDescData = protoimpl.X.CompressGZIP(file_livekit_sip_proto_rawDescData) + }) + return file_livekit_sip_proto_rawDescData +} + +var file_livekit_sip_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_livekit_sip_proto_goTypes = []interface{}{ + (*CreateSIPTrunkRequest)(nil), // 0: livekit.CreateSIPTrunkRequest + (*SIPTrunkInfo)(nil), // 1: livekit.SIPTrunkInfo + (*ListSIPTrunkRequest)(nil), // 2: livekit.ListSIPTrunkRequest + (*ListSIPTrunkResponse)(nil), // 3: livekit.ListSIPTrunkResponse + (*DeleteSIPTrunkRequest)(nil), // 4: livekit.DeleteSIPTrunkRequest + (*CreateSIPBridgeRequest)(nil), // 5: livekit.CreateSIPBridgeRequest + (*SIPBridgeInfo)(nil), // 6: livekit.SIPBridgeInfo + (*ListSIPBridgeRequest)(nil), // 7: livekit.ListSIPBridgeRequest + (*ListSIPBridgeResponse)(nil), // 8: livekit.ListSIPBridgeResponse + (*DeleteSIPBridgeRequest)(nil), // 9: livekit.DeleteSIPBridgeRequest + (*CreateSIPParticipantRequest)(nil), // 10: livekit.CreateSIPParticipantRequest + (*SIPParticipantInfo)(nil), // 11: livekit.SIPParticipantInfo + (*SendSIPParticipantDTMFRequest)(nil), // 12: livekit.SendSIPParticipantDTMFRequest + (*SIPParticipantDTMFInfo)(nil), // 13: livekit.SIPParticipantDTMFInfo + (*ListSIPParticipantRequest)(nil), // 14: livekit.ListSIPParticipantRequest + (*ListSIPParticipantResponse)(nil), // 15: livekit.ListSIPParticipantResponse + (*DeleteSIPParticipantRequest)(nil), // 16: livekit.DeleteSIPParticipantRequest +} +var file_livekit_sip_proto_depIdxs = []int32{ + 1, // 0: livekit.ListSIPTrunkResponse.items:type_name -> livekit.SIPTrunkInfo + 6, // 1: livekit.ListSIPBridgeResponse.items:type_name -> livekit.SIPBridgeInfo + 11, // 2: livekit.ListSIPParticipantResponse.items:type_name -> livekit.SIPParticipantInfo + 0, // 3: livekit.SIP.CreateSIPTrunk:input_type -> livekit.CreateSIPTrunkRequest + 2, // 4: livekit.SIP.ListSIPTrunk:input_type -> livekit.ListSIPTrunkRequest + 4, // 5: livekit.SIP.DeleteSIPTrunk:input_type -> livekit.DeleteSIPTrunkRequest + 5, // 6: livekit.SIP.CreateSIPBridge:input_type -> livekit.CreateSIPBridgeRequest + 7, // 7: livekit.SIP.ListSIPBridge:input_type -> livekit.ListSIPBridgeRequest + 9, // 8: livekit.SIP.DeleteSIPBridge:input_type -> livekit.DeleteSIPBridgeRequest + 10, // 9: livekit.SIP.CreateSIPParticipant:input_type -> livekit.CreateSIPParticipantRequest + 12, // 10: livekit.SIP.SendSIPParticipantDTMF:input_type -> livekit.SendSIPParticipantDTMFRequest + 14, // 11: livekit.SIP.ListSIPParticipant:input_type -> livekit.ListSIPParticipantRequest + 16, // 12: livekit.SIP.DeleteSIPParticipant:input_type -> livekit.DeleteSIPParticipantRequest + 1, // 13: livekit.SIP.CreateSIPTrunk:output_type -> livekit.SIPTrunkInfo + 3, // 14: livekit.SIP.ListSIPTrunk:output_type -> livekit.ListSIPTrunkResponse + 1, // 15: livekit.SIP.DeleteSIPTrunk:output_type -> livekit.SIPTrunkInfo + 6, // 16: livekit.SIP.CreateSIPBridge:output_type -> livekit.SIPBridgeInfo + 8, // 17: livekit.SIP.ListSIPBridge:output_type -> livekit.ListSIPBridgeResponse + 6, // 18: livekit.SIP.DeleteSIPBridge:output_type -> livekit.SIPBridgeInfo + 11, // 19: livekit.SIP.CreateSIPParticipant:output_type -> livekit.SIPParticipantInfo + 13, // 20: livekit.SIP.SendSIPParticipantDTMF:output_type -> livekit.SIPParticipantDTMFInfo + 15, // 21: livekit.SIP.ListSIPParticipant:output_type -> livekit.ListSIPParticipantResponse + 11, // 22: livekit.SIP.DeleteSIPParticipant:output_type -> livekit.SIPParticipantInfo + 13, // [13:23] is the sub-list for method output_type + 3, // [3:13] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_livekit_sip_proto_init() } +func file_livekit_sip_proto_init() { + if File_livekit_sip_proto != nil { + return + } + file_livekit_models_proto_init() + if !protoimpl.UnsafeEnabled { + file_livekit_sip_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateSIPTrunkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SIPTrunkInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSIPTrunkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSIPTrunkResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteSIPTrunkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateSIPBridgeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SIPBridgeInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSIPBridgeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSIPBridgeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteSIPBridgeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateSIPParticipantRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SIPParticipantInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendSIPParticipantDTMFRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SIPParticipantDTMFInfo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSIPParticipantRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListSIPParticipantResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_livekit_sip_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteSIPParticipantRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_livekit_sip_proto_rawDesc, + NumEnums: 0, + NumMessages: 17, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_livekit_sip_proto_goTypes, + DependencyIndexes: file_livekit_sip_proto_depIdxs, + MessageInfos: file_livekit_sip_proto_msgTypes, + }.Build() + File_livekit_sip_proto = out.File + file_livekit_sip_proto_rawDesc = nil + file_livekit_sip_proto_goTypes = nil + file_livekit_sip_proto_depIdxs = nil +} diff --git a/livekit/livekit_sip.twirp.go b/livekit/livekit_sip.twirp.go new file mode 100644 index 000000000..a456f501e --- /dev/null +++ b/livekit/livekit_sip.twirp.go @@ -0,0 +1,3080 @@ +// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. +// source: livekit_sip.proto + +package livekit + +import context "context" +import fmt "fmt" +import http "net/http" +import io "io" +import json "encoding/json" +import strconv "strconv" +import strings "strings" + +import protojson "google.golang.org/protobuf/encoding/protojson" +import proto "google.golang.org/protobuf/proto" +import twirp "github.com/twitchtv/twirp" +import ctxsetters "github.com/twitchtv/twirp/ctxsetters" + +// Version compatibility assertion. +// If the constant is not defined in the package, that likely means +// the package needs to be updated to work with this generated code. +// See https://twitchtv.github.io/twirp/docs/version_matrix.html +const _ = twirp.TwirpPackageMinVersion_8_1_0 + +// ============= +// SIP Interface +// ============= + +type SIP interface { + // SIP Trunk APIs + CreateSIPTrunk(context.Context, *CreateSIPTrunkRequest) (*SIPTrunkInfo, error) + + ListSIPTrunk(context.Context, *ListSIPTrunkRequest) (*ListSIPTrunkResponse, error) + + DeleteSIPTrunk(context.Context, *DeleteSIPTrunkRequest) (*SIPTrunkInfo, error) + + // SIP Bridge APIs + CreateSIPBridge(context.Context, *CreateSIPBridgeRequest) (*SIPBridgeInfo, error) + + ListSIPBridge(context.Context, *ListSIPBridgeRequest) (*ListSIPBridgeResponse, error) + + DeleteSIPBridge(context.Context, *DeleteSIPBridgeRequest) (*SIPBridgeInfo, error) + + // SIP Participant APIs + CreateSIPParticipant(context.Context, *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) + + SendSIPParticipantDTMF(context.Context, *SendSIPParticipantDTMFRequest) (*SIPParticipantDTMFInfo, error) + + ListSIPParticipant(context.Context, *ListSIPParticipantRequest) (*ListSIPParticipantResponse, error) + + DeleteSIPParticipant(context.Context, *DeleteSIPParticipantRequest) (*SIPParticipantInfo, error) +} + +// =================== +// SIP Protobuf Client +// =================== + +type sIPProtobufClient struct { + client HTTPClient + urls [10]string + interceptor twirp.Interceptor + opts twirp.ClientOptions +} + +// NewSIPProtobufClient creates a Protobuf client that implements the SIP interface. +// It communicates using Protobuf and can be configured with a custom HTTPClient. +func NewSIPProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) SIP { + if c, ok := client.(*http.Client); ok { + client = withoutRedirects(c) + } + + clientOpts := twirp.ClientOptions{} + for _, o := range opts { + o(&clientOpts) + } + + // Using ReadOpt allows backwards and forwards compatibility with new options in the future + literalURLs := false + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) + var pathPrefix string + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + + // Build method URLs: []/./ + serviceURL := sanitizeBaseURL(baseURL) + serviceURL += baseServicePath(pathPrefix, "livekit", "SIP") + urls := [10]string{ + serviceURL + "CreateSIPTrunk", + serviceURL + "ListSIPTrunk", + serviceURL + "DeleteSIPTrunk", + serviceURL + "CreateSIPBridge", + serviceURL + "ListSIPBridge", + serviceURL + "DeleteSIPBridge", + serviceURL + "CreateSIPParticipant", + serviceURL + "SendSIPParticipantDTMF", + serviceURL + "ListSIPParticipant", + serviceURL + "DeleteSIPParticipant", + } + + return &sIPProtobufClient{ + client: client, + urls: urls, + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), + opts: clientOpts, + } +} + +func (c *sIPProtobufClient) CreateSIPTrunk(ctx context.Context, in *CreateSIPTrunkRequest) (*SIPTrunkInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPTrunk") + caller := c.callCreateSIPTrunk + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSIPTrunkRequest) (*SIPTrunkInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPTrunkRequest) when calling interceptor") + } + return c.callCreateSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPTrunkInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPTrunkInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callCreateSIPTrunk(ctx context.Context, in *CreateSIPTrunkRequest) (*SIPTrunkInfo, error) { + out := new(SIPTrunkInfo) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPProtobufClient) ListSIPTrunk(ctx context.Context, in *ListSIPTrunkRequest) (*ListSIPTrunkResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "ListSIPTrunk") + caller := c.callListSIPTrunk + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSIPTrunkRequest) (*ListSIPTrunkResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPTrunkRequest) when calling interceptor") + } + return c.callListSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPTrunkResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPTrunkResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callListSIPTrunk(ctx context.Context, in *ListSIPTrunkRequest) (*ListSIPTrunkResponse, error) { + out := new(ListSIPTrunkResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPProtobufClient) DeleteSIPTrunk(ctx context.Context, in *DeleteSIPTrunkRequest) (*SIPTrunkInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPTrunk") + caller := c.callDeleteSIPTrunk + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteSIPTrunkRequest) (*SIPTrunkInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPTrunkRequest) when calling interceptor") + } + return c.callDeleteSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPTrunkInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPTrunkInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callDeleteSIPTrunk(ctx context.Context, in *DeleteSIPTrunkRequest) (*SIPTrunkInfo, error) { + out := new(SIPTrunkInfo) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPProtobufClient) CreateSIPBridge(ctx context.Context, in *CreateSIPBridgeRequest) (*SIPBridgeInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPBridge") + caller := c.callCreateSIPBridge + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSIPBridgeRequest) (*SIPBridgeInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPBridgeRequest) when calling interceptor") + } + return c.callCreateSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPBridgeInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPBridgeInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callCreateSIPBridge(ctx context.Context, in *CreateSIPBridgeRequest) (*SIPBridgeInfo, error) { + out := new(SIPBridgeInfo) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPProtobufClient) ListSIPBridge(ctx context.Context, in *ListSIPBridgeRequest) (*ListSIPBridgeResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "ListSIPBridge") + caller := c.callListSIPBridge + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSIPBridgeRequest) (*ListSIPBridgeResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPBridgeRequest) when calling interceptor") + } + return c.callListSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPBridgeResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPBridgeResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callListSIPBridge(ctx context.Context, in *ListSIPBridgeRequest) (*ListSIPBridgeResponse, error) { + out := new(ListSIPBridgeResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPProtobufClient) DeleteSIPBridge(ctx context.Context, in *DeleteSIPBridgeRequest) (*SIPBridgeInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPBridge") + caller := c.callDeleteSIPBridge + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteSIPBridgeRequest) (*SIPBridgeInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPBridgeRequest) when calling interceptor") + } + return c.callDeleteSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPBridgeInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPBridgeInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callDeleteSIPBridge(ctx context.Context, in *DeleteSIPBridgeRequest) (*SIPBridgeInfo, error) { + out := new(SIPBridgeInfo) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[5], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPProtobufClient) CreateSIPParticipant(ctx context.Context, in *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPParticipant") + caller := c.callCreateSIPParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPParticipantRequest) when calling interceptor") + } + return c.callCreateSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callCreateSIPParticipant(ctx context.Context, in *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) { + out := new(SIPParticipantInfo) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[6], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPProtobufClient) SendSIPParticipantDTMF(ctx context.Context, in *SendSIPParticipantDTMFRequest) (*SIPParticipantDTMFInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "SendSIPParticipantDTMF") + caller := c.callSendSIPParticipantDTMF + if c.interceptor != nil { + caller = func(ctx context.Context, req *SendSIPParticipantDTMFRequest) (*SIPParticipantDTMFInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*SendSIPParticipantDTMFRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*SendSIPParticipantDTMFRequest) when calling interceptor") + } + return c.callSendSIPParticipantDTMF(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantDTMFInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantDTMFInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callSendSIPParticipantDTMF(ctx context.Context, in *SendSIPParticipantDTMFRequest) (*SIPParticipantDTMFInfo, error) { + out := new(SIPParticipantDTMFInfo) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[7], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPProtobufClient) ListSIPParticipant(ctx context.Context, in *ListSIPParticipantRequest) (*ListSIPParticipantResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "ListSIPParticipant") + caller := c.callListSIPParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSIPParticipantRequest) (*ListSIPParticipantResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPParticipantRequest) when calling interceptor") + } + return c.callListSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPParticipantResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPParticipantResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callListSIPParticipant(ctx context.Context, in *ListSIPParticipantRequest) (*ListSIPParticipantResponse, error) { + out := new(ListSIPParticipantResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[8], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPProtobufClient) DeleteSIPParticipant(ctx context.Context, in *DeleteSIPParticipantRequest) (*SIPParticipantInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPParticipant") + caller := c.callDeleteSIPParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteSIPParticipantRequest) (*SIPParticipantInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPParticipantRequest) when calling interceptor") + } + return c.callDeleteSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPProtobufClient) callDeleteSIPParticipant(ctx context.Context, in *DeleteSIPParticipantRequest) (*SIPParticipantInfo, error) { + out := new(SIPParticipantInfo) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[9], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +// =============== +// SIP JSON Client +// =============== + +type sIPJSONClient struct { + client HTTPClient + urls [10]string + interceptor twirp.Interceptor + opts twirp.ClientOptions +} + +// NewSIPJSONClient creates a JSON client that implements the SIP interface. +// It communicates using JSON and can be configured with a custom HTTPClient. +func NewSIPJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) SIP { + if c, ok := client.(*http.Client); ok { + client = withoutRedirects(c) + } + + clientOpts := twirp.ClientOptions{} + for _, o := range opts { + o(&clientOpts) + } + + // Using ReadOpt allows backwards and forwards compatibility with new options in the future + literalURLs := false + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) + var pathPrefix string + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + + // Build method URLs: []/./ + serviceURL := sanitizeBaseURL(baseURL) + serviceURL += baseServicePath(pathPrefix, "livekit", "SIP") + urls := [10]string{ + serviceURL + "CreateSIPTrunk", + serviceURL + "ListSIPTrunk", + serviceURL + "DeleteSIPTrunk", + serviceURL + "CreateSIPBridge", + serviceURL + "ListSIPBridge", + serviceURL + "DeleteSIPBridge", + serviceURL + "CreateSIPParticipant", + serviceURL + "SendSIPParticipantDTMF", + serviceURL + "ListSIPParticipant", + serviceURL + "DeleteSIPParticipant", + } + + return &sIPJSONClient{ + client: client, + urls: urls, + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), + opts: clientOpts, + } +} + +func (c *sIPJSONClient) CreateSIPTrunk(ctx context.Context, in *CreateSIPTrunkRequest) (*SIPTrunkInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPTrunk") + caller := c.callCreateSIPTrunk + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSIPTrunkRequest) (*SIPTrunkInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPTrunkRequest) when calling interceptor") + } + return c.callCreateSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPTrunkInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPTrunkInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callCreateSIPTrunk(ctx context.Context, in *CreateSIPTrunkRequest) (*SIPTrunkInfo, error) { + out := new(SIPTrunkInfo) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPJSONClient) ListSIPTrunk(ctx context.Context, in *ListSIPTrunkRequest) (*ListSIPTrunkResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "ListSIPTrunk") + caller := c.callListSIPTrunk + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSIPTrunkRequest) (*ListSIPTrunkResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPTrunkRequest) when calling interceptor") + } + return c.callListSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPTrunkResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPTrunkResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callListSIPTrunk(ctx context.Context, in *ListSIPTrunkRequest) (*ListSIPTrunkResponse, error) { + out := new(ListSIPTrunkResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPJSONClient) DeleteSIPTrunk(ctx context.Context, in *DeleteSIPTrunkRequest) (*SIPTrunkInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPTrunk") + caller := c.callDeleteSIPTrunk + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteSIPTrunkRequest) (*SIPTrunkInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPTrunkRequest) when calling interceptor") + } + return c.callDeleteSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPTrunkInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPTrunkInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callDeleteSIPTrunk(ctx context.Context, in *DeleteSIPTrunkRequest) (*SIPTrunkInfo, error) { + out := new(SIPTrunkInfo) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPJSONClient) CreateSIPBridge(ctx context.Context, in *CreateSIPBridgeRequest) (*SIPBridgeInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPBridge") + caller := c.callCreateSIPBridge + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSIPBridgeRequest) (*SIPBridgeInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPBridgeRequest) when calling interceptor") + } + return c.callCreateSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPBridgeInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPBridgeInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callCreateSIPBridge(ctx context.Context, in *CreateSIPBridgeRequest) (*SIPBridgeInfo, error) { + out := new(SIPBridgeInfo) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPJSONClient) ListSIPBridge(ctx context.Context, in *ListSIPBridgeRequest) (*ListSIPBridgeResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "ListSIPBridge") + caller := c.callListSIPBridge + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSIPBridgeRequest) (*ListSIPBridgeResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPBridgeRequest) when calling interceptor") + } + return c.callListSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPBridgeResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPBridgeResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callListSIPBridge(ctx context.Context, in *ListSIPBridgeRequest) (*ListSIPBridgeResponse, error) { + out := new(ListSIPBridgeResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPJSONClient) DeleteSIPBridge(ctx context.Context, in *DeleteSIPBridgeRequest) (*SIPBridgeInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPBridge") + caller := c.callDeleteSIPBridge + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteSIPBridgeRequest) (*SIPBridgeInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPBridgeRequest) when calling interceptor") + } + return c.callDeleteSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPBridgeInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPBridgeInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callDeleteSIPBridge(ctx context.Context, in *DeleteSIPBridgeRequest) (*SIPBridgeInfo, error) { + out := new(SIPBridgeInfo) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[5], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPJSONClient) CreateSIPParticipant(ctx context.Context, in *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPParticipant") + caller := c.callCreateSIPParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPParticipantRequest) when calling interceptor") + } + return c.callCreateSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callCreateSIPParticipant(ctx context.Context, in *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) { + out := new(SIPParticipantInfo) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[6], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPJSONClient) SendSIPParticipantDTMF(ctx context.Context, in *SendSIPParticipantDTMFRequest) (*SIPParticipantDTMFInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "SendSIPParticipantDTMF") + caller := c.callSendSIPParticipantDTMF + if c.interceptor != nil { + caller = func(ctx context.Context, req *SendSIPParticipantDTMFRequest) (*SIPParticipantDTMFInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*SendSIPParticipantDTMFRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*SendSIPParticipantDTMFRequest) when calling interceptor") + } + return c.callSendSIPParticipantDTMF(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantDTMFInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantDTMFInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callSendSIPParticipantDTMF(ctx context.Context, in *SendSIPParticipantDTMFRequest) (*SIPParticipantDTMFInfo, error) { + out := new(SIPParticipantDTMFInfo) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[7], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPJSONClient) ListSIPParticipant(ctx context.Context, in *ListSIPParticipantRequest) (*ListSIPParticipantResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "ListSIPParticipant") + caller := c.callListSIPParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSIPParticipantRequest) (*ListSIPParticipantResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPParticipantRequest) when calling interceptor") + } + return c.callListSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPParticipantResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPParticipantResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callListSIPParticipant(ctx context.Context, in *ListSIPParticipantRequest) (*ListSIPParticipantResponse, error) { + out := new(ListSIPParticipantResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[8], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *sIPJSONClient) DeleteSIPParticipant(ctx context.Context, in *DeleteSIPParticipantRequest) (*SIPParticipantInfo, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPParticipant") + caller := c.callDeleteSIPParticipant + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteSIPParticipantRequest) (*SIPParticipantInfo, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPParticipantRequest) when calling interceptor") + } + return c.callDeleteSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *sIPJSONClient) callDeleteSIPParticipant(ctx context.Context, in *DeleteSIPParticipantRequest) (*SIPParticipantInfo, error) { + out := new(SIPParticipantInfo) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[9], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +// ================== +// SIP Server Handler +// ================== + +type sIPServer struct { + SIP + interceptor twirp.Interceptor + hooks *twirp.ServerHooks + pathPrefix string // prefix for routing + jsonSkipDefaults bool // do not include unpopulated fields (default values) in the response + jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names +} + +// NewSIPServer builds a TwirpServer that can be used as an http.Handler to handle +// HTTP requests that are routed to the right method in the provided svc implementation. +// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). +func NewSIPServer(svc SIP, opts ...interface{}) TwirpServer { + serverOpts := newServerOpts(opts) + + // Using ReadOpt allows backwards and forwards compatibility with new options in the future + jsonSkipDefaults := false + _ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults) + jsonCamelCase := false + _ = serverOpts.ReadOpt("jsonCamelCase", &jsonCamelCase) + var pathPrefix string + if ok := serverOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + + return &sIPServer{ + SIP: svc, + hooks: serverOpts.Hooks, + interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), + pathPrefix: pathPrefix, + jsonSkipDefaults: jsonSkipDefaults, + jsonCamelCase: jsonCamelCase, + } +} + +// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks. +// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) +func (s *sIPServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { + writeError(ctx, resp, err, s.hooks) +} + +// handleRequestBodyError is used to handle error when the twirp server cannot read request +func (s *sIPServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { + if context.Canceled == ctx.Err() { + s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) + return + } + if context.DeadlineExceeded == ctx.Err() { + s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded")) + return + } + s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) +} + +// SIPPathPrefix is a convenience constant that may identify URL paths. +// Should be used with caution, it only matches routes generated by Twirp Go clients, +// with the default "/twirp" prefix and default CamelCase service and method names. +// More info: https://twitchtv.github.io/twirp/docs/routing.html +const SIPPathPrefix = "/twirp/livekit.SIP/" + +func (s *sIPServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { + ctx := req.Context() + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "SIP") + ctx = ctxsetters.WithResponseWriter(ctx, resp) + + var err error + ctx, err = callRequestReceived(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + if req.Method != "POST" { + msg := fmt.Sprintf("unsupported method %q (only POST is allowed)", req.Method) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } + + // Verify path format: []/./ + prefix, pkgService, method := parseTwirpPath(req.URL.Path) + if pkgService != "livekit.SIP" { + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } + if prefix != s.pathPrefix { + msg := fmt.Sprintf("invalid path prefix %q, expected %q, on path %q", prefix, s.pathPrefix, req.URL.Path) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } + + switch method { + case "CreateSIPTrunk": + s.serveCreateSIPTrunk(ctx, resp, req) + return + case "ListSIPTrunk": + s.serveListSIPTrunk(ctx, resp, req) + return + case "DeleteSIPTrunk": + s.serveDeleteSIPTrunk(ctx, resp, req) + return + case "CreateSIPBridge": + s.serveCreateSIPBridge(ctx, resp, req) + return + case "ListSIPBridge": + s.serveListSIPBridge(ctx, resp, req) + return + case "DeleteSIPBridge": + s.serveDeleteSIPBridge(ctx, resp, req) + return + case "CreateSIPParticipant": + s.serveCreateSIPParticipant(ctx, resp, req) + return + case "SendSIPParticipantDTMF": + s.serveSendSIPParticipantDTMF(ctx, resp, req) + return + case "ListSIPParticipant": + s.serveListSIPParticipant(ctx, resp, req) + return + case "DeleteSIPParticipant": + s.serveDeleteSIPParticipant(ctx, resp, req) + return + default: + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } +} + +func (s *sIPServer) serveCreateSIPTrunk(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveCreateSIPTrunkJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateSIPTrunkProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveCreateSIPTrunkJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPTrunk") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(CreateSIPTrunkRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.CreateSIPTrunk + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSIPTrunkRequest) (*SIPTrunkInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPTrunkRequest) when calling interceptor") + } + return s.SIP.CreateSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPTrunkInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPTrunkInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPTrunkInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPTrunkInfo and nil error while calling CreateSIPTrunk. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveCreateSIPTrunkProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPTrunk") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(CreateSIPTrunkRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.CreateSIPTrunk + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSIPTrunkRequest) (*SIPTrunkInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPTrunkRequest) when calling interceptor") + } + return s.SIP.CreateSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPTrunkInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPTrunkInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPTrunkInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPTrunkInfo and nil error while calling CreateSIPTrunk. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveListSIPTrunk(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveListSIPTrunkJSON(ctx, resp, req) + case "application/protobuf": + s.serveListSIPTrunkProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveListSIPTrunkJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSIPTrunk") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(ListSIPTrunkRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.ListSIPTrunk + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSIPTrunkRequest) (*ListSIPTrunkResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPTrunkRequest) when calling interceptor") + } + return s.SIP.ListSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPTrunkResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPTrunkResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSIPTrunkResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSIPTrunkResponse and nil error while calling ListSIPTrunk. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveListSIPTrunkProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSIPTrunk") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(ListSIPTrunkRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.ListSIPTrunk + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSIPTrunkRequest) (*ListSIPTrunkResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPTrunkRequest) when calling interceptor") + } + return s.SIP.ListSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPTrunkResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPTrunkResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSIPTrunkResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSIPTrunkResponse and nil error while calling ListSIPTrunk. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveDeleteSIPTrunk(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveDeleteSIPTrunkJSON(ctx, resp, req) + case "application/protobuf": + s.serveDeleteSIPTrunkProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveDeleteSIPTrunkJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPTrunk") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(DeleteSIPTrunkRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.DeleteSIPTrunk + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteSIPTrunkRequest) (*SIPTrunkInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPTrunkRequest) when calling interceptor") + } + return s.SIP.DeleteSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPTrunkInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPTrunkInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPTrunkInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPTrunkInfo and nil error while calling DeleteSIPTrunk. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveDeleteSIPTrunkProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPTrunk") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(DeleteSIPTrunkRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.DeleteSIPTrunk + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteSIPTrunkRequest) (*SIPTrunkInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPTrunkRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPTrunkRequest) when calling interceptor") + } + return s.SIP.DeleteSIPTrunk(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPTrunkInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPTrunkInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPTrunkInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPTrunkInfo and nil error while calling DeleteSIPTrunk. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveCreateSIPBridge(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveCreateSIPBridgeJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateSIPBridgeProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveCreateSIPBridgeJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPBridge") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(CreateSIPBridgeRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.CreateSIPBridge + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSIPBridgeRequest) (*SIPBridgeInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPBridgeRequest) when calling interceptor") + } + return s.SIP.CreateSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPBridgeInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPBridgeInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPBridgeInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPBridgeInfo and nil error while calling CreateSIPBridge. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveCreateSIPBridgeProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPBridge") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(CreateSIPBridgeRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.CreateSIPBridge + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSIPBridgeRequest) (*SIPBridgeInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPBridgeRequest) when calling interceptor") + } + return s.SIP.CreateSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPBridgeInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPBridgeInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPBridgeInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPBridgeInfo and nil error while calling CreateSIPBridge. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveListSIPBridge(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveListSIPBridgeJSON(ctx, resp, req) + case "application/protobuf": + s.serveListSIPBridgeProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveListSIPBridgeJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSIPBridge") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(ListSIPBridgeRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.ListSIPBridge + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSIPBridgeRequest) (*ListSIPBridgeResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPBridgeRequest) when calling interceptor") + } + return s.SIP.ListSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPBridgeResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPBridgeResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSIPBridgeResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSIPBridgeResponse and nil error while calling ListSIPBridge. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveListSIPBridgeProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSIPBridge") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(ListSIPBridgeRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.ListSIPBridge + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSIPBridgeRequest) (*ListSIPBridgeResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPBridgeRequest) when calling interceptor") + } + return s.SIP.ListSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPBridgeResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPBridgeResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSIPBridgeResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSIPBridgeResponse and nil error while calling ListSIPBridge. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveDeleteSIPBridge(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveDeleteSIPBridgeJSON(ctx, resp, req) + case "application/protobuf": + s.serveDeleteSIPBridgeProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveDeleteSIPBridgeJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPBridge") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(DeleteSIPBridgeRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.DeleteSIPBridge + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteSIPBridgeRequest) (*SIPBridgeInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPBridgeRequest) when calling interceptor") + } + return s.SIP.DeleteSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPBridgeInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPBridgeInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPBridgeInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPBridgeInfo and nil error while calling DeleteSIPBridge. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveDeleteSIPBridgeProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPBridge") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(DeleteSIPBridgeRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.DeleteSIPBridge + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteSIPBridgeRequest) (*SIPBridgeInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPBridgeRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPBridgeRequest) when calling interceptor") + } + return s.SIP.DeleteSIPBridge(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPBridgeInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPBridgeInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPBridgeInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPBridgeInfo and nil error while calling DeleteSIPBridge. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveCreateSIPParticipant(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveCreateSIPParticipantJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateSIPParticipantProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveCreateSIPParticipantJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(CreateSIPParticipantRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.CreateSIPParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPParticipantRequest) when calling interceptor") + } + return s.SIP.CreateSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPParticipantInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPParticipantInfo and nil error while calling CreateSIPParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveCreateSIPParticipantProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSIPParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(CreateSIPParticipantRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.CreateSIPParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSIPParticipantRequest) (*SIPParticipantInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSIPParticipantRequest) when calling interceptor") + } + return s.SIP.CreateSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPParticipantInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPParticipantInfo and nil error while calling CreateSIPParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveSendSIPParticipantDTMF(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveSendSIPParticipantDTMFJSON(ctx, resp, req) + case "application/protobuf": + s.serveSendSIPParticipantDTMFProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveSendSIPParticipantDTMFJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "SendSIPParticipantDTMF") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(SendSIPParticipantDTMFRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.SendSIPParticipantDTMF + if s.interceptor != nil { + handler = func(ctx context.Context, req *SendSIPParticipantDTMFRequest) (*SIPParticipantDTMFInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*SendSIPParticipantDTMFRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*SendSIPParticipantDTMFRequest) when calling interceptor") + } + return s.SIP.SendSIPParticipantDTMF(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantDTMFInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantDTMFInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPParticipantDTMFInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPParticipantDTMFInfo and nil error while calling SendSIPParticipantDTMF. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveSendSIPParticipantDTMFProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "SendSIPParticipantDTMF") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(SendSIPParticipantDTMFRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.SendSIPParticipantDTMF + if s.interceptor != nil { + handler = func(ctx context.Context, req *SendSIPParticipantDTMFRequest) (*SIPParticipantDTMFInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*SendSIPParticipantDTMFRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*SendSIPParticipantDTMFRequest) when calling interceptor") + } + return s.SIP.SendSIPParticipantDTMF(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantDTMFInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantDTMFInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPParticipantDTMFInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPParticipantDTMFInfo and nil error while calling SendSIPParticipantDTMF. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveListSIPParticipant(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveListSIPParticipantJSON(ctx, resp, req) + case "application/protobuf": + s.serveListSIPParticipantProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveListSIPParticipantJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSIPParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(ListSIPParticipantRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.ListSIPParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSIPParticipantRequest) (*ListSIPParticipantResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPParticipantRequest) when calling interceptor") + } + return s.SIP.ListSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPParticipantResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPParticipantResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSIPParticipantResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSIPParticipantResponse and nil error while calling ListSIPParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveListSIPParticipantProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSIPParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(ListSIPParticipantRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.ListSIPParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSIPParticipantRequest) (*ListSIPParticipantResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSIPParticipantRequest) when calling interceptor") + } + return s.SIP.ListSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSIPParticipantResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSIPParticipantResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSIPParticipantResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSIPParticipantResponse and nil error while calling ListSIPParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveDeleteSIPParticipant(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveDeleteSIPParticipantJSON(ctx, resp, req) + case "application/protobuf": + s.serveDeleteSIPParticipantProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *sIPServer) serveDeleteSIPParticipantJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(DeleteSIPParticipantRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.SIP.DeleteSIPParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteSIPParticipantRequest) (*SIPParticipantInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPParticipantRequest) when calling interceptor") + } + return s.SIP.DeleteSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPParticipantInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPParticipantInfo and nil error while calling DeleteSIPParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) serveDeleteSIPParticipantProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteSIPParticipant") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(DeleteSIPParticipantRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.SIP.DeleteSIPParticipant + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteSIPParticipantRequest) (*SIPParticipantInfo, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteSIPParticipantRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteSIPParticipantRequest) when calling interceptor") + } + return s.SIP.DeleteSIPParticipant(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*SIPParticipantInfo) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*SIPParticipantInfo) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *SIPParticipantInfo + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *SIPParticipantInfo and nil error while calling DeleteSIPParticipant. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *sIPServer) ServiceDescriptor() ([]byte, int) { + return twirpFileDescriptor3, 0 +} + +func (s *sIPServer) ProtocGenTwirpVersion() string { + return "v8.1.3" +} + +// PathPrefix returns the base service path, in the form: "//./" +// that is everything in a Twirp route except for the . This can be used for routing, +// for example to identify the requests that are targeted to this service in a mux. +func (s *sIPServer) PathPrefix() string { + return baseServicePath(s.pathPrefix, "livekit", "SIP") +} + +var twirpFileDescriptor3 = []byte{ + // 720 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdb, 0x4e, 0xdb, 0x40, + 0x10, 0x55, 0x92, 0x42, 0xc9, 0x40, 0x02, 0x6c, 0x13, 0x2b, 0x75, 0xb8, 0x44, 0x4b, 0x55, 0x45, + 0x2d, 0x0a, 0x2d, 0x3c, 0x15, 0xf5, 0x89, 0x4b, 0x50, 0x80, 0xd2, 0x28, 0xf0, 0x42, 0xa5, 0xca, + 0x32, 0x78, 0x49, 0x57, 0xc4, 0x5e, 0xd7, 0xbb, 0x41, 0xea, 0x2f, 0xf5, 0x3b, 0xfa, 0x29, 0x7d, + 0xea, 0x57, 0x54, 0x76, 0xd6, 0x8e, 0xd7, 0x97, 0x14, 0xfa, 0x16, 0xcf, 0xcc, 0xce, 0x9c, 0x39, + 0x67, 0x66, 0x14, 0x58, 0x1d, 0xd1, 0x07, 0x72, 0x4f, 0x85, 0xc1, 0xa9, 0xdb, 0x71, 0x3d, 0x26, + 0x18, 0x7a, 0x2e, 0x4d, 0x7a, 0x2d, 0xf4, 0xd9, 0xcc, 0x22, 0x23, 0x3e, 0x71, 0xe3, 0x63, 0xa8, + 0x1f, 0x7a, 0xc4, 0x14, 0xe4, 0xb2, 0xd7, 0xbf, 0xf2, 0xc6, 0xce, 0xfd, 0x80, 0x7c, 0x1f, 0x13, + 0x2e, 0xd0, 0x1a, 0x94, 0x4d, 0xcb, 0xf2, 0x08, 0xe7, 0x84, 0x37, 0x0a, 0xad, 0x52, 0xbb, 0x3c, + 0x98, 0x1a, 0x50, 0x15, 0x8a, 0x82, 0x35, 0x8a, 0xad, 0x42, 0xbb, 0x3c, 0x28, 0x0a, 0x86, 0xdf, + 0xc1, 0x52, 0x98, 0xa0, 0xe7, 0xdc, 0x31, 0xd4, 0x82, 0x25, 0x4e, 0x5d, 0x43, 0xf8, 0x06, 0x83, + 0x5a, 0x8d, 0x42, 0x10, 0x09, 0x9c, 0xba, 0x93, 0x18, 0x0b, 0xd7, 0xe1, 0xc5, 0x39, 0xe5, 0x22, + 0x51, 0x16, 0x1f, 0x42, 0x4d, 0x35, 0x73, 0x97, 0x39, 0x9c, 0xa0, 0xb7, 0x30, 0x47, 0x05, 0xb1, + 0x27, 0x50, 0x16, 0x77, 0xeb, 0x1d, 0xd9, 0x4d, 0x27, 0x5e, 0x76, 0x30, 0x89, 0xc1, 0x1f, 0xa0, + 0x7e, 0x44, 0x46, 0x24, 0xdd, 0xd4, 0xbf, 0x61, 0xfd, 0x2e, 0x80, 0x16, 0x11, 0x72, 0xe0, 0x51, + 0x6b, 0x48, 0xc2, 0xc7, 0x4d, 0x28, 0x7b, 0x8c, 0xd9, 0x86, 0x63, 0xda, 0x44, 0xbe, 0x5c, 0xf0, + 0x0d, 0x17, 0xa6, 0x4d, 0xd0, 0x1b, 0x58, 0x35, 0xc7, 0x82, 0x19, 0x37, 0xc1, 0x93, 0x49, 0x05, + 0xc9, 0xcf, 0xb2, 0xef, 0x98, 0xa4, 0x0a, 0xaa, 0xa0, 0x36, 0xac, 0xc4, 0x63, 0xef, 0x3c, 0x66, + 0x37, 0x4a, 0x41, 0x68, 0x75, 0x1a, 0xda, 0xf5, 0x98, 0x8d, 0x56, 0xa0, 0xe4, 0x52, 0xa7, 0xf1, + 0x2c, 0x70, 0xfa, 0x3f, 0xd1, 0x31, 0x6c, 0x8e, 0x39, 0x31, 0x3c, 0xd3, 0xb1, 0x98, 0x6d, 0xb8, + 0xa6, 0x27, 0xe8, 0x2d, 0x75, 0x4d, 0x47, 0x18, 0xd4, 0x22, 0x8e, 0xa0, 0xe2, 0x47, 0x63, 0xae, + 0x55, 0x68, 0x2f, 0x0c, 0xd6, 0xc6, 0x9c, 0x0c, 0x82, 0xa8, 0xfe, 0x34, 0xa8, 0x27, 0x63, 0xf0, + 0x1e, 0x54, 0xa2, 0xfe, 0x02, 0xc1, 0x30, 0x54, 0x7c, 0x66, 0x24, 0xa4, 0x88, 0x9a, 0x45, 0x4e, + 0x5d, 0x19, 0x65, 0x61, 0x2d, 0xd2, 0x46, 0x21, 0xc6, 0x9f, 0xa1, 0x84, 0x5d, 0x8a, 0xb6, 0xad, + 0x8a, 0xa6, 0xc5, 0x45, 0x9b, 0xd6, 0x0e, 0x55, 0xfb, 0x08, 0x5a, 0xa4, 0x9a, 0xca, 0xfc, 0x63, + 0xc0, 0x8d, 0xa0, 0x19, 0xe9, 0x16, 0xeb, 0xf8, 0x51, 0xe2, 0x25, 0xc7, 0xa2, 0x98, 0x1c, 0x0b, + 0x39, 0xef, 0xa5, 0x68, 0xde, 0x0f, 0x00, 0xa9, 0x75, 0x02, 0x12, 0xb7, 0x01, 0xf9, 0x79, 0x54, + 0x55, 0x64, 0xb5, 0x15, 0x4e, 0x5d, 0x45, 0x09, 0x4c, 0x60, 0xfd, 0x92, 0x38, 0x96, 0x9a, 0xe7, + 0xe8, 0xea, 0x53, 0x37, 0xc4, 0xfc, 0xa4, 0x74, 0x48, 0x83, 0x79, 0x8b, 0x0e, 0xa9, 0xe0, 0x12, + 0xbe, 0xfc, 0xc2, 0x5d, 0xd0, 0xd2, 0x25, 0xfe, 0x03, 0x6e, 0x13, 0x5e, 0x4a, 0x95, 0xd3, 0xf4, + 0xe2, 0xcf, 0xa0, 0x67, 0x39, 0xe5, 0x1c, 0xbc, 0x57, 0xe7, 0xa0, 0x19, 0x9f, 0x83, 0x04, 0x87, + 0xe1, 0x30, 0x9c, 0x41, 0x33, 0x1a, 0x86, 0x0c, 0x39, 0x9f, 0x04, 0x7d, 0xf7, 0xd7, 0x3c, 0x94, + 0x2e, 0x7b, 0x7d, 0x74, 0x02, 0x55, 0xf5, 0xd8, 0xa1, 0x8d, 0x08, 0x4a, 0xe6, 0x15, 0xd4, 0xb3, + 0xef, 0x0c, 0x3a, 0x83, 0xa5, 0xf8, 0x95, 0x42, 0x6b, 0x51, 0x58, 0xc6, 0x4d, 0xd3, 0xd7, 0x73, + 0xbc, 0x92, 0x9d, 0x13, 0xa8, 0xaa, 0xd7, 0x2a, 0x86, 0x2a, 0xf3, 0x8c, 0xe5, 0xa1, 0x3a, 0x85, + 0xe5, 0xc4, 0xe9, 0x42, 0x9b, 0xe9, 0xfe, 0x94, 0xd5, 0xd2, 0x73, 0x76, 0x12, 0x5d, 0x40, 0x45, + 0xd9, 0x69, 0x94, 0x6a, 0x42, 0xcd, 0xb3, 0x91, 0xe7, 0x96, 0x4d, 0x9e, 0xc2, 0x72, 0x62, 0xb9, + 0x63, 0xd8, 0xb2, 0xd7, 0x3e, 0x17, 0xdb, 0x35, 0xd4, 0xb2, 0x56, 0x1d, 0xbd, 0x4a, 0x37, 0x9b, + 0x1e, 0x1d, 0x7d, 0xd6, 0xf4, 0x21, 0x13, 0xb4, 0xec, 0x9d, 0x44, 0xaf, 0xa7, 0xcf, 0x66, 0x2d, + 0xad, 0xbe, 0x99, 0x93, 0x3e, 0xda, 0xba, 0xaf, 0x80, 0xd2, 0xab, 0x82, 0x70, 0x92, 0xbf, 0x0c, + 0xe4, 0x5b, 0x33, 0x63, 0x24, 0xd1, 0xd7, 0x50, 0xcb, 0x5a, 0x9c, 0x18, 0x39, 0x33, 0xf6, 0x6a, + 0x26, 0x39, 0x07, 0xdd, 0x2f, 0x5b, 0x43, 0x2a, 0xbe, 0x8d, 0x6f, 0x3a, 0xb7, 0xcc, 0xde, 0x91, + 0x81, 0x3b, 0xc1, 0xff, 0x88, 0x5b, 0x36, 0x0a, 0x0d, 0x3f, 0x8b, 0x95, 0x73, 0xfa, 0x40, 0xce, + 0xa8, 0xe8, 0xf4, 0x7d, 0xd7, 0x9f, 0x62, 0x55, 0x7e, 0xef, 0xef, 0x07, 0x86, 0x9b, 0xf9, 0xe0, + 0xc9, 0xde, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x72, 0x84, 0xc1, 0xf2, 0xae, 0x08, 0x00, 0x00, +} diff --git a/livekit/livekit_webhook.pb.go b/livekit/livekit_webhook.pb.go index 5b330c83a..4692b5ebe 100644 --- a/livekit/livekit_webhook.pb.go +++ b/livekit/livekit_webhook.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: livekit_webhook.proto package livekit diff --git a/livekit_sip.proto b/livekit_sip.proto new file mode 100644 index 000000000..cdf89db0b --- /dev/null +++ b/livekit_sip.proto @@ -0,0 +1,163 @@ +// Copyright 2023 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 livekit; + +import "livekit_models.proto"; + +option go_package = "github.com/livekit/protocol/livekit"; +option csharp_namespace = "LiveKit.Proto"; +option ruby_package = "LiveKit::Proto"; + +service SIP { + // SIP Trunk APIs + rpc CreateSIPTrunk(CreateSIPTrunkRequest) returns (SIPTrunkInfo); + rpc ListSIPTrunk(ListSIPTrunkRequest) returns (ListSIPTrunkResponse); + rpc DeleteSIPTrunk(DeleteSIPTrunkRequest) returns (SIPTrunkInfo); + + // SIP Bridge APIs + rpc CreateSIPBridge(CreateSIPBridgeRequest) returns (SIPBridgeInfo); + rpc ListSIPBridge(ListSIPBridgeRequest) returns (ListSIPBridgeResponse); + rpc DeleteSIPBridge(DeleteSIPBridgeRequest) returns (SIPBridgeInfo); + + // SIP Participant APIs + rpc CreateSIPParticipant(CreateSIPParticipantRequest) returns (SIPParticipantInfo); + rpc SendSIPParticipantDTMF(SendSIPParticipantDTMFRequest) returns (SIPParticipantDTMFInfo); + rpc ListSIPParticipant(ListSIPParticipantRequest) returns (ListSIPParticipantResponse); + rpc DeleteSIPParticipant(DeleteSIPParticipantRequest) returns (SIPParticipantInfo); +} + +// A SIP Trunk is used to accept incoming traffic or make outbound calls +// The handling of the inbound traffic is configured with a SIPBridge +message CreateSIPTrunkRequest { + // CIDR or IPs that are allowed to send INVITEs and where Invites will be sent too + repeated string addresses = 1; + + // To value that will be used when sending an Invite + string to = 2; + +} + +message SIPTrunkInfo { + string sip_trunk_id = 1; +} + +message ListSIPTrunkRequest { +} + +message ListSIPTrunkResponse { + repeated SIPTrunkInfo items = 1; +} + +message DeleteSIPTrunkRequest { + string sip_trunk_id = 1; +} + + +// A SIP Bridge is used to route traffic to a LiveKit room. A bridge +// can have many different behaviors +// +// * `auto_bridge_trunk` is set +// The call is routed into the configured LiveKit Room automatically +// if received on the configured trunk +// +// * `auto_bridge_trunk` and `pin` is set +// The call is routed into the configured LiveKit Room automatically +// if received on the configured trunk and the correct pin is entered +// +// * Only `pin` is set +// User is prompted for a Pin. User is put into the room matching the pinh +// +// * `auto_bridge_from` is set +// User is added to a room if value matches calling phone number +// +// * `auto_bridge_from` is set and `pin` is set +// User is added to a room if value matches calling phone number and the +// correct pin is entered +// +message CreateSIPBridgeRequest { + // What Room is this SIP Traffic Bridged into + string room_name = 1; + + // If call is received on specified Trunk bridge into the room + string auto_bridge_trunk = 2; + + // If call is received from a specific number bridge into the room + string auto_bridge_from = 3; + + // Pin required to use this bridge + string pin = 4; + + // By default the From value (Phone number) is used as the participant identity + // If true a random value will be used instead + bool use_random_participant_identity = 5; +} + +message SIPBridgeInfo { + string sip_bridge_id = 1; +} + +message ListSIPBridgeRequest { +} + +message ListSIPBridgeResponse { + repeated SIPBridgeInfo items = 1; +} + +message DeleteSIPBridgeRequest { + string sip_bridge_id = 1; +} + +// A SIP Participant is a singular SIP session connected to a LiveKit room via +// a SIP Trunk into a SIP Bridge +message CreateSIPParticipantRequest { + // What LiveKit room should this participant be connected too + string room_name = 1; + + // What SIP Trunk should be used to dial the user + string sip_trunk_id = 2; + + // What To value should be used + string to = 3; +} + +message SIPParticipantInfo { + string sip_participant_id = 1; +} + +// DTMF Request lets you send a DTMF message for a SIP Participant +message SendSIPParticipantDTMFRequest { + // What SIP Participant to send this DTMF for + string sip_participant_id = 1; + + // Digits that will be sent via DTMF + string digits = 2; +} + +message SIPParticipantDTMFInfo { + string sip_participant_id = 1; +} + +message ListSIPParticipantRequest { +} + +message ListSIPParticipantResponse { + repeated SIPParticipantInfo items = 1; +} + +message DeleteSIPParticipantRequest { + string sip_participant_id = 1; +} diff --git a/magefile.go b/magefile.go index 467b49ccd..fbe821850 100644 --- a/magefile.go +++ b/magefile.go @@ -46,6 +46,7 @@ func Proto() error { "livekit_egress.proto", "livekit_ingress.proto", "livekit_room.proto", + "livekit_sip.proto", } grpcProtoFiles := []string{ "livekit_analytics.proto", diff --git a/rpc/egress.pb.go b/rpc/egress.pb.go index 2eb36a9d3..5d07fc3f7 100644 --- a/rpc/egress.pb.go +++ b/rpc/egress.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: rpc/egress.proto package rpc diff --git a/rpc/ingress.pb.go b/rpc/ingress.pb.go index f00b198c3..f0da1fd52 100644 --- a/rpc/ingress.pb.go +++ b/rpc/ingress.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: rpc/ingress.proto package rpc diff --git a/rpc/io.pb.go b/rpc/io.pb.go index 348dcb577..02a74ead8 100644 --- a/rpc/io.pb.go +++ b/rpc/io.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: rpc/io.proto package rpc diff --git a/rpc/room.pb.go b/rpc/room.pb.go index 2839f01e7..a4d73b7b3 100644 --- a/rpc/room.pb.go +++ b/rpc/room.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: rpc/room.proto package rpc diff --git a/rpc/signal.pb.go b/rpc/signal.pb.go index f7a95aaf6..8a5730d8a 100644 --- a/rpc/signal.pb.go +++ b/rpc/signal.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v4.23.4 +// protoc v4.24.4 // source: rpc/signal.proto package rpc