Files
protocol/rpc/sip.psrpc.go
David Zhao e0c49d3c9d Support for key/value attributes on Participant (#733)
* Support for key/value attributes on Participant

Key/value attributes lets us:
* allow various components to provide more information about the participant (i.e. SIP including the phone number)
* allow Agents to communicate their own status to the end user via RTC
* enable applications to update specific fields without overriding others

* generated protobuf

* Attribute support for SIP.

* generated protobuf

* generated protobuf

* allow specifying attributes during token generation

* Remove sip prefix and rename phone number attrs.

* regenerate protos

* update tests

* add kv attrs to sip token

* add attribute test

* changeset

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Denys Smirnov <dennwc@pm.me>
2024-06-19 22:27:09 -07:00

162 lines
6.8 KiB
Go

// Code generated by protoc-gen-psrpc v0.5.1, DO NOT EDIT.
// source: rpc/sip.proto
package rpc
import (
"context"
"github.com/livekit/psrpc"
"github.com/livekit/psrpc/pkg/client"
"github.com/livekit/psrpc/pkg/info"
"github.com/livekit/psrpc/pkg/rand"
"github.com/livekit/psrpc/pkg/server"
"github.com/livekit/psrpc/version"
)
var _ = version.PsrpcVersion_0_5
// ============================
// SIPInternal Client Interface
// ============================
type SIPInternalClient interface {
CreateSIPParticipant(ctx context.Context, topic string, req *InternalCreateSIPParticipantRequest, opts ...psrpc.RequestOption) (*InternalCreateSIPParticipantResponse, error)
}
// ================================
// SIPInternal ServerImpl Interface
// ================================
type SIPInternalServerImpl interface {
CreateSIPParticipant(context.Context, *InternalCreateSIPParticipantRequest) (*InternalCreateSIPParticipantResponse, error)
CreateSIPParticipantAffinity(context.Context, *InternalCreateSIPParticipantRequest) float32
}
// ============================
// SIPInternal Server Interface
// ============================
type SIPInternalServer interface {
RegisterCreateSIPParticipantTopic(topic string) error
DeregisterCreateSIPParticipantTopic(topic string)
// Close and wait for pending RPCs to complete
Shutdown()
// Close immediately, without waiting for pending RPCs
Kill()
}
// ==================
// SIPInternal Client
// ==================
type sIPInternalClient struct {
client *client.RPCClient
}
// NewSIPInternalClient creates a psrpc client that implements the SIPInternalClient interface.
func NewSIPInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (SIPInternalClient, error) {
sd := &info.ServiceDefinition{
Name: "SIPInternal",
ID: rand.NewClientID(),
}
sd.RegisterMethod("CreateSIPParticipant", true, false, true, false)
rpcClient, err := client.NewRPCClient(sd, bus, opts...)
if err != nil {
return nil, err
}
return &sIPInternalClient{
client: rpcClient,
}, nil
}
func (c *sIPInternalClient) CreateSIPParticipant(ctx context.Context, topic string, req *InternalCreateSIPParticipantRequest, opts ...psrpc.RequestOption) (*InternalCreateSIPParticipantResponse, error) {
return client.RequestSingle[*InternalCreateSIPParticipantResponse](ctx, c.client, "CreateSIPParticipant", []string{topic}, req, opts...)
}
// ==================
// SIPInternal Server
// ==================
type sIPInternalServer struct {
svc SIPInternalServerImpl
rpc *server.RPCServer
}
// NewSIPInternalServer builds a RPCServer that will route requests
// to the corresponding method in the provided svc implementation.
func NewSIPInternalServer(svc SIPInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (SIPInternalServer, error) {
sd := &info.ServiceDefinition{
Name: "SIPInternal",
ID: rand.NewServerID(),
}
s := server.NewRPCServer(sd, bus, opts...)
sd.RegisterMethod("CreateSIPParticipant", true, false, true, false)
return &sIPInternalServer{
svc: svc,
rpc: s,
}, nil
}
func (s *sIPInternalServer) RegisterCreateSIPParticipantTopic(topic string) error {
return server.RegisterHandler(s.rpc, "CreateSIPParticipant", []string{topic}, s.svc.CreateSIPParticipant, s.svc.CreateSIPParticipantAffinity)
}
func (s *sIPInternalServer) DeregisterCreateSIPParticipantTopic(topic string) {
s.rpc.DeregisterHandler("CreateSIPParticipant", []string{topic})
}
func (s *sIPInternalServer) Shutdown() {
s.rpc.Close(false)
}
func (s *sIPInternalServer) Kill() {
s.rpc.Close(true)
}
var psrpcFileDescriptor8 = []byte{
// 550 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54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