Skip to content

Commit

Permalink
Allow number filtering on Dispatch Rules
Browse files Browse the repository at this point in the history
Allow inbound number filtering on  SIP Dispatch Rules. It works similar to Trunks, where rules without a number filter are grouped together and take less priority than number-specific rules.

While at it, simplify the rule evaluation.

Previously it was doing some hand-crafted checks for evaluation path, that matched the validation path. Same double logic existed for priorities as well.

Now the validation is always called from evaluation, thus sharing the logic. And rule selection is simplified by just picking the first one after priority filtering.
  • Loading branch information
dennwc committed May 7, 2024
1 parent 72c0789 commit cf7a88e
Show file tree
Hide file tree
Showing 6 changed files with 292 additions and 245 deletions.
6 changes: 6 additions & 0 deletions .changeset/nervous-dolphins-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"github.com/livekit/protocol": minor
"@livekit/protocol": minor
---

Allow inbound number filtering on SIP Dispatch Rules
227 changes: 125 additions & 102 deletions livekit/livekit_sip.pb.go

Large diffs are not rendered by default.

130 changes: 65 additions & 65 deletions livekit/livekit_sip.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions protobufs/livekit_sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,32 @@ message CreateSIPDispatchRuleRequest {
// If true a random value will be used instead
bool hide_phone_number = 3;

// Dispatch Rule will only accept a call made to these numbers (if set).
repeated string inbound_numbers = 6;

// Optional human-readable name for the Dispatch Rule.
string name = 4;
// Optional user-defined metadata for the Dispatch Rule.
string metadata = 5;

// NEXT ID: 7
}

message SIPDispatchRuleInfo {
string sip_dispatch_rule_id = 1;
SIPDispatchRule rule = 2;
repeated string trunk_ids = 3;
bool hide_phone_number = 4;
// Dispatch Rule will only accept a call made to these numbers (if set).
repeated string inbound_numbers = 7;

// Human-readable name for the Dispatch Rule.
string name = 5;
// User-defined metadata for the Dispatch Rule.
// Participants created by this rule will inherit this metadata.
string metadata = 6;

// NEXT ID: 8
}

message ListSIPDispatchRuleRequest {
Expand Down
Loading

0 comments on commit cf7a88e

Please sign in to comment.