From a3c7ca79a217162cc13dec82110f5ebba0b1e41f Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 21 Dec 2025 11:14:16 -0800 Subject: [PATCH] Updating dispatch rule error message (#1343) --- .changeset/shiny-geckos-pay.md | 5 +++++ sip/sip.go | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 .changeset/shiny-geckos-pay.md diff --git a/.changeset/shiny-geckos-pay.md b/.changeset/shiny-geckos-pay.md new file mode 100644 index 00000000..025968d0 --- /dev/null +++ b/.changeset/shiny-geckos-pay.md @@ -0,0 +1,5 @@ +--- +"github.com/livekit/protocol": patch +--- + +Changing the wording on duplicate dispatch rule error message diff --git a/sip/sip.go b/sip/sip.go index 514bc433..a97eb82a 100644 --- a/sip/sip.go +++ b/sip/sip.go @@ -131,6 +131,13 @@ func printID(s string) string { return s } +func printName(s string) string { + if s == "" { + return "" + } + return s +} + // ValidateDispatchRules checks a set of dispatch rules for conflicts. // // Deprecated: use ValidateDispatchRulesIter @@ -208,8 +215,9 @@ func (v *DispatchRuleValidator) Validate(r *livekit.SIPDispatchRuleInfo) error { if v.opt.AllowConflicts { continue } - return twirp.NewErrorf(twirp.InvalidArgument, "Conflicting SIP Dispatch Rules: same Trunk+Number+PIN combination for for %q and %q", - printID(r.SipDispatchRuleId), printID(r2.SipDispatchRuleId)) + return twirp.NewErrorf(twirp.InvalidArgument, + "Dispatch rule for the same trunk, number, and PIN combination already exists in dispatch rule %q %q", + printID(r2.SipDispatchRuleId), printName(r2.Name)) } v.byRuleKey[key] = r }