Skip to content

Conversation

@dennwc
Copy link
Contributor

@dennwc dennwc commented Jun 13, 2024

Initial decisions made on the naming of the fields in SIPTrunkInfo leads to a lot of confusion for our users.

Most importantly, the outbound_number field is actually used for both inbound and outbound as the number associated with this LK SIP Trunk. Ideally it should be named number.

Unfortunately, we cannot rename it without breaking compatibility. This is mainly because our CLI uses protojson for decoding these fields. Changing the name will break old JSON request files.

Some users also asked if it's possible to map multiple numbers to one (inbound) Trunk. Again, we cannot change the type of the field, but we could introduce a new one. At the same time, multiple numbers may be unnecessary for outbound Trunks, but they will still appear there because the structure is shared for inbound/outbound.

At the end, it's clear that there's no reason to share inbound and outbound configuration in one entity. Thus, this change splits Trunk into inbound and outbound configs.

Specifically:

  • Introduce SIPInboundTrunkInfo and SIPOutboundTrunkInfo, add deprecation note for SIPTrunkInfo.
  • Introduce new creation and list APIs for new types. Mark old ones as deprecated. Keep Delete, because it's agnostic.
  • Add conversion functions between the new and old types.

We will keep DB structure mostly the same and convert objects in flight. One column will be added: kind. New Trunks will have it set to either inbound or outbound, so that new objects appear in one list only, while old ones appear in both. Eventually we could migrate to separate DB tables.

@dennwc dennwc self-assigned this Jun 13, 2024
@changeset-bot
Copy link

changeset-bot bot commented Jun 13, 2024

🦋 Changeset detected

Latest commit: 44fd60d

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.

Copy link
Member

@davidzhao davidzhao left a comment

Choose a reason for hiding this comment

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

lgtm! this seems cleaner and easier to understand.

SIPTransport transport = 5;

// A number used to make the calls.
string number = 6;
Copy link
Member

Choose a reason for hiding this comment

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

On the trunking provider side, it's still possible to associate multiple numbers to the SIP trunk. but I guess the point here is when making a call, a particular number will always be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's possible to use multiple numbers for outbound on the provider's side.

Exactly, this is to specify which specific number to use. Having said that, I was also considering an array here. The implementation could pick a random number from an array before making a call.

Lets allow multiple outbound numbers then.

Copy link
Member

Choose a reason for hiding this comment

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

so maybe for the protocol, it'd be better to leave it as a repeated field? but in usage, we would let people know that only the first is used?

in the future, we can then add ways of choosing a trunk at run-time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Already updated to repeated field 👍 It will actually use the random one from the list if the Trunk is created with new API. And if not - it will be the same as before (one number only).

@dennwc
Copy link
Contributor Author

dennwc commented Jun 17, 2024

I'll keep it open for a bit longer - preparing PRs to other repos.

@dennwc
Copy link
Contributor Author

dennwc commented Jun 17, 2024

Works well, merging

@dennwc dennwc merged commit 32c577d into main Jun 17, 2024
@dennwc dennwc deleted the sip-trunks-v2 branch June 17, 2024 18:42
@github-actions github-actions bot mentioned this pull request Jun 14, 2024
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