Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ require (
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731
github.com/livekit/media-sdk v0.0.0-20250927154350-bd99739b439b
github.com/livekit/mediatransportutil v0.0.0-20250519131108-fb90f5acfded
github.com/livekit/protocol v1.42.3-0.20251016122026-bc6809b5bdc8
github.com/livekit/psrpc v0.7.0
github.com/livekit/protocol v1.42.3-0.20251024155820-faeac96f8fa9
github.com/livekit/psrpc v0.7.1-0.20251021235041-bdebea7dacf4
github.com/livekit/server-sdk-go/v2 v2.11.4-0.20251016050252-63f7c8381817
github.com/livekit/sipgo v0.13.2-0.20250601220430-a77cc3f220fb
github.com/mjibson/go-dsp v0.0.0-20180508042940-11479a337f12
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ github.com/livekit/media-sdk v0.0.0-20250927154350-bd99739b439b h1:dPf9i0JPyf0Sg
github.com/livekit/media-sdk v0.0.0-20250927154350-bd99739b439b/go.mod h1:7ssWiG+U4xnbvLih9WiZbhQP6zIKMjgXdUtIE1bm/E8=
github.com/livekit/mediatransportutil v0.0.0-20250519131108-fb90f5acfded h1:ylZPdnlX1RW9Z15SD4mp87vT2D2shsk0hpLJwSPcq3g=
github.com/livekit/mediatransportutil v0.0.0-20250519131108-fb90f5acfded/go.mod h1:mSNtYzSf6iY9xM3UX42VEI+STHvMgHmrYzEHPcdhB8A=
github.com/livekit/protocol v1.42.3-0.20251016122026-bc6809b5bdc8 h1:JSAUNDIK36tYjvnahJihmOXISuco5xvKy5msXLp855A=
github.com/livekit/protocol v1.42.3-0.20251016122026-bc6809b5bdc8/go.mod h1:vhMS30QoEyH2p34vi6X1eWkC4EMV72ZGZwQb74ajY7A=
github.com/livekit/psrpc v0.7.0 h1:rtfqfjYN06WJYloE/S0nmkJ/Y04x4pxLQLe8kQ4FVHU=
github.com/livekit/psrpc v0.7.0/go.mod h1:AuDC5uOoEjQJEc69v4Li3t77Ocz0e0NdjQEuFfO+vfk=
github.com/livekit/protocol v1.42.3-0.20251024155820-faeac96f8fa9 h1:MwQ/FyLjTLmI7qPdLaKKFGmQzINwXStFBZ7rgI/GTDY=
github.com/livekit/protocol v1.42.3-0.20251024155820-faeac96f8fa9/go.mod h1:TpqU2qCI1ES4Lk7PAWSgYO4RaexfVXb54ZO2hXv0Bmc=
github.com/livekit/psrpc v0.7.1-0.20251021235041-bdebea7dacf4 h1:YA5HMfNW9IPPdTSkwsyCtK9ZcNW8QpPNlkuD7UUToZE=
github.com/livekit/psrpc v0.7.1-0.20251021235041-bdebea7dacf4/go.mod h1:AuDC5uOoEjQJEc69v4Li3t77Ocz0e0NdjQEuFfO+vfk=
github.com/livekit/server-sdk-go/v2 v2.11.4-0.20251016050252-63f7c8381817 h1:y5YYe37lcGMOZMw4rvreljGjLj60eDSce/N6Asp7pw8=
github.com/livekit/server-sdk-go/v2 v2.11.4-0.20251016050252-63f7c8381817/go.mod h1:xebvU/bXHEv2fA2F8yX8PsEBWxuYWo2+cyxFJHDmJRk=
github.com/livekit/sipgo v0.13.2-0.20250601220430-a77cc3f220fb h1:onh9h110573vcxmse38aSZifEsRB8bbrXu2VYVt8PC0=
Expand Down
11 changes: 10 additions & 1 deletion pkg/sip/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,12 @@ func handleReferNotify(cseq uint32, status int, reason string, referCseq uint32,
Code: livekit.SIPStatusCode(status),
Status: reason,
}
result = psrpc.NewErrorf(psrpc.Canceled, "call transfer failed: %w", st)
psrpcErrCode := psrpc.UpstreamServerError
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going over twirp, this will still produce a bad error, due to Twirp not having the appropriate response codes to convert this to. However, data indicates the vast majority of errors are not 5XX errors and are going to be UpstreamClientError. which would convert to twirp.InvalidArgument.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't related to Twirp, but our error code mapping in psrpc? why don't we just map it to the right thing there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This completely ignores the existing mapping to gRPC/PSRPC/Twirp error codes that we have. Maybe we should update the mapping there instead?

Copy link
Contributor Author

@alexlivekit alexlivekit Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you refer to the code here , I suspect we never reach the unwrap point since if errors.As(err, &e) { succeeds, due to us returning a psrpc.Error.
If I read this right SIPStatus.GRPCStatus() gets called when we don't return a psrpc error, but a SIPStatus instead.

if status < 500 || status >= 600 {
// Common 6xx codes: 603 Declined, 608 Rejected
psrpcErrCode = psrpc.UpstreamClientError
}
result = psrpc.NewErrorf(psrpcErrCode, "call transfer failed: %w", st)
}
select {
case referDone <- result:
Expand Down Expand Up @@ -413,6 +418,10 @@ func sipStatusForErrorCode(code psrpc.ErrorCode) sip.StatusCode {
return sip.StatusServiceUnavailable
case psrpc.Unauthenticated:
return sip.StatusUnauthorized
case psrpc.UpstreamServerError:
return sip.StatusBadGateway
case psrpc.UpstreamClientError:
return sip.StatusTemporarilyUnavailable
default:
return sip.StatusInternalServerError
}
Expand Down