-
Notifications
You must be signed in to change notification settings - Fork 103
Lk phone numbers #1146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Lk phone numbers #1146
Conversation
🦋 Changeset detectedLatest commit: 0007077 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
|
7b9b4ca
to
dc846fd
Compare
protobufs/livekit_phone_number.proto
Outdated
string area_code = 3; // Area code (e.g., "415") | ||
string locality = 4; // City/locality (e.g., "San Francisco") | ||
string region = 5; // State/region (e.g., "CA") | ||
string capabilities = 6; // Comma-separated capabilities (e.g., "voice,sms") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string capabilities = 6; // Comma-separated capabilities (e.g., "voice,sms") | |
repeated string capabilities = 6; // a list of capabilities (e.g., ["voice", "sms"]) |
protobufs/livekit_phone_number.proto
Outdated
string locality = 4; // City/locality (e.g., "San Francisco") | ||
string region = 5; // State/region (e.g., "CA") | ||
string capabilities = 6; // Comma-separated capabilities (e.g., "voice,sms") | ||
int64 monthly_cost_cents = 7; // Monthly cost in cents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we expect other currencies going forward?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will change
} | ||
|
||
// ListPhoneNumberInventoryRequest - Request to list available phone numbers | ||
message ListPhoneNumberInventoryRequest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a filter for capabilities here? And a provider, maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't want to add capability in the request from the get go as we wanted to mostly focus on voice now. SMS certainly is something that should be supported when we support that as a channel.
For provider, my thought was to keep it separate from this request and be able to make config changes like which provider for which country in a different place. Right now, that is more in the cloud. My gut tells me that the implementations will look quite different between cloud and OSS for that.
protobufs/livekit_phone_number.proto
Outdated
// ListPhoneNumberInventoryResponse - Response containing available phone numbers | ||
message ListPhoneNumberInventoryResponse { | ||
repeated PhoneNumberInventoryItem items = 1; // List of available phone numbers | ||
int32 total_count = 2; // Total number of available numbers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it practical to return the total number of all the numbers available for purchase? I assume that's a very long list and some providers may not even return the count.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I think it might make sense as an optional field in case we receive it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decided to leave it out for now.
protobufs/livekit_phone_number.proto
Outdated
repeated PhoneNumberInventoryItem items = 1; // List of available phone numbers | ||
int32 total_count = 2; // Total number of available numbers | ||
int32 limit = 3; // Limit used in the request | ||
int32 offset = 4; // Offset used in the request |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Offset would work for most providers, I guess, but I was thinking maybe a more generic string token
or string next
would make sense? This way we could still pass the next page number for certain providers and possibly a different kind of pagination token for others.
protobufs/livekit_phone_number.proto
Outdated
string phone_number = 1; // Phone number in E.164 format (e.g., "+14155552671") | ||
string country_code = 2; // Country code (e.g., "US") | ||
string area_code = 3; // Area code (e.g., "415") | ||
string locality = 4; // City/locality (e.g., "San Francisco") | ||
string region = 5; // State/region (e.g., "CA") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fields are very similar to ones in PurchasedPhoneNumber
, maybe we could make a PhoneNumberInfo
with all the common ones? We did this mistake with original SIP in the past by duplicating fields, adding anew new common field becomes very error-prone. So if we put it into a common struct the code can just pass it along without the need for explicit conversion of fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually had a different thought here. Will make changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually I went with more or less what you suggested. I added some changes to make the pricing data better.
import "google/protobuf/empty.proto"; | ||
|
||
// Public Phone Number Service - External API for phone number management | ||
service PhoneNumberService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this makes it to OSS, do you think we could adapt it to Twilio API for example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I think that's a good idea. Would take a stab at it in a later iteration. Also as I mentioned in the comment below, we might have variations in how that is implemented in cloud/oss for things like what is supported. Billing probably is not something we might support in OSS as it would be something very custom to implementation.
protobufs/livekit_phone_number.proto
Outdated
|
||
// PurchasePhoneNumberRequest - Request to purchase a phone number | ||
message PurchasePhoneNumberRequest { | ||
string phone_number = 1; // Phone number to purchase (e.g., "+1234567890") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think making it an array makes sense to allow batch orders?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I actually gave this some thought. In this iteration, I didn't really look into batching as much. This variation you suggested is one kind of batch implementation. There's also another where you can just give an area code and say you want 10 numbers and you don't care about what the numbers are. But I think definitely makes sense to make this an array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only thing to keep in mind here is what would happen if the provider doesn't have a bulk api. We'd need to implement that additional logic. maybe we could validate to only do one in the beginning and add that capability in the future. In the immediate term, this is not an issue as bulk apis exist.
protobufs/livekit_phone_number.proto
Outdated
string country_code = 3; // Country code (e.g., "US") | ||
string area_code = 4; // Area code (e.g., "415") | ||
string national_number = 5; // National number without country code (e.g., "4155552671") | ||
bool is_mobile = 6; // Whether this is a mobile number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any other kinds? I've seen "toll-free" as a separate category as well, for example. If so, we might need an enum here.
protobufs/livekit_phone_number.proto
Outdated
string area_code = 4; // Area code (e.g., "415") | ||
string national_number = 5; // National number without country code (e.g., "4155552671") | ||
bool is_mobile = 6; // Whether this is a mobile number | ||
string status = 7; // Current status ("active", "pending", "released") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The number of these states seem fixed, we probably could define most of them upfront as an enum.
…nd pricing for the same
string number_type = 5; // e.g., local, toll-free, national, mobile | ||
string locality = 6; // City/locality (e.g., "San Francisco") | ||
string region = 7; // State/region (e.g., "CA") | ||
int64 spam_score = 8; // can be used later for fraud detection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int64 spam_score = 8; // can be used later for fraud detection | |
double spam_score = 8; // can be used later for fraud detection |
protobufs/livekit_phone_number.proto
Outdated
int64 created_at = 9; // timestamp when created | ||
int64 updated_at = 10; // timestamp when updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int64 created_at = 9; // timestamp when created | |
int64 updated_at = 10; // timestamp when updated | |
google.protobuf.Timestamp created_at = 9; // timestamp when created | |
google.protobuf.Timestamp updated_at = 10; // timestamp when updated |
We should use Timestamp
type in the new protos, since it's always unclear in which units the int timestamp is.
protobufs/livekit_phone_number.proto
Outdated
int64 released_at = 4; // Timestamp when the number was released (if applicable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int64 assigned_at = 3; // Timestamp when the number was assigned | |
int64 released_at = 4; // Timestamp when the number was released (if applicable) | |
google.protobuf.Timestamp assigned_at = 3; // Timestamp when the number was assigned | |
google.protobuf.Timestamp released_at = 4; // Timestamp when the number was released (if applicable) |
protobufs/livekit_phone_number.proto
Outdated
int32 total_count = 2; // Total number of available numbers | ||
int32 limit = 3; // Limit used in the request | ||
int32 offset = 4; // Offset used in the request | ||
string next_page_token = 2; // Token for next page (empty if no more pages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should make a new TokenPagination
in the livekit_models.proto
, similar to existing Pagination
. It will allow us to write a generic pagination code an reuse it for all models.
No description provided.