mirror of
https://github.com/livekit/livekit.git
synced 2026-11-12 20:49:07 +00:00
TEL-1228: reject sip_source_call_id in CreateSIPParticipant (#5172)
* TEL-1228: reject sip_source_call_id in CreateSIPParticipant * Addressing comment * Bump protocol
This commit is contained in:
1 parent
8f94fc2028
commit
f0999b7677
4 files changed
+28
-3
No files matched your search
@@ -21,7 +21,7 @@ require (
|
||||
github.com/jxskiss/base62 v1.1.0
|
||||
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731
|
||||
github.com/livekit/mediatransportutil v0.0.0-20261105133908-2cf1b1487796
|
||||
github.com/livekit/protocol v1.53.3-0.20261110074248-a24ade1483e9
|
||||
github.com/livekit/protocol v1.53.3-0.20261110212946-e6dd7c1a6bf6
|
||||
github.com/livekit/psrpc v0.8.2
|
||||
github.com/mackerelio/go-osstat v0.2.8
|
||||
github.com/magefile/mage v1.17.2
|
||||
|
||||
@@ -164,8 +164,8 @@ github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731 h1:9x+U2HGLrSw5AT
|
||||
github.com/livekit/mageutil v0.0.0-20250511045019-0f1ff63f7731/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
|
||||
github.com/livekit/mediatransportutil v0.0.0-20261105133908-2cf1b1487796 h1:Ywn57x0LFvbUbHFV1gESlPA/4u8FHIpuEJIwQH3CQZA=
|
||||
github.com/livekit/mediatransportutil v0.0.0-20261105133908-2cf1b1487796/go.mod h1:/T+BvdqiQN7mYJJk5EFFqbdbe7yBAvR8Ilx5kMVzT4M=
|
||||
github.com/livekit/protocol v1.53.3-0.20261110074248-a24ade1483e9 h1:TSaW9DM7gE/VqUr7aHAdsURVDEzylKK0hyBBrN3St8c=
|
||||
github.com/livekit/protocol v1.53.3-0.20261110074248-a24ade1483e9/go.mod h1:S0AnW03n6zgnWZOq+T4L1PtT9POxTBgrgEH1jyR6fl4=
|
||||
github.com/livekit/protocol v1.53.3-0.20261110212946-e6dd7c1a6bf6 h1:+OXv8KmqHXfO2Jdyf0iiVUtsW0R80kucNBzlY/UdSM8=
|
||||
github.com/livekit/protocol v1.53.3-0.20261110212946-e6dd7c1a6bf6/go.mod h1:S0AnW03n6zgnWZOq+T4L1PtT9POxTBgrgEH1jyR6fl4=
|
||||
github.com/livekit/psrpc v0.8.2 h1:7tbkhBJoYlK5Csfkdv1XYbZjyAQeaEZgupvIXNCv7Dc=
|
||||
github.com/livekit/psrpc v0.8.2/go.mod h1:6KnU8vULoizX0Er9NNfeKJDV8ug87j3fuo19M0bhj6Q=
|
||||
github.com/livekit/webrtc-pion/v4 v4.2.25-warp.3 h1:n6Rctm2NI+YuAZlAuI0yDw+ZmazAIcol6sjeeTqU32I=
|
||||
|
||||
@@ -646,6 +646,12 @@ func (s *SIPService) DeleteSIPDispatchRule(ctx context.Context, req *livekit.Del
|
||||
}
|
||||
|
||||
func (s *SIPService) CreateSIPParticipant(ctx context.Context, req *livekit.CreateSIPParticipantRequest) (*livekit.SIPParticipantInfo, error) {
|
||||
if err := EnsureSIPCallPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
if req.SipSourceCallId != "" {
|
||||
return nil, psrpc.NewErrorf(psrpc.Unimplemented, "sip_source_call_id is not supported")
|
||||
}
|
||||
unlikelyLogger := logger.GetLogger().WithUnlikelyValues(
|
||||
"room", req.RoomName,
|
||||
"sipTrunk", req.SipTrunkId,
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/utils"
|
||||
"github.com/livekit/protocol/utils/guid"
|
||||
"github.com/livekit/psrpc"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/twitchtv/twirp"
|
||||
"google.golang.org/protobuf/proto"
|
||||
@@ -184,3 +185,21 @@ func TestSIPInboundTrunkRejectsURINumbers(t *testing.T) {
|
||||
requireInvalidArgument(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestCreateSIPParticipantSourceCallUnsupported(t *testing.T) {
|
||||
req := &livekit.CreateSIPParticipantRequest{SipSourceCallId: "SCL_1"}
|
||||
|
||||
t.Run("without SIP call permission", func(t *testing.T) {
|
||||
_, err := (&service.SIPService{}).CreateSIPParticipant(context.Background(), req)
|
||||
var terr twirp.Error
|
||||
require.ErrorAs(t, err, &terr)
|
||||
require.Equal(t, twirp.Unauthenticated, terr.Code())
|
||||
})
|
||||
|
||||
t.Run("with SIP call permission", func(t *testing.T) {
|
||||
ctx := service.WithGrants(context.Background(), &auth.ClaimGrants{SIP: &auth.SIPGrant{Call: true}}, "")
|
||||
_, err := (&service.SIPService{}).CreateSIPParticipant(ctx, req)
|
||||
code, _ := psrpc.GetErrorCode(err)
|
||||
require.Equal(t, psrpc.Unimplemented, code)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user