Skip to content

Commit

Permalink
Fix typo in SIP Trunk conversion. (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennwc authored Jun 20, 2024
1 parent f50408c commit 7814d0f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-mugs-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"github.com/livekit/protocol": patch
---

Fix typo in SIP Trunk conversion.
4 changes: 2 additions & 2 deletions livekit/sip.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func (p *SIPTrunkInfo) AsOutbound() *SIPOutboundTrunkInfo {
Address: p.OutboundAddress,
Transport: p.Transport,
Numbers: nums,
AuthUsername: p.InboundUsername,
AuthPassword: p.InboundPassword,
AuthUsername: p.OutboundUsername,
AuthPassword: p.OutboundPassword,
}
}

Expand Down
37 changes: 37 additions & 0 deletions livekit/sip_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package livekit

import (
"github.com/stretchr/testify/require"
"testing"
)

func TestSIPTrunkAs(t *testing.T) {
t.Run("inbound", func(t *testing.T) {
in := &SIPInboundTrunkInfo{
SipTrunkId: "id",
Name: "name",
Metadata: "{}",
Numbers: []string{"+1"},
AllowedAddresses: []string{"sip.com"},
AllowedNumbers: []string{"+2", "+3"},
AuthUsername: "user",
AuthPassword: "pass",
}
got := in.AsTrunkInfo().AsInbound()
require.Equal(t, in, got)
})
t.Run("outbound", func(t *testing.T) {
out := &SIPOutboundTrunkInfo{
SipTrunkId: "id",
Name: "name",
Metadata: "{}",
Address: "sip.com",
Transport: 1,
Numbers: []string{"+1"},
AuthUsername: "user",
AuthPassword: "pass",
}
got := out.AsTrunkInfo().AsOutbound()
require.Equal(t, out, got)
})
}

0 comments on commit 7814d0f

Please sign in to comment.