Skip to content

Adding ability to generate predictable room names#1426

Open
alexlivekit wants to merge 5 commits intomainfrom
alexmigolin/tel-378-standalone-sip-e2e-test
Open

Adding ability to generate predictable room names#1426
alexlivekit wants to merge 5 commits intomainfrom
alexmigolin/tel-378-standalone-sip-e2e-test

Conversation

@alexlivekit
Copy link
Contributor

No description provided.

@alexlivekit alexlivekit requested a review from a team February 23, 2026 21:28
@changeset-bot
Copy link

changeset-bot bot commented Feb 23, 2026

🦋 Changeset detected

Latest commit: 90432be

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "github.com/livekit/protocol" specified in the `fixed` option does not match any package in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

sip/sip.go Outdated
if !predictableRoomName {
suffix = guid.New("")
}
room = fmt.Sprintf("%s_%s_%s", pref, from, suffix)

Choose a reason for hiding this comment

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

If predictableRoomName is true, there will be no suffix. Room name may not be unique? how about we add call ID as the suffix in this case?

@alexlivekit alexlivekit force-pushed the alexmigolin/tel-378-standalone-sip-e2e-test branch from 39efffe to f16d7fe Compare February 26, 2026 22:47
Comment on lines +709 to +775
t.Run("Direct", func(t *testing.T) {
d := &livekit.SIPDispatchRuleInfo{
SipDispatchRuleId: "rule",
Rule: newDirectDispatch("room", ""),
HidePhoneNumber: false,
InboundNumbers: nil,
Numbers: nil,
Name: "",
Metadata: "rule-meta",
Attributes: map[string]string{
"rule-attr": "1",
},
}
r := &rpc.EvaluateSIPDispatchRulesRequest{
SipCallId: "call-id",
CallingNumber: "+11112222",
CallingHost: "sip.example.com",
CalledNumber: "+3333",
ExtraAttributes: map[string]string{
"prov-attr": "1",
},
}
tr := &livekit.SIPInboundTrunkInfo{SipTrunkId: "trunk"}
res, err := EvaluateDispatchRule("p_123", tr, d, r)
require.NoError(t, err)
require.Equal(t, &rpc.EvaluateSIPDispatchRulesResponse{
ProjectId: "p_123",
Result: rpc.SIPDispatchResult_ACCEPT,
SipTrunkId: "trunk",
SipDispatchRuleId: "rule",
RoomName: "room",
ParticipantIdentity: "sip_+11112222",
ParticipantName: "Phone +11112222",
ParticipantMetadata: "rule-meta",
ParticipantAttributes: map[string]string{
"rule-attr": "1",
"prov-attr": "1",
livekit.AttrSIPCallID: "call-id",
livekit.AttrSIPTrunkID: "trunk",
livekit.AttrSIPDispatchRuleID: "rule",
livekit.AttrSIPPhoneNumber: "+11112222",
livekit.AttrSIPTrunkNumber: "+3333",
livekit.AttrSIPHostName: "sip.example.com",
},
}, res)

d.HidePhoneNumber = true
res, err = EvaluateDispatchRule("p_123", tr, d, r)
require.NoError(t, err)
require.Equal(t, &rpc.EvaluateSIPDispatchRulesResponse{
ProjectId: "p_123",
Result: rpc.SIPDispatchResult_ACCEPT,
SipTrunkId: "trunk",
SipDispatchRuleId: "rule",
RoomName: "room",
ParticipantIdentity: "sip_c15a31c71649a522",
ParticipantName: "Phone 2222",
ParticipantMetadata: "rule-meta",
ParticipantAttributes: map[string]string{
"rule-attr": "1",
"prov-attr": "1",
livekit.AttrSIPCallID: "call-id",
livekit.AttrSIPTrunkID: "trunk",
livekit.AttrSIPDispatchRuleID: "rule",
},
}, res)
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unchanged from existing tests, just moved from TestEvaluateDispatchRule into TestEvaluateDispatchRule/Direct. GH differ is not ideal here.

string pin = 2;

// Optionally append random suffix
bool no_randomness = 3;

Choose a reason for hiding this comment

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

when this is set, we are saying it's the user's responsibility to guarantee the uniqueness of room name, right? what happens if two rooms have the same name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If two callers specify the same room name, they will be connected to the same room.
Hence really not wanting the default (generate randomness today) to flip (to no unique suffixes) and potentially mess customer flows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants