mirror of
https://github.com/livekit/livekit.git
synced 2026-04-01 02:15:39 +00:00
WiP
This commit is contained in:
@@ -22,6 +22,8 @@ import (
|
||||
"github.com/livekit/protocol/logger"
|
||||
"github.com/livekit/protocol/rpc"
|
||||
"github.com/livekit/protocol/sip"
|
||||
"github.com/livekit/psrpc"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// matchSIPTrunk finds a SIP Trunk definition matching the request.
|
||||
@@ -100,3 +102,27 @@ func (s *IOInfoService) GetSIPTrunkAuthentication(ctx context.Context, req *rpc.
|
||||
Password: trunk.AuthPassword,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *IOInfoService) UpdateSIPCallState(ctx context.Context, req *rpc.UpdateSIPCallStateRequest) (*emptypb.Empty, error) {
|
||||
log := logger.GetLogger()
|
||||
log = log.WithValues("callID", req.CallInfo.CallId, "callStatus", req.CallInfo.CallStatus.String())
|
||||
|
||||
log.Infow("SIP call state updated")
|
||||
|
||||
if req.CallInfo == nil {
|
||||
return nil, psrpc.NewErrorf(psrpc.InvalidArgument, "no call info in UpdateSIPCallState request")
|
||||
}
|
||||
|
||||
switch req.CallInfo.CallStatus {
|
||||
case livekit.SIPCallStatus_SIP_CALL_STATUS_PARTICIPANT_JOINED:
|
||||
s.telemetry.SIPParticipantCreated(ctx, req.CallInfo)
|
||||
case livekit.SIPCallStatus_SIP_CALL_STATUS_CALL_INCOMING:
|
||||
s.telemetry.SIPCallIncoming(ctx, req.CallInfo)
|
||||
case livekit.SIPCallStatus_SIP_CALL_STATUS_ACTIVE:
|
||||
s.telemetry.SIPCallStarted(ctx, req.CallInfo)
|
||||
case livekit.SIPCallStatus_SIP_CALL_STATUS_DISCONNECTED:
|
||||
s.telemetry.SIPCallEnded(ctx, req.CallInfo)
|
||||
}
|
||||
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
@@ -544,9 +544,9 @@ func (t *telemetryService) SIPParticipantCreated(ctx context.Context, sipCall *l
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryService) SIPCallAccepted(ctx context.Context, sipCall *livekit.SIPCallInfo) {
|
||||
func (t *telemetryService) SIPCallIncoming(ctx context.Context, sipCall *livekit.SIPCallInfo) {
|
||||
t.enqueue(func() {
|
||||
t.SendEvent(ctx, newSIPCallEvent(livekit.AnalyticsEventType_SIP_CALL_ACCEPTED, sipCall))
|
||||
t.SendEvent(ctx, newSIPCallEvent(livekit.AnalyticsEventType_SIP_CALL_INCOMING, sipCall))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ type TelemetryService interface {
|
||||
SIPDispatchRuleCreated(ctx context.Context, dispatchRule *livekit.SIPDispatchRuleInfo)
|
||||
SIPDispatchRuleDeleted(ctx context.Context, dispatchRule *livekit.SIPDispatchRuleInfo)
|
||||
SIPParticipantCreated(ctx context.Context, sipCall *livekit.SIPCallInfo)
|
||||
SIPCallAccepted(ctx context.Context, sipCall *livekit.SIPCallInfo)
|
||||
SIPCallIncoming(ctx context.Context, sipCall *livekit.SIPCallInfo)
|
||||
SIPCallStarted(ctx context.Context, sipCall *livekit.SIPCallInfo)
|
||||
SIPCallEnded(ctx context.Context, sipCall *livekit.SIPCallInfo)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user