Skip to content

Commit

Permalink
Set default identity for CreateSIPParticipant. (#982)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc authored Feb 18, 2025
1 parent bfe8101 commit 0a12e2c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/sip-outbound-identity-opt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"github.com/livekit/protocol": patch
---

Remove SIP outbound number normalization for Telnyx.
6 changes: 5 additions & 1 deletion rpc/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ func NewCreateSIPParticipantRequest(
if req.IncludeHeaders != 0 {
includeHeaders = req.IncludeHeaders
}
participantIdentity := req.ParticipantIdentity
if participantIdentity == "" {
participantIdentity = "sip_" + req.SipCallTo
}

return &InternalCreateSIPParticipantRequest{
ProjectId: projectID,
Expand All @@ -111,7 +115,7 @@ func NewCreateSIPParticipantRequest(
WsUrl: wsUrl,
Token: token,
RoomName: req.RoomName,
ParticipantIdentity: req.ParticipantIdentity,
ParticipantIdentity: participantIdentity,
ParticipantName: req.ParticipantName,
ParticipantMetadata: req.ParticipantMetadata,
ParticipantAttributes: attrs,
Expand Down
4 changes: 3 additions & 1 deletion rpc/sip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestNewCreateSIPParticipantRequest(t *testing.T) {
Username: "user",
Password: "pass",
RoomName: "room",
ParticipantIdentity: "sip_+3333",
ParticipantMetadata: "meta",
Token: "token",
WsUrl: "url",
Expand Down Expand Up @@ -85,16 +86,17 @@ func TestNewCreateSIPParticipantRequest(t *testing.T) {
Username: "user",
Password: "pass",
RoomName: "room",
ParticipantMetadata: "meta",
Token: "token",
WsUrl: "url",
Dtmf: "1234#",
PlayDialtone: true,
ParticipantIdentity: "sip_+3333",
ParticipantAttributes: map[string]string{
"extra": "1",
livekit.AttrSIPCallID: "call-id",
livekit.AttrSIPTrunkID: "trunk",
},
ParticipantMetadata: "meta",
Headers: map[string]string{
"X-A": "A",
"X-B": "B2",
Expand Down

0 comments on commit 0a12e2c

Please sign in to comment.