Skip to content

Commit

Permalink
Pass additional metadata for SIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc committed Apr 25, 2024
1 parent bad3fc9 commit 5aec8e2
Show file tree
Hide file tree
Showing 13 changed files with 657 additions and 346 deletions.
6 changes: 6 additions & 0 deletions .changeset/itchy-bulldogs-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"github.com/livekit/protocol": minor
"@livekit/protocol": minor
---

Add metadata to SIP trunks, dispatch rules and participants. Change SIP participant identity prefix to `sip_`.
233 changes: 170 additions & 63 deletions livekit/livekit_sip.pb.go

Large diffs are not rendered by default.

126 changes: 65 additions & 61 deletions livekit/livekit_sip.twirp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions protobufs/livekit_sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ message CreateSIPTrunkRequest {
string inbound_password = 6;
string outbound_username = 7;
string outbound_password = 8;

// Optional human-readable name for the Trunk.
string name = 10;
// Optional user-defined metadata for the Trunk.
string metadata = 11;
}

message SIPTrunkInfo {
Expand Down Expand Up @@ -111,6 +116,11 @@ message SIPTrunkInfo {
string inbound_password = 7;
string outbound_username = 8;
string outbound_password = 9;

// Human-readable name for the Trunk.
string name = 11;
// User-defined metadata for the Trunk.
string metadata = 12;
}

message ListSIPTrunkRequest {
Expand Down Expand Up @@ -162,13 +172,24 @@ message CreateSIPDispatchRuleRequest {
// By default the From value (Phone number) is used as the participant identity
// If true a random value will be used instead
bool hide_phone_number = 3;

// Optional human-readable name for the Dispatch Rule.
string name = 4;
// Optional user-defined metadata for the Dispatch Rule.
string metadata = 5;
}

message SIPDispatchRuleInfo {
string sip_dispatch_rule_id = 1;
SIPDispatchRule rule = 2;
repeated string trunk_ids = 3;
bool hide_phone_number = 4;

// Human-readable name for the Dispatch Rule.
string name = 5;
// User-defined metadata for the Dispatch Rule.
// Participants created by this rule will inherit this metadata.
string metadata = 6;
}

message ListSIPDispatchRuleRequest {
Expand Down Expand Up @@ -200,16 +221,22 @@ message CreateSIPParticipantRequest {
// Optional name of the participant in LiveKit room
string participant_name = 7;

// Optional user-defined metadata. Will be attached to a created Participant in the room.
string participant_metadata = 8;

// Optionally send following DTMF digits (extension codes) when making a call.
// Character 'w' can be used to add a 0.5 sec delay.
string dtmf = 5;

// Optionally play ringtone in the room as an audible indicator for existing participants
bool play_ringtone = 6;

// NEXT ID: 9
}

message SIPParticipantInfo {
string participant_id = 1;
string participant_identity = 2;
string room_name = 3;
string sip_call_id = 4;
}
22 changes: 20 additions & 2 deletions protobufs/rpc/io.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ message UpdateIngressStateRequest {
}

message GetSIPTrunkAuthenticationRequest {
string sip_call_id = 6;
// What Number is calling
string from = 2;

Expand All @@ -81,17 +82,22 @@ message GetSIPTrunkAuthenticationRequest {

// What Host was called
string to_host = 5;

// NEXT ID: 7
}

message GetSIPTrunkAuthenticationResponse {
// Expected username and password
string username = 1;
string password = 2;
bool drop = 3;
// Trunk used to fulfill this request
string sip_trunk_id = 4;
}

message EvaluateSIPDispatchRulesRequest {
string sip_participant_id = 1;
string sip_call_id = 8;
string sip_participant_id = 1 [deprecated=true];

// What Number is calling
string calling_number = 2;
Expand All @@ -110,14 +116,20 @@ message EvaluateSIPDispatchRulesRequest {

// What Host was called
string called_host = 7;

// NEXT ID: 9
}

message EvaluateSIPDispatchRulesResponse {
// non-empty string if SIPParticipant should be placed a room
string room_name = 1;

// What should be used for the LiveKit identity
// What should be used for the LiveKit participant identity
string participant_identity = 2;
// What should be used for the LiveKit participant name
string participant_name = 7;
// What should be used for the LiveKit participant metadata
string participant_metadata = 8;

bool request_pin = 3 [deprecated=true]; // see result

Expand All @@ -128,6 +140,12 @@ message EvaluateSIPDispatchRulesResponse {
string ws_url = 5;

SIPDispatchResult result = 6;

// Trunk used to fulfill this request
string sip_trunk_id = 9;
// Dispatch Rule used to fulfill this request
string sip_dispatch_rule_id = 10;
// NEXT ID: 11
}

enum SIPDispatchResult {
Expand Down
6 changes: 6 additions & 0 deletions protobufs/rpc/sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ service SIPInternal {
}

message InternalCreateSIPParticipantRequest {
string sip_call_id = 13;
// IP that SIP INVITE is sent too
string address = 2;

Expand All @@ -42,6 +43,8 @@ message InternalCreateSIPParticipantRequest {

string room_name = 7;
string participant_identity = 8;
string participant_name = 14;
string participant_metadata = 15;

// optional token that should be used when creating LiveKit participant
string token = 9;
Expand All @@ -55,9 +58,12 @@ message InternalCreateSIPParticipantRequest {

// Optionally play ringtone in the room as an audible indicator for existing participants
bool play_ringtone = 12;

// NEXT ID: 16
}

message InternalCreateSIPParticipantResponse {
string participant_id = 1;
string participant_identity = 2;
string sip_call_id = 3;
}
Loading

0 comments on commit 5aec8e2

Please sign in to comment.