add room/participant to logger context for SIP APIs (#3290)
This commit is contained in:
+24
-10
@@ -407,7 +407,18 @@ func (s *SIPService) DeleteSIPDispatchRule(ctx context.Context, req *livekit.Del
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SIPService) CreateSIPParticipant(ctx context.Context, req *livekit.CreateSIPParticipantRequest) (*livekit.SIPParticipantInfo, error) {
|
func (s *SIPService) CreateSIPParticipant(ctx context.Context, req *livekit.CreateSIPParticipantRequest) (*livekit.SIPParticipantInfo, error) {
|
||||||
unlikelyLogger := logger.GetLogger().WithUnlikelyValues("room", req.RoomName, "sipTrunk", req.SipTrunkId, "toUser", req.SipCallTo)
|
unlikelyLogger := logger.GetLogger().WithUnlikelyValues(
|
||||||
|
"room", req.RoomName,
|
||||||
|
"sipTrunk", req.SipTrunkId,
|
||||||
|
"toUser", req.SipCallTo,
|
||||||
|
"participant", req.ParticipantIdentity,
|
||||||
|
)
|
||||||
|
AppendLogFields(ctx,
|
||||||
|
"room", req.RoomName,
|
||||||
|
"participant", req.ParticipantIdentity,
|
||||||
|
"toUser", req.SipCallTo,
|
||||||
|
"trunkID", req.SipTrunkId,
|
||||||
|
)
|
||||||
ireq, err := s.CreateSIPParticipantRequest(ctx, req, "", "", "", "")
|
ireq, err := s.CreateSIPParticipantRequest(ctx, req, "", "", "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
unlikelyLogger.Errorw("cannot create sip participant request", err)
|
unlikelyLogger.Errorw("cannot create sip participant request", err)
|
||||||
@@ -419,9 +430,6 @@ func (s *SIPService) CreateSIPParticipant(ctx context.Context, req *livekit.Crea
|
|||||||
"toHost", ireq.Address,
|
"toHost", ireq.Address,
|
||||||
)
|
)
|
||||||
AppendLogFields(ctx,
|
AppendLogFields(ctx,
|
||||||
"room", req.RoomName,
|
|
||||||
"toUser", req.SipCallTo,
|
|
||||||
"trunkID", req.SipTrunkId,
|
|
||||||
"callID", ireq.SipCallId,
|
"callID", ireq.SipCallId,
|
||||||
"fromUser", ireq.Number,
|
"fromUser", ireq.Number,
|
||||||
"toHost", ireq.Address,
|
"toHost", ireq.Address,
|
||||||
@@ -478,12 +486,12 @@ func (s *SIPService) CreateSIPParticipantRequest(ctx context.Context, req *livek
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *SIPService) TransferSIPParticipant(ctx context.Context, req *livekit.TransferSIPParticipantRequest) (*emptypb.Empty, error) {
|
func (s *SIPService) TransferSIPParticipant(ctx context.Context, req *livekit.TransferSIPParticipantRequest) (*emptypb.Empty, error) {
|
||||||
log := logger.GetLogger().WithUnlikelyValues("room", req.RoomName, "participant", req.ParticipantIdentity)
|
log := logger.GetLogger().WithUnlikelyValues(
|
||||||
ireq, err := s.transferSIPParticipantRequest(ctx, req)
|
"room", req.RoomName,
|
||||||
if err != nil {
|
"participant", req.ParticipantIdentity,
|
||||||
log.Errorw("cannot create transfer sip participant request", err)
|
"transferTo", req.TransferTo,
|
||||||
return nil, err
|
"playDialtone", req.PlayDialtone,
|
||||||
}
|
)
|
||||||
AppendLogFields(ctx,
|
AppendLogFields(ctx,
|
||||||
"room", req.RoomName,
|
"room", req.RoomName,
|
||||||
"participant", req.ParticipantIdentity,
|
"participant", req.ParticipantIdentity,
|
||||||
@@ -491,6 +499,12 @@ func (s *SIPService) TransferSIPParticipant(ctx context.Context, req *livekit.Tr
|
|||||||
"playDialtone", req.PlayDialtone,
|
"playDialtone", req.PlayDialtone,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ireq, err := s.transferSIPParticipantRequest(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorw("cannot create transfer sip participant request", err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
timeout := 30 * time.Second
|
timeout := 30 * time.Second
|
||||||
if deadline, ok := ctx.Deadline(); ok {
|
if deadline, ok := ctx.Deadline(); ok {
|
||||||
timeout = time.Until(deadline)
|
timeout = time.Until(deadline)
|
||||||
|
|||||||
Reference in New Issue
Block a user