From fa65712a0e6d54bc17434d3e0f34af9ee7cdcc2d Mon Sep 17 00:00:00 2001 From: Denys Smirnov Date: Tue, 28 May 2024 13:43:22 +0300 Subject: [PATCH] Use camel case in SIP logs. (#2738) --- pkg/service/ioservice_sip.go | 12 ++++++------ pkg/service/sip.go | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/service/ioservice_sip.go b/pkg/service/ioservice_sip.go index e893dafb5..8733be07a 100644 --- a/pkg/service/ioservice_sip.go +++ b/pkg/service/ioservice_sip.go @@ -48,7 +48,7 @@ func (s *IOInfoService) matchSIPDispatchRule(ctx context.Context, trunk *livekit func (s *IOInfoService) EvaluateSIPDispatchRules(ctx context.Context, req *rpc.EvaluateSIPDispatchRulesRequest) (*rpc.EvaluateSIPDispatchRulesResponse, error) { log := logger.GetLogger() - log = log.WithValues("to-user", req.CalledNumber, "from-user", req.CallingNumber) + log = log.WithValues("toUser", req.CalledNumber, "fromUser", req.CallingNumber) trunk, err := s.matchSIPTrunk(ctx, req.CallingNumber, req.CalledNumber) if err != nil { return nil, err @@ -57,7 +57,7 @@ func (s *IOInfoService) EvaluateSIPDispatchRules(ctx context.Context, req *rpc.E if trunk != nil { trunkID = trunk.SipTrunkId } - log = log.WithValues("sip-trunk", trunkID) + log = log.WithValues("sipTrunk", trunkID) if trunk != nil { log.Debugw("SIP trunk matched") } else { @@ -73,7 +73,7 @@ func (s *IOInfoService) EvaluateSIPDispatchRules(ctx context.Context, req *rpc.E } return nil, err } - log.Debugw("SIP dispatch rule matched", "sip-rule", best.SipDispatchRuleId) + log.Debugw("SIP dispatch rule matched", "sipRule", best.SipDispatchRuleId) resp, err := sip.EvaluateDispatchRule(best, req) if err != nil { return nil, err @@ -84,16 +84,16 @@ func (s *IOInfoService) EvaluateSIPDispatchRules(ctx context.Context, req *rpc.E func (s *IOInfoService) GetSIPTrunkAuthentication(ctx context.Context, req *rpc.GetSIPTrunkAuthenticationRequest) (*rpc.GetSIPTrunkAuthenticationResponse, error) { log := logger.GetLogger() - log = log.WithValues("to-user", req.To, "from-user", req.From) + log = log.WithValues("toUser", req.To, "fromUser", req.From) trunk, err := s.matchSIPTrunk(ctx, req.From, req.To) if err != nil { return nil, err } if trunk == nil { - log.Debugw("No SIP trunk matched for auth", "sip-trunk", "") + log.Debugw("No SIP trunk matched for auth", "sipTrunk", "") return &rpc.GetSIPTrunkAuthenticationResponse{}, nil } - log.Debugw("SIP trunk matched for auth", "sip-trunk", trunk.SipTrunkId) + log.Debugw("SIP trunk matched for auth", "sipTrunk", trunk.SipTrunkId) return &rpc.GetSIPTrunkAuthenticationResponse{ SipTrunkId: trunk.SipTrunkId, Username: trunk.InboundUsername, diff --git a/pkg/service/sip.go b/pkg/service/sip.go index 1772a5497..417457c8f 100644 --- a/pkg/service/sip.go +++ b/pkg/service/sip.go @@ -196,14 +196,14 @@ func (s *SIPService) CreateSIPParticipantWithToken(ctx context.Context, req *liv } callID := sip.NewCallID() log := logger.GetLogger() - log = log.WithValues("call-id", callID, "roomName", req.RoomName, "sip-trunk", req.SipTrunkId, "to-user", req.SipCallTo) + log = log.WithValues("callId", callID, "roomName", req.RoomName, "sipTrunk", req.SipTrunkId, "toUser", req.SipCallTo) trunk, err := s.store.LoadSIPTrunk(ctx, req.SipTrunkId) if err != nil { log.Errorw("cannot get trunk to update sip participant", err) return nil, err } - log = log.WithValues("from-user", trunk.OutboundNumber, "to-host", trunk.OutboundAddress) + log = log.WithValues("fromUser", trunk.OutboundNumber, "toHost", trunk.OutboundAddress) ireq := rpc.NewCreateSIPParticipantRequest(callID, wsUrl, token, req, trunk) // CreateSIPParticipant will wait for LiveKit Participant to be created and that can take some time.