Skip to content

Commit e38544b

Browse files
authored
Expose SIP update APIs. (#626)
1 parent a5f5f6e commit e38544b

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/gorilla/websocket v1.5.3
1313
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
1414
github.com/livekit/mediatransportutil v0.0.0-20241220010243-a2bdee945564
15-
github.com/livekit/protocol v1.35.1-0.20250319165056-fdacb1a293e5
15+
github.com/livekit/protocol v1.35.1-0.20250320161708-6d044a0462b3
1616
github.com/magefile/mage v1.15.0
1717
github.com/pion/dtls/v3 v3.0.4
1818
github.com/pion/interceptor v0.1.37

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkD
9191
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
9292
github.com/livekit/mediatransportutil v0.0.0-20241220010243-a2bdee945564 h1:GX7KF/V9ExmcfT/2Bdia8aROjkxrgx7WpyH7w9MB4J4=
9393
github.com/livekit/mediatransportutil v0.0.0-20241220010243-a2bdee945564/go.mod h1:36s+wwmU3O40IAhE+MjBWP3W71QRiEE9SfooSBvtBqY=
94-
github.com/livekit/protocol v1.35.1-0.20250319165056-fdacb1a293e5 h1:onBZ5milSh7iAnapx1ju/z51bvb5RgLmlVBPdNJbg2Y=
95-
github.com/livekit/protocol v1.35.1-0.20250319165056-fdacb1a293e5/go.mod h1:WrT/CYRxtMNOVUjnIPm5OjWtEkmreffTeE1PRZwlRg4=
94+
github.com/livekit/protocol v1.35.1-0.20250320161708-6d044a0462b3 h1:RsVnIuxnj3wRzWILhpnguyrq3vrK6Cccb762GpLH3Xg=
95+
github.com/livekit/protocol v1.35.1-0.20250320161708-6d044a0462b3/go.mod h1:WrT/CYRxtMNOVUjnIPm5OjWtEkmreffTeE1PRZwlRg4=
9696
github.com/livekit/psrpc v0.6.1-0.20250205181828-a0beed2e4126 h1:fzuYpAQbCid7ySPpQWWePfQOWUrs8x6dJ0T3Wl07n+Y=
9797
github.com/livekit/psrpc v0.6.1-0.20250205181828-a0beed2e4126/go.mod h1:X5WtEZ7OnEs72Fi5/J+i0on3964F1aynQpCalcgMqRo=
9898
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=

sipclient.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,32 @@ func (s *SIPClient) CreateSIPOutboundTrunk(ctx context.Context, in *livekit.Crea
7171
return s.sipClient.CreateSIPOutboundTrunk(ctx, in)
7272
}
7373

74+
// UpdateSIPInboundTrunk updates an existing SIP Inbound Trunk.
75+
func (s *SIPClient) UpdateSIPInboundTrunk(ctx context.Context, in *livekit.UpdateSIPInboundTrunkRequest) (*livekit.SIPInboundTrunkInfo, error) {
76+
if in == nil || in.Action == nil || in.SipTrunkId == "" {
77+
return nil, ErrInvalidParameter
78+
}
79+
80+
ctx, err := s.withAuth(ctx, withSIPGrant{Admin: true})
81+
if err != nil {
82+
return nil, err
83+
}
84+
return s.sipClient.UpdateSIPInboundTrunk(ctx, in)
85+
}
86+
87+
// UpdateSIPOutboundTrunk updates an existing SIP Outbound Trunk.
88+
func (s *SIPClient) UpdateSIPOutboundTrunk(ctx context.Context, in *livekit.UpdateSIPOutboundTrunkRequest) (*livekit.SIPOutboundTrunkInfo, error) {
89+
if in == nil || in.Action == nil || in.SipTrunkId == "" {
90+
return nil, ErrInvalidParameter
91+
}
92+
93+
ctx, err := s.withAuth(ctx, withSIPGrant{Admin: true})
94+
if err != nil {
95+
return nil, err
96+
}
97+
return s.sipClient.UpdateSIPOutboundTrunk(ctx, in)
98+
}
99+
74100
// GetSIPInboundTrunksByIDs gets SIP Inbound Trunks by ID.
75101
// Returned slice is in the same order as the IDs. Missing IDs will have nil in the corresponding position.
76102
func (s *SIPClient) GetSIPInboundTrunksByIDs(ctx context.Context, ids []string) ([]*livekit.SIPInboundTrunkInfo, error) {
@@ -182,6 +208,19 @@ func (s *SIPClient) CreateSIPDispatchRule(ctx context.Context, in *livekit.Creat
182208
return s.sipClient.CreateSIPDispatchRule(ctx, in)
183209
}
184210

211+
// UpdateSIPDispatchRule updates an existing SIP Dispatch Rule.
212+
func (s *SIPClient) UpdateSIPDispatchRule(ctx context.Context, in *livekit.UpdateSIPDispatchRuleRequest) (*livekit.SIPDispatchRuleInfo, error) {
213+
if in == nil || in.Action == nil || in.SipDispatchRuleId == "" {
214+
return nil, ErrInvalidParameter
215+
}
216+
217+
ctx, err := s.withAuth(ctx, withSIPGrant{Admin: true})
218+
if err != nil {
219+
return nil, err
220+
}
221+
return s.sipClient.UpdateSIPDispatchRule(ctx, in)
222+
}
223+
185224
// GetSIPDispatchRulesByIDs gets SIP Dispatch Rules by ID.
186225
// Returned slice is in the same order as the IDs. Missing IDs will have nil in the corresponding position.
187226
func (s *SIPClient) GetSIPDispatchRulesByIDs(ctx context.Context, ids []string) ([]*livekit.SIPDispatchRuleInfo, error) {

0 commit comments

Comments
 (0)