Skip to content

Commit 3476f45

Browse files
authored
Ading configurable SIP display name (#1216)
1 parent 03368ec commit 3476f45

10 files changed

Lines changed: 433 additions & 359 deletions

File tree

.changeset/tender-facts-mate.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"github.com/livekit/protocol": minor
3+
---
4+
5+
Added DisplayName field to CreateSIPParticipantRequest

livekit/livekit_sip.pb.go

Lines changed: 23 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

livekit/livekit_sip.twirp.go

Lines changed: 283 additions & 281 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

livekit/sip.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,16 @@ func (p *CreateSIPParticipantRequest) Validate() error {
675675
if err := validateHeaderKeys(p.Headers); err != nil {
676676
return err
677677
}
678+
679+
// Validate display_name if provided
680+
if p.DisplayName != nil {
681+
if len(*p.DisplayName) > 128 {
682+
return errors.New("display_name too long (max 128 characters)")
683+
}
684+
685+
// TODO: Validate display name doesn't contain invalid characters
686+
}
687+
678688
return nil
679689
}
680690

protobufs/livekit_sip.proto

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,15 @@ message CreateSIPParticipantRequest {
669669

670670
// Wait for the answer for the call before returning.
671671
bool wait_until_answered = 19;
672-
// NEXT ID: 21
672+
673+
// Optional display name for the 'From' SIP header.
674+
//
675+
// Cases:
676+
// 1) Unspecified: Use legacy behavior - display name will be set to be the caller's number.
677+
// 2) Empty string: Do not send a display name, which will result in a CNAM lookup downstream.
678+
// 3) Non-empty: Use the specified value as the display name.
679+
optional string display_name = 21;
680+
// NEXT ID: 22
673681
}
674682

675683
message SIPParticipantInfo {

protobufs/rpc/sip.proto

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,15 @@ message InternalCreateSIPParticipantRequest {
105105
// Wait for the answer for the call before returning.
106106
bool wait_until_answered = 29;
107107

108-
// NEXT ID: 31
108+
// Optional display name for the 'From' SIP header.
109+
//
110+
// Cases:
111+
// 1) Unspecified: Use legacy behavior - display name will be set to be the caller's number.
112+
// 2) Empty string: Do not send a display name, which will result in a CNAM lookup downstream.
113+
// 3) Non-empty: Use the specified value as the display name.
114+
optional string display_name = 31;
115+
116+
// NEXT ID: 32
109117
}
110118

111119
message InternalCreateSIPParticipantResponse {

rpc/sip.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ func NewCreateSIPParticipantRequest(
7171
req *livekit.CreateSIPParticipantRequest,
7272
trunk *livekit.SIPOutboundTrunkInfo,
7373
) (*InternalCreateSIPParticipantRequest, error) {
74+
if err := req.Validate(); err != nil {
75+
return nil, err
76+
}
7477
var (
7578
hostname string
7679
enc livekit.SIPMediaEncryption
@@ -190,6 +193,7 @@ func NewCreateSIPParticipantRequest(
190193
MaxCallDuration: req.MaxCallDuration,
191194
MediaEncryption: enc,
192195
WaitUntilAnswered: req.WaitUntilAnswered,
196+
DisplayName: req.DisplayName,
193197
}, nil
194198
}
195199

rpc/sip.pb.go

Lines changed: 22 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)