Skip to content
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

Add support for additional SIP transports #719

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/modern-penguins-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@livekit/protocol": minor
"github.com/livekit/protocol": minor
---

Add support for additional SIP transports.
502 changes: 289 additions & 213 deletions livekit/livekit_sip.pb.go

Large diffs are not rendered by default.

135 changes: 70 additions & 65 deletions livekit/livekit_sip.twirp.go

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

12 changes: 12 additions & 0 deletions protobufs/livekit_sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ message CreateSIPTrunkRequest {
string metadata = 11;
}

enum SIPTransport {
SIP_TRANSPORT_AUTO = 0;
SIP_TRANSPORT_UDP = 1;
SIP_TRANSPORT_TCP = 2;
SIP_TRANSPORT_TLS = 3;
}

message SIPTrunkInfo {
string sip_trunk_id = 1;

Expand All @@ -103,6 +110,9 @@ message SIPTrunkInfo {
// Number used to make outbound calls
string outbound_number = 4;

// Transport used for inbound and outbound calls.
SIPTransport transport = 13;

repeated string inbound_numbers_regex = 5 [deprecated=true];

// Accepted `To` values. This Trunk will only accept a call made to
Expand All @@ -121,6 +131,8 @@ message SIPTrunkInfo {
string name = 11;
// User-defined metadata for the Trunk.
string metadata = 12;

// NEXT ID: 14
}

message ListSIPTrunkRequest {
Expand Down
4 changes: 3 additions & 1 deletion protobufs/rpc/sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package rpc;
option go_package = "github.com/livekit/protocol/rpc";

import "options.proto";
import "livekit_sip.proto";

service SIPInternal {
rpc CreateSIPParticipant(InternalCreateSIPParticipantRequest) returns (InternalCreateSIPParticipantResponse) {
Expand All @@ -31,6 +32,7 @@ message InternalCreateSIPParticipantRequest {
string sip_call_id = 13;
// IP that SIP INVITE is sent too
string address = 2;
livekit.SIPTransport transport = 16;

// Number used to make the call
string number = 3;
Expand Down Expand Up @@ -59,7 +61,7 @@ message InternalCreateSIPParticipantRequest {
// Optionally play ringtone in the room as an audible indicator for existing participants
bool play_ringtone = 12;

// NEXT ID: 16
// NEXT ID: 17
}

message InternalCreateSIPParticipantResponse {
Expand Down
29 changes: 29 additions & 0 deletions rpc/sip.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package rpc

import "github.com/livekit/protocol/livekit"

// NewCreateSIPParticipantRequest fills InternalCreateSIPParticipantRequest from
// livekit.CreateSIPParticipantRequest and livekit.SIPTrunkInfo.
func NewCreateSIPParticipantRequest(
callID, wsUrl, token string,
req *livekit.CreateSIPParticipantRequest,
trunk *livekit.SIPTrunkInfo,
) *InternalCreateSIPParticipantRequest {
return &InternalCreateSIPParticipantRequest{
SipCallId: callID,
Address: trunk.OutboundAddress,
Transport: trunk.Transport,
Number: trunk.OutboundNumber,
Username: trunk.OutboundUsername,
Password: trunk.OutboundPassword,
CallTo: req.SipCallTo,
WsUrl: wsUrl,
Token: token,
RoomName: req.RoomName,
ParticipantIdentity: req.ParticipantIdentity,
ParticipantName: req.ParticipantName,
ParticipantMetadata: req.ParticipantMetadata,
Dtmf: req.Dtmf,
PlayRingtone: req.PlayRingtone,
}
}
Loading
Loading