Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better auth logging #31

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions pkg/sip/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

h := req.GetHeader("Proxy-Authorization")
if h == nil {
logger.Infow(fmt.Sprintf("Requesting inbound auth for %s", from), "from", from)

Check warning on line 57 in pkg/sip/inbound.go

View check run for this annotation

Codecov / codecov/patch

pkg/sip/inbound.go#L57

Added line #L57 was not covered by tests
inviteState.challenge = digest.Challenge{
Realm: UserAgent,
Nonce: fmt.Sprintf("%d", time.Now().UnixMicro()),
Expand Down Expand Up @@ -116,12 +117,14 @@
src := req.Source()

s.mon.InviteReq(false, from.Address.String(), to.Address.String())
logger.Infow("INVITE", "tag", tag, "from", from, "to", to)
logger.Infow(fmt.Sprintf("INVITE from %q to %q", from.Address.String(), to.Address.String()),
"tag", tag, "from", from, "to", to)

username, password, err := s.authHandler(from.Address.User, to.Address.User, to.Address.Host, src)
if err != nil {
s.mon.InviteError(false, from.Address.String(), to.Address.String(), "no-rule")
logger.Warnw("Rejecting inbound call, doesn't match any Trunks", err, "tag", tag, "src", src, "from", from, "to", to, "to-host", to.Address.Host)
logger.Warnw(fmt.Sprintf("Rejecting inbound call to %q, doesn't match any Trunks", to.Address.String()), err,
"tag", tag, "src", src, "from", from, "to", to, "to-host", to.Address.Host)
sipErrorResponse(tx, req)
return
}
Expand Down
Loading