From b719768e7d70e18bda82030ec7e8c243e29539b2 Mon Sep 17 00:00:00 2001 From: Denys Smirnov Date: Tue, 10 Mar 2026 10:13:08 +0200 Subject: [PATCH] Allow sips: scheme in transfer URIs. --- .changeset/refer-sips.md | 5 +++++ livekit/sip.go | 6 +++--- livekit/sip_test.go | 20 ++++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .changeset/refer-sips.md diff --git a/.changeset/refer-sips.md b/.changeset/refer-sips.md new file mode 100644 index 000000000..67d13b6e6 --- /dev/null +++ b/.changeset/refer-sips.md @@ -0,0 +1,5 @@ +--- +"@livekit/protocol": patch +--- + +Allow sips: scheme in transfer URIs. diff --git a/livekit/sip.go b/livekit/sip.go index 76c57addd..dd36d1eba 100644 --- a/livekit/sip.go +++ b/livekit/sip.go @@ -844,13 +844,13 @@ func (p *TransferSIPParticipantRequest) Validate() error { innerURI = p.TransferTo } - if !strings.HasPrefix(innerURI, "sip:") && !strings.HasPrefix(innerURI, "tel:") { + if !strings.HasPrefix(innerURI, "sip:") && !strings.HasPrefix(innerURI, "sips:") && !strings.HasPrefix(innerURI, "tel:") { // In theory the Refer-To header can receive the full name-addr. // This can make this check inaccurate, but we want to limit to just SIP and TEL URIs. - return errors.New("transfer_to must be a valid SIP or TEL URI (sip: or tel:)") + return errors.New("transfer_to must be a valid SIP(s) or TEL URI (sip:, sips: or tel:)") } - if strings.HasPrefix(innerURI, "sip:") { + if strings.HasPrefix(innerURI, "sip:") || strings.HasPrefix(innerURI, "sips:") { // addr-spec = sip:... // name-addr = [ display-name ] // Both name-addr and addr-spec are allowed in RFC3515 (section-2.1). diff --git a/livekit/sip_test.go b/livekit/sip_test.go index 3353b87b5..10f27d44b 100644 --- a/livekit/sip_test.go +++ b/livekit/sip_test.go @@ -379,6 +379,16 @@ func TestTransferSIPParticipantRequestValidate(t *testing.T) { expectError: false, expectedURI: "", }, + { + name: "valid sips URI without brackets", + req: &TransferSIPParticipantRequest{ + RoomName: "room1", + ParticipantIdentity: "participant1", + TransferTo: "sips:+15105550100@sip.telnyx.com", + }, + expectError: false, + expectedURI: "", + }, { name: "valid tel URI without brackets", req: &TransferSIPParticipantRequest{ @@ -399,6 +409,16 @@ func TestTransferSIPParticipantRequestValidate(t *testing.T) { expectError: false, expectedURI: "", }, + { + name: "valid sips URI with brackets", + req: &TransferSIPParticipantRequest{ + RoomName: "room1", + ParticipantIdentity: "participant1", + TransferTo: "", + }, + expectError: false, + expectedURI: "", + }, { name: "valid tel URI with brackets", req: &TransferSIPParticipantRequest{