Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .changeset/refer-sips.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@livekit/protocol": patch
---

Allow sips: scheme in transfer URIs.
6 changes: 3 additions & 3 deletions livekit/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] <addr-spec>
// Both name-addr and addr-spec are allowed in RFC3515 (section-2.1).
Expand Down
20 changes: 20 additions & 0 deletions livekit/sip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,16 @@ func TestTransferSIPParticipantRequestValidate(t *testing.T) {
expectError: false,
expectedURI: "<sip:+15105550100@sip.telnyx.com>",
},
{
name: "valid sips URI without brackets",
req: &TransferSIPParticipantRequest{
RoomName: "room1",
ParticipantIdentity: "participant1",
TransferTo: "sips:+15105550100@sip.telnyx.com",
},
expectError: false,
expectedURI: "<sips:+15105550100@sip.telnyx.com>",
},
{
name: "valid tel URI without brackets",
req: &TransferSIPParticipantRequest{
Expand All @@ -399,6 +409,16 @@ func TestTransferSIPParticipantRequestValidate(t *testing.T) {
expectError: false,
expectedURI: "<sip:+15105550100@sip.telnyx.com>",
},
{
name: "valid sips URI with brackets",
req: &TransferSIPParticipantRequest{
RoomName: "room1",
ParticipantIdentity: "participant1",
TransferTo: "<sips:+15105550100@sip.telnyx.com>",
},
expectError: false,
expectedURI: "<sips:+15105550100@sip.telnyx.com>",
},
{
name: "valid tel URI with brackets",
req: &TransferSIPParticipantRequest{
Expand Down
Loading