Skip to content

Commit b30b095

Browse files
Clean up and changes around common fields for Phone number messages and pricing for the same
1 parent 479e6a5 commit b30b095

File tree

1 file changed

+56
-33
lines changed

1 file changed

+56
-33
lines changed

protobufs/livekit_phone_number.proto

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ option go_package = "github.com/livekit/protocol/livekit";
66

77
import "google/protobuf/empty.proto";
88

9+
// Phone number status enumeration
10+
enum PhoneNumberStatus {
11+
PHONE_NUMBER_STATUS_UNSPECIFIED = 0; // Default value
12+
PHONE_NUMBER_STATUS_ACTIVE = 1; // Number is active and ready for use
13+
PHONE_NUMBER_STATUS_PENDING = 2; // Number is being provisioned
14+
PHONE_NUMBER_STATUS_RELEASED = 3; // Number has been released
15+
}
16+
917
// Public Phone Number Service - External API for phone number management
1018
service PhoneNumberService {
1119
// List available phone numbers in inventory
@@ -29,70 +37,85 @@ service PhoneNumberService {
2937
message ListPhoneNumberInventoryRequest {
3038
string country_code = 1; // Optional: Filter by country code (e.g., "US", "CA")
3139
string area_code = 2; // Optional: Filter by area code (e.g., "415")
32-
string pattern = 3; // Optional: Filter by pattern (e.g., "***-***-1234")
33-
int32 limit = 4; // Optional: Maximum number of results (default: 50)
34-
int32 offset = 5; // Optional: Number of results to skip (default: 0)
40+
int32 limit = 3; // Optional: Maximum number of results (default: 50)
41+
string page_token = 4; // Optional: Token for pagination (empty for first page)
3542
}
3643

3744
// ListPhoneNumberInventoryResponse - Response containing available phone numbers
3845
message ListPhoneNumberInventoryResponse {
3946
repeated PhoneNumberInventoryItem items = 1; // List of available phone numbers
40-
int32 total_count = 2; // Total number of available numbers
41-
int32 limit = 3; // Limit used in the request
42-
int32 offset = 4; // Offset used in the request
47+
string next_page_token = 2; // Token for next page (empty if no more pages)
4348
}
4449

45-
// PurchasePhoneNumberRequest - Request to purchase a phone number
50+
// PurchasePhoneNumberRequest - Request to purchase phone numbers
4651
message PurchasePhoneNumberRequest {
47-
string phone_number = 1; // Phone number to purchase (e.g., "+1234567890")
52+
repeated string phone_numbers = 1; // Phone numbers to purchase (e.g., ["+1234567890", "+1234567891"])
4853
}
4954

50-
// PurchasePhoneNumberResponse - Response containing the purchased phone number
55+
// PurchasePhoneNumberResponse - Response containing the purchased phone numbers
5156
message PurchasePhoneNumberResponse {
52-
PurchasedPhoneNumber phone_number = 1; // Details of the purchased phone number
57+
repeated PurchasedPhoneNumber phone_numbers = 1; // Details of the purchased phone numbers
5358
}
5459

5560
// ListPurchasedPhoneNumbersRequest - Request to list purchased phone numbers
5661
message ListPurchasedPhoneNumbersRequest {
5762
int32 limit = 1; // Optional: Maximum number of results (default: 50)
58-
int32 offset = 2; // Optional: Number of results to skip (default: 0)
63+
string page_token = 2; // Optional: Token for pagination (empty for first page)
5964
}
6065

6166
// ListPurchasedPhoneNumbersResponse - Response containing purchased phone numbers
6267
message ListPurchasedPhoneNumbersResponse {
6368
repeated PurchasedPhoneNumber items = 1; // List of purchased phone numbers
64-
int32 total_count = 2; // Total number of purchased numbers
65-
int32 limit = 3; // Limit used in the request
66-
int32 offset = 4; // Offset used in the request
69+
string next_page_token = 2; // Token for next page (empty if no more pages)
70+
int32 total_count = 3; // Total number of purchased phone numbers
6771
}
6872

6973
// ReleasePhoneNumberRequest - Request to release a purchased phone number
7074
message ReleasePhoneNumberRequest {
7175
string phone_number = 1; // Phone number to release (e.g., "+1234567890")
7276
}
7377

78+
// GlobalPhoneNumber represents a phone number with standardized format
79+
message GlobalPhoneNumber {
80+
string id = 1; // unique identifier
81+
string e164_format = 2; // e.g., "+14155552671"
82+
string country_code = 3; // e.g., "US"
83+
string area_code = 4; // e.g., "415"
84+
string number_type = 5; // e.g., local, toll-free, national, mobile
85+
string locality = 6; // City/locality (e.g., "San Francisco")
86+
string region = 7; // State/region (e.g., "CA")
87+
int64 spam_score = 8; // can be used later for fraud detection
88+
int64 created_at = 9; // timestamp when created
89+
int64 updated_at = 10; // timestamp when updated
90+
}
91+
92+
// PhoneNumberCost represents the pricing structure for a phone number
93+
message PhoneNumberCost {
94+
string currency = 1; // Currency code (e.g., "USD", "EUR")
95+
96+
// Monthly rental cost
97+
double monthly_rental = 2; // Monthly rental cost (e.g., 10.00)
98+
99+
// Voice calling costs
100+
double voice_cost = 3; // Voice cost per unit (e.g., 2.00)
101+
string voice_billing_unit = 4; // Voice billing unit (e.g., "minute", "second", "call")
102+
103+
// SMS costs
104+
double sms_cost = 5; // SMS cost per unit (e.g., 0.50)
105+
string sms_billing_unit = 6; // SMS billing unit (e.g., "message", "character")
106+
}
107+
74108
// PhoneNumberInventoryItem - Represents an available phone number for purchase
75109
message PhoneNumberInventoryItem {
76-
string phone_number = 1; // Phone number in E.164 format (e.g., "+14155552671")
77-
string country_code = 2; // Country code (e.g., "US")
78-
string area_code = 3; // Area code (e.g., "415")
79-
string locality = 4; // City/locality (e.g., "San Francisco")
80-
string region = 5; // State/region (e.g., "CA")
81-
string capabilities = 6; // Comma-separated capabilities (e.g., "voice,sms")
82-
int64 monthly_cost_cents = 7; // Monthly cost in cents
83-
bool available = 8; // Whether the number is currently available
84-
string carrier_name = 9; // Name of the carrier providing this number
110+
GlobalPhoneNumber phone_number = 1; // Common phone number fields
111+
repeated string capabilities = 2; // Comma-separated capabilities (e.g., "voice,sms")
112+
PhoneNumberCost cost = 3; // Cost structure for this phone number
85113
}
86114

87115
// PurchasedPhoneNumber - Represents a phone number owned by a LiveKit project
88116
message PurchasedPhoneNumber {
89-
string id = 1; // Unique identifier for the phone number
90-
string phone_number = 2; // Phone number in E.164 format (e.g., "+14155552671")
91-
string country_code = 3; // Country code (e.g., "US")
92-
string area_code = 4; // Area code (e.g., "415")
93-
string national_number = 5; // National number without country code (e.g., "4155552671")
94-
bool is_mobile = 6; // Whether this is a mobile number
95-
string status = 7; // Current status ("active", "pending", "released")
96-
int64 assigned_at = 8; // Timestamp when the number was assigned
97-
int64 released_at = 9; // Timestamp when the number was released (if applicable)
98-
}
117+
GlobalPhoneNumber phone_number = 1; // Common phone number fields
118+
PhoneNumberStatus status = 2; // Current status of the phone number
119+
int64 assigned_at = 3; // Timestamp when the number was assigned
120+
int64 released_at = 4; // Timestamp when the number was released (if applicable)
121+
}

0 commit comments

Comments
 (0)