Use camel case in SIP logs. (#2738)

This commit is contained in:
Denys Smirnov
2024-05-28 13:43:22 +03:00
committed by GitHub
parent 7ed1284b96
commit fa65712a0e
2 changed files with 8 additions and 8 deletions

View File

@@ -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,

View File

@@ -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.