Skip to content

Conversation

@nishadmusthafa
Copy link
Contributor

No description provided.

…st Filter

1. Added normalization to the comparison of trunk and caller number in ListSIPInboundTrunkRequest
2. Moved NormalizeNumber to a utils number to prevent import cycle
@changeset-bot
Copy link

changeset-bot bot commented Jul 3, 2025

🦋 Changeset detected

Latest commit: 58f54de

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.

@nishadmusthafa nishadmusthafa requested a review from a team July 3, 2025 22:19
// NormalizeNumber normalizes a phone number by removing formatting characters and ensuring it starts with a "+".
// If the input is empty, it returns an empty string.
// If the input doesn't match the expected number pattern, it returns the original input unchanged.
func NormalizeNumber(num string) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

It could be in livekit/sip.go as well, instead of a new utils package.

livekit/sip.go Outdated
for _, num := range info.Numbers {
if slices.Contains(p.Numbers, num) {
ok = true
normalizedNum := siputils.NormalizeNumber(num)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also keep a direct slices.Contains(p.Numbers, num) check as well? We don't need to call regexp if the numbers match exactly.

@nishadmusthafa nishadmusthafa merged commit a8834c0 into main Jul 13, 2025
7 checks passed
@nishadmusthafa nishadmusthafa deleted the normalize-trunk-filtering branch July 13, 2025 05:27
@github-actions github-actions bot mentioned this pull request Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants