Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/tender-facts-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"github.com/livekit/protocol": minor
---

Added DisplayName field to CreateSIPParticipantRequest
29 changes: 23 additions & 6 deletions livekit/livekit_sip.pb.go

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

564 changes: 283 additions & 281 deletions livekit/livekit_sip.twirp.go

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions livekit/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,16 @@ func (p *CreateSIPParticipantRequest) Validate() error {
if err := validateHeaderKeys(p.Headers); err != nil {
return err
}

// Validate display_name if provided
if p.DisplayName != nil {
if len(*p.DisplayName) > 128 {
return errors.New("display_name too long (max 128 characters)")
}

// TODO: Validate display name doesn't contain invalid characters
}

return nil
}

Expand Down
10 changes: 9 additions & 1 deletion protobufs/livekit_sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,15 @@ message CreateSIPParticipantRequest {

// Wait for the answer for the call before returning.
bool wait_until_answered = 19;
// NEXT ID: 21

// Optional display name for the 'From' SIP header.
//
// Cases:
// 1) Unspecified: Use legacy behavior - display name will be set to be the caller's number.
// 2) Empty string: Do not send a display name, which will result in a CNAM lookup downstream.
// 3) Non-empty: Use the specified value as the display name.
optional string display_name = 21;
// NEXT ID: 22
}

message SIPParticipantInfo {
Expand Down
10 changes: 9 additions & 1 deletion protobufs/rpc/sip.proto
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ message InternalCreateSIPParticipantRequest {
// Wait for the answer for the call before returning.
bool wait_until_answered = 29;

// NEXT ID: 31
// Optional display name for the 'From' SIP header.
//
// Cases:
// 1) Unspecified: Use legacy behavior - display name will be set to be the caller's number.
// 2) Empty string: Do not send a display name, which will result in a CNAM lookup downstream.
// 3) Non-empty: Use the specified value as the display name.
optional string display_name = 31;
Copy link
Contributor

Choose a reason for hiding this comment

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

In theory, we could avoid optional here, since we can populate display_name to a number in NewCreateSIPParticipantRequest. The only concern would be that the backend still cannot know if it should follow the old logic or a new one.


// NEXT ID: 32
Copy link
Contributor

Choose a reason for hiding this comment

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

@dennwc perhaps for another change, but couldn't we reuse CreateSIPParticipantRequest here ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not directly, but yes, this is on my TODO list as well.

Sharing one structure likely won't work well, because internal has a different representation of a few things (e.g. feature flags).

I was thinking that we should slice this structure into a few smaller ones. Everything related to media setup can be one structure, shared for internal Create, public Create and also for inbound trunks. Similarly, there are fields related to how SIP should join LK room, this could be another structure shared for Create and EvaluateDispatch. The plan is also to allow storing these objects directly into the DB, so that we don't have to flatten/unflatten from SQL and add columns each time we add another flag that is never used as a filter for DB queries.

}

message InternalCreateSIPParticipantResponse {
Expand Down
4 changes: 4 additions & 0 deletions rpc/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func NewCreateSIPParticipantRequest(
req *livekit.CreateSIPParticipantRequest,
trunk *livekit.SIPOutboundTrunkInfo,
) (*InternalCreateSIPParticipantRequest, error) {
if err := req.Validate(); err != nil {
return nil, err
}
var (
hostname string
enc livekit.SIPMediaEncryption
Expand Down Expand Up @@ -190,6 +193,7 @@ func NewCreateSIPParticipantRequest(
MaxCallDuration: req.MaxCallDuration,
MediaEncryption: enc,
WaitUntilAnswered: req.WaitUntilAnswered,
DisplayName: req.DisplayName,
}, nil
}

Expand Down
27 changes: 22 additions & 5 deletions rpc/sip.pb.go

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

Loading
Loading