livekit-server-sdk 0.8.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/banner_dark.png +0 -0
  4. data/.github/banner_light.png +0 -0
  5. data/.github/workflows/generate-protobufs.yml +82 -0
  6. data/.github/workflows/test-api.yml +43 -0
  7. data/.github/workflows/test.yml +10 -7
  8. data/CHANGELOG.md +18 -0
  9. data/Gemfile.lock +70 -39
  10. data/README.md +7 -5
  11. data/Rakefile +8 -2
  12. data/bin/bootstrap.sh +1 -1
  13. data/lib/livekit/agent_dispatch_service_client.rb +11 -9
  14. data/lib/livekit/auth_mixin.rb +23 -8
  15. data/lib/livekit/connector_service_client.rb +87 -0
  16. data/lib/livekit/dial_timeout.rb +26 -0
  17. data/lib/livekit/egress_service_client.rb +41 -19
  18. data/lib/livekit/errors.rb +60 -0
  19. data/lib/livekit/failover.rb +215 -0
  20. data/lib/livekit/grants.rb +6 -2
  21. data/lib/livekit/ingress_service_client.rb +8 -6
  22. data/lib/livekit/livekit_api.rb +67 -0
  23. data/lib/livekit/proto/livekit_agent_dispatch_pb.rb +3 -1
  24. data/lib/livekit/proto/livekit_agent_dispatch_twirp.rb +1 -1
  25. data/lib/livekit/proto/livekit_agent_pb.rb +2 -1
  26. data/lib/livekit/proto/livekit_agent_twirp.rb +1 -1
  27. data/lib/livekit/proto/livekit_connector_pb.rb +20 -0
  28. data/lib/livekit/proto/livekit_connector_twilio_pb.rb +22 -0
  29. data/lib/livekit/proto/livekit_connector_twilio_twirp.rb +8 -0
  30. data/lib/livekit/proto/livekit_connector_twirp.rb +21 -0
  31. data/lib/livekit/proto/livekit_connector_whatsapp_pb.rb +32 -0
  32. data/lib/livekit/proto/livekit_connector_whatsapp_twirp.rb +8 -0
  33. data/lib/livekit/proto/livekit_egress_pb.rb +33 -16
  34. data/lib/livekit/proto/livekit_egress_twirp.rb +6 -5
  35. data/lib/livekit/proto/livekit_ingress_pb.rb +2 -1
  36. data/lib/livekit/proto/livekit_ingress_twirp.rb +1 -1
  37. data/lib/livekit/proto/livekit_metrics_pb.rb +3 -1
  38. data/lib/livekit/proto/livekit_metrics_twirp.rb +1 -1
  39. data/lib/livekit/proto/livekit_models_pb.rb +20 -1
  40. data/lib/livekit/proto/livekit_models_twirp.rb +1 -1
  41. data/lib/livekit/proto/livekit_room_pb.rb +8 -1
  42. data/lib/livekit/proto/livekit_room_twirp.rb +4 -1
  43. data/lib/livekit/proto/livekit_rtc_pb.rb +86 -0
  44. data/lib/livekit/proto/livekit_rtc_twirp.rb +8 -0
  45. data/lib/livekit/proto/livekit_sip_pb.rb +20 -1
  46. data/lib/livekit/proto/livekit_sip_twirp.rb +4 -1
  47. data/lib/livekit/proto/livekit_webhook_pb.rb +1 -1
  48. data/lib/livekit/proto/livekit_webhook_twirp.rb +1 -1
  49. data/lib/livekit/proto/logger/options_pb.rb +19 -0
  50. data/lib/livekit/proto/logger/options_twirp.rb +8 -0
  51. data/lib/livekit/room_service_client.rb +31 -13
  52. data/lib/livekit/sip_service_client.rb +147 -21
  53. data/lib/livekit/version.rb +1 -1
  54. data/lib/livekit.rb +3 -0
  55. data/livekit_server_sdk.gemspec +8 -8
  56. metadata +59 -32
@@ -9,7 +9,7 @@ require 'livekit_egress_pb'
9
9
  require 'livekit_ingress_pb'
10
10
 
11
11
 
12
- descriptor_data = "\n\x15livekit_webhook.proto\x12\x07livekit\x1a\x14livekit_models.proto\x1a\x14livekit_egress.proto\x1a\x15livekit_ingress.proto\"\x97\x02\n\x0cWebhookEvent\x12\r\n\x05\x65vent\x18\x01 \x01(\t\x12\x1b\n\x04room\x18\x02 \x01(\x0b\x32\r.livekit.Room\x12-\n\x0bparticipant\x18\x03 \x01(\x0b\x32\x18.livekit.ParticipantInfo\x12(\n\x0b\x65gress_info\x18\t \x01(\x0b\x32\x13.livekit.EgressInfo\x12*\n\x0cingress_info\x18\n \x01(\x0b\x32\x14.livekit.IngressInfo\x12!\n\x05track\x18\x08 \x01(\x0b\x32\x12.livekit.TrackInfo\x12\n\n\x02id\x18\x06 \x01(\t\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x12\x13\n\x0bnum_dropped\x18\x0b \x01(\x05\x42\x46Z#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3"
12
+ descriptor_data = "\n\x15livekit_webhook.proto\x12\x07livekit\x1a\x14livekit_models.proto\x1a\x14livekit_egress.proto\x1a\x15livekit_ingress.proto\"\x9b\x02\n\x0cWebhookEvent\x12\r\n\x05\x65vent\x18\x01 \x01(\t\x12\x1b\n\x04room\x18\x02 \x01(\x0b\x32\r.livekit.Room\x12-\n\x0bparticipant\x18\x03 \x01(\x0b\x32\x18.livekit.ParticipantInfo\x12(\n\x0b\x65gress_info\x18\t \x01(\x0b\x32\x13.livekit.EgressInfo\x12*\n\x0cingress_info\x18\n \x01(\x0b\x32\x14.livekit.IngressInfo\x12!\n\x05track\x18\x08 \x01(\x0b\x32\x12.livekit.TrackInfo\x12\n\n\x02id\x18\x06 \x01(\t\x12\x12\n\ncreated_at\x18\x07 \x01(\x03\x12\x17\n\x0bnum_dropped\x18\x0b \x01(\x05\x42\x02\x18\x01\x42\x46Z#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3"
13
13
 
14
14
  pool = Google::Protobuf::DescriptorPool.generated_pool
15
15
  pool.add_serialized_file(descriptor_data)
@@ -1,4 +1,4 @@
1
- # Code generated by protoc-gen-twirp_ruby 1.10.0, DO NOT EDIT.
1
+ # Code generated by protoc-gen-twirp_ruby 1.14.1, DO NOT EDIT.
2
2
  require 'twirp'
3
3
  require_relative 'livekit_webhook_pb.rb'
4
4
 
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: logger/options.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/protobuf/descriptor_pb'
8
+
9
+
10
+ descriptor_data = "\n\x14logger/options.proto\x12\x06logger\x1a google/protobuf/descriptor.proto*W\n\x0bSensitivity\x12\x1b\n\x17SENSITIVITY_UNSPECIFIED\x10\x00\x12\x13\n\x0fSENSITIVITY_PII\x10\x01\x12\x16\n\x12SENSITIVITY_SECRET\x10\x02:5\n\rredact_format\x12\x1d.google.protobuf.FieldOptions\x18\x86\n \x01(\t:,\n\x04name\x12\x1d.google.protobuf.FieldOptions\x18\x87\n \x01(\t:H\n\x0bsensitivity\x12\x1d.google.protobuf.FieldOptions\x18\x88\n \x01(\x0e\x32\x13.logger.SensitivityBMZ*github.com/livekit/protocol/livekit/logger\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3"
11
+
12
+ pool = Google::Protobuf::DescriptorPool.generated_pool
13
+ pool.add_serialized_file(descriptor_data)
14
+
15
+ module LiveKit
16
+ module Proto
17
+ Sensitivity = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("logger.Sensitivity").enummodule
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ # Code generated by protoc-gen-twirp_ruby 1.14.1, DO NOT EDIT.
2
+ require 'twirp'
3
+ require_relative 'options_pb.rb'
4
+
5
+ module LiveKit
6
+ module Proto
7
+ end
8
+ end
@@ -4,6 +4,7 @@ require 'securerandom'
4
4
  require "livekit/proto/livekit_room_twirp"
5
5
  require "livekit/auth_mixin"
6
6
  require 'livekit/utils'
7
+ require 'livekit/failover'
7
8
 
8
9
 
9
10
  module LiveKit
@@ -12,10 +13,11 @@ module LiveKit
12
13
  include AuthMixin
13
14
  attr_accessor :api_key, :api_secret
14
15
 
15
- def initialize(base_url, api_key: nil, api_secret: nil)
16
- super(File.join(Utils.to_http_url(base_url), "/twirp"))
16
+ def initialize(base_url, api_key: nil, api_secret: nil, token: nil, failover: true, connection: nil)
17
+ super(connection || LiveKit::Failover.connection(base_url, failover))
17
18
  @api_key = api_key
18
19
  @api_secret = api_secret
20
+ @token = token
19
21
  end
20
22
 
21
23
  def create_room(name,
@@ -28,7 +30,7 @@ module LiveKit
28
30
  sync_streams: nil,
29
31
  departure_timeout: nil
30
32
  )
31
- self.rpc(
33
+ rpc!(
32
34
  :CreateRoom,
33
35
  Proto::CreateRoomRequest.new(
34
36
  name: name,
@@ -46,7 +48,7 @@ module LiveKit
46
48
  end
47
49
 
48
50
  def list_rooms(names: nil)
49
- self.rpc(
51
+ rpc!(
50
52
  :ListRooms,
51
53
  Proto::ListRoomsRequest.new(names: names),
52
54
  headers:auth_header(video_grant: VideoGrant.new(roomList: true)),
@@ -54,7 +56,7 @@ module LiveKit
54
56
  end
55
57
 
56
58
  def delete_room(room:)
57
- self.rpc(
59
+ rpc!(
58
60
  :DeleteRoom,
59
61
  Proto::DeleteRoomRequest.new(room: room),
60
62
  headers:auth_header(video_grant: VideoGrant.new(roomCreate: true)),
@@ -62,7 +64,7 @@ module LiveKit
62
64
  end
63
65
 
64
66
  def update_room_metadata(room:, metadata:)
65
- self.rpc(
67
+ rpc!(
66
68
  :UpdateRoomMetadata,
67
69
  Proto::UpdateRoomMetadataRequest.new(room: room, metadata: metadata),
68
70
  headers:auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room)),
@@ -70,7 +72,7 @@ module LiveKit
70
72
  end
71
73
 
72
74
  def list_participants(room:)
73
- self.rpc(
75
+ rpc!(
74
76
  :ListParticipants,
75
77
  Proto::ListParticipantsRequest.new(room: room),
76
78
  headers:auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room)),
@@ -78,7 +80,7 @@ module LiveKit
78
80
  end
79
81
 
80
82
  def get_participant(room:, identity:)
81
- self.rpc(
83
+ rpc!(
82
84
  :GetParticipant,
83
85
  Proto::RoomParticipantIdentity.new(room: room, identity: identity),
84
86
  headers:auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room)),
@@ -86,15 +88,31 @@ module LiveKit
86
88
  end
87
89
 
88
90
  def remove_participant(room:, identity:)
89
- self.rpc(
91
+ rpc!(
90
92
  :RemoveParticipant,
91
93
  Proto::RoomParticipantIdentity.new(room: room, identity: identity),
92
94
  headers:auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room)),
93
95
  )
94
96
  end
95
97
 
98
+ def forward_participant(room:, identity:, destination_room:)
99
+ rpc!(
100
+ :ForwardParticipant,
101
+ Proto::ForwardParticipantRequest.new(room: room, identity: identity, destination_room: destination_room),
102
+ headers:auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room, destinationRoom: destination_room)),
103
+ )
104
+ end
105
+
106
+ def move_participant(room:, identity:, destination_room:)
107
+ rpc!(
108
+ :MoveParticipant,
109
+ Proto::MoveParticipantRequest.new(room: room, identity: identity, destination_room: destination_room),
110
+ headers:auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room, destinationRoom: destination_room)),
111
+ )
112
+ end
113
+
96
114
  def mute_published_track(room:, identity:, track_sid:, muted:)
97
- self.rpc(
115
+ rpc!(
98
116
  :MutePublishedTrack,
99
117
  Proto::MuteRoomTrackRequest.new(
100
118
  room: room,
@@ -131,7 +149,7 @@ module LiveKit
131
149
  end
132
150
  req.attributes = attr_map
133
151
  end
134
- self.rpc(
152
+ rpc!(
135
153
  :UpdateParticipant,
136
154
  req,
137
155
  headers:auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room)),
@@ -139,7 +157,7 @@ module LiveKit
139
157
  end
140
158
 
141
159
  def update_subscriptions(room:, identity:, track_sids:, subscribe:)
142
- self.rpc(
160
+ rpc!(
143
161
  :UpdateSubscriptions,
144
162
  Proto::UpdateSubscriptionsRequest.new(
145
163
  room: room,
@@ -155,7 +173,7 @@ module LiveKit
155
173
  destination_sids: [],
156
174
  destination_identities: []
157
175
  )
158
- self.rpc(
176
+ rpc!(
159
177
  :SendData,
160
178
  Proto::SendDataRequest.new(
161
179
  room: room,
@@ -1,6 +1,8 @@
1
1
  require "livekit/proto/livekit_sip_twirp"
2
2
  require "livekit/auth_mixin"
3
3
  require 'livekit/utils'
4
+ require 'livekit/failover'
5
+ require 'livekit/dial_timeout'
4
6
 
5
7
  module LiveKit
6
8
  class SIPServiceClient < Twirp::Client
@@ -8,10 +10,11 @@ module LiveKit
8
10
  include AuthMixin
9
11
  attr_accessor :api_key, :api_secret
10
12
 
11
- def initialize(base_url, api_key: nil, api_secret: nil)
12
- super(File.join(Utils.to_http_url(base_url), "/twirp"))
13
+ def initialize(base_url, api_key: nil, api_secret: nil, token: nil, failover: true, connection: nil)
14
+ super(connection || LiveKit::Failover.connection(base_url, failover))
13
15
  @api_key = api_key
14
16
  @api_secret = api_secret
17
+ @token = token
15
18
  end
16
19
 
17
20
  def create_sip_inbound_trunk(
@@ -52,7 +55,7 @@ module LiveKit
52
55
  krisp_enabled: krisp_enabled
53
56
  )
54
57
  )
55
- self.rpc(
58
+ rpc!(
56
59
  :CreateSIPInboundTrunk,
57
60
  request,
58
61
  headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
@@ -91,7 +94,7 @@ module LiveKit
91
94
  headers_to_attributes: headers_to_attributes
92
95
  )
93
96
  )
94
- self.rpc(
97
+ rpc!(
95
98
  :CreateSIPOutboundTrunk,
96
99
  request,
97
100
  headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
@@ -100,7 +103,7 @@ module LiveKit
100
103
 
101
104
  def list_sip_inbound_trunk
102
105
  request = Proto::ListSIPInboundTrunkRequest.new
103
- self.rpc(
106
+ rpc!(
104
107
  :ListSIPInboundTrunk,
105
108
  request,
106
109
  headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
@@ -109,7 +112,7 @@ module LiveKit
109
112
 
110
113
  def list_sip_outbound_trunk
111
114
  request = Proto::ListSIPOutboundTrunkRequest.new
112
- self.rpc(
115
+ rpc!(
113
116
  :ListSIPOutboundTrunk,
114
117
  request,
115
118
  headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
@@ -120,7 +123,7 @@ module LiveKit
120
123
  request = Proto::DeleteSIPTrunkRequest.new(
121
124
  sip_trunk_id: sip_trunk_id,
122
125
  )
123
- self.rpc(
126
+ rpc!(
124
127
  :DeleteSIPTrunk,
125
128
  request,
126
129
  headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
@@ -147,7 +150,7 @@ module LiveKit
147
150
  attributes: attributes,
148
151
  room_config: room_config,
149
152
  )
150
- self.rpc(
153
+ rpc!(
151
154
  :CreateSIPDispatchRule,
152
155
  request,
153
156
  headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
@@ -156,7 +159,7 @@ module LiveKit
156
159
 
157
160
  def list_sip_dispatch_rule
158
161
  request = Proto::ListSIPDispatchRuleRequest.new
159
- self.rpc(
162
+ rpc!(
160
163
  :ListSIPDispatchRule,
161
164
  request,
162
165
  headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
@@ -167,7 +170,7 @@ module LiveKit
167
170
  request = Proto::DeleteSIPDispatchRuleRequest.new(
168
171
  sip_dispatch_rule_id: sip_dispatch_rule_id,
169
172
  )
170
- self.rpc(
173
+ rpc!(
171
174
  :DeleteSIPDispatchRule,
172
175
  request,
173
176
  headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
@@ -178,8 +181,13 @@ module LiveKit
178
181
  sip_trunk_id,
179
182
  sip_call_to,
180
183
  room_name,
184
+ # Optional inline outbound trunk configuration (SIPOutboundConfig). Use
185
+ # instead of a stored sip_trunk_id to configure the trunk per call.
186
+ trunk: nil,
181
187
  # Optional SIP From number to use. If empty, trunk number is used.
182
188
  from_number: nil,
189
+ # Optional custom caller ID shown to the callee. Requires provider support.
190
+ display_name: nil,
183
191
  # Optional identity of the participant in LiveKit room
184
192
  participant_identity: nil,
185
193
  # Optional name of the participant in LiveKit room
@@ -198,12 +206,22 @@ module LiveKit
198
206
  # Optional, max call duration in seconds
199
207
  max_call_duration: nil,
200
208
  # Optional, enable Krisp for this call
201
- krisp_enabled: false
209
+ krisp_enabled: false,
210
+ # Optional, wait for the call to be answered before returning
211
+ wait_until_answered: false,
212
+ # Optional, request timeout in seconds. Defaults to a longer value when
213
+ # wait_until_answered is set (dialing takes time).
214
+ timeout: nil
202
215
  )
216
+ # When waiting for an answer, pin the ring window explicitly so our request
217
+ # timeout doesn't depend on the server's default (which could change).
218
+ ringing_timeout = DialTimeout::DEFAULT_RINGING_TIMEOUT if wait_until_answered && ringing_timeout.nil?
203
219
  request = Proto::CreateSIPParticipantRequest.new(
204
220
  sip_trunk_id: sip_trunk_id,
221
+ trunk: trunk,
205
222
  sip_call_to: sip_call_to,
206
223
  sip_number: from_number,
224
+ display_name: display_name,
207
225
  room_name: room_name,
208
226
  participant_identity: participant_identity,
209
227
  participant_name: participant_name,
@@ -213,32 +231,140 @@ module LiveKit
213
231
  hide_phone_number: hide_phone_number,
214
232
  ringing_timeout: ringing_timeout,
215
233
  max_call_duration: max_call_duration,
216
- krisp_enabled: krisp_enabled
217
- )
218
- self.rpc(
219
- :CreateSIPParticipant,
220
- request,
221
- headers: auth_header(sip_grant: SIPGrant.new(call: true)),
234
+ krisp_enabled: krisp_enabled,
235
+ wait_until_answered: wait_until_answered
222
236
  )
237
+ headers = auth_header(sip_grant: SIPGrant.new(call: true))
238
+ # When waiting for an answer, dialing takes longer than a normal request
239
+ # and the request must outlast ringing; otherwise honor any user timeout.
240
+ effective_timeout = wait_until_answered ? DialTimeout.resolve(timeout, ringing_timeout) : timeout
241
+ headers[Failover::TIMEOUT_HEADER] = effective_timeout.to_s if effective_timeout
242
+ rpc!(:CreateSIPParticipant, request, headers: headers)
223
243
  end
224
244
 
225
245
  def transfer_sip_participant(
226
246
  room_name,
227
247
  participant_identity,
228
248
  transfer_to,
229
- play_dialtone: nil
249
+ play_dialtone: nil,
250
+ # Optional, max time for the transfer destination to answer, in seconds.
251
+ ringing_timeout: nil,
252
+ # Optional, request timeout in seconds. Defaults to a longer value since
253
+ # transferring dials a phone.
254
+ timeout: nil
230
255
  )
231
256
 
257
+ # Transferring a call dials a phone and must outlast ringing. Pin the ring
258
+ # window explicitly so our request timeout doesn't depend on the server default.
259
+ ringing_timeout ||= DialTimeout::DEFAULT_RINGING_TIMEOUT
232
260
  request = Proto::TransferSIPParticipantRequest.new(
233
261
  room_name: room_name,
234
262
  participant_identity: participant_identity,
235
263
  transfer_to: transfer_to,
236
264
  play_dialtone: play_dialtone,
265
+ ringing_timeout: ringing_timeout,
266
+ )
267
+ headers = auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room_name), sip_grant: SIPGrant.new(call: true))
268
+ headers[Failover::TIMEOUT_HEADER] = DialTimeout.resolve(timeout, ringing_timeout).to_s
269
+ rpc!(:TransferSIPParticipant, request, headers: headers)
270
+ end
271
+
272
+ # Updates an existing SIP inbound trunk, replacing it entirely.
273
+ #
274
+ # @param sip_trunk_id [String] ID of the SIP inbound trunk to update
275
+ # @param trunk [Proto::SIPInboundTrunkInfo] the full trunk definition to replace it with
276
+ def update_sip_inbound_trunk(sip_trunk_id, trunk)
277
+ request = Proto::UpdateSIPInboundTrunkRequest.new(
278
+ sip_trunk_id: sip_trunk_id,
279
+ replace: trunk,
280
+ )
281
+ rpc!(
282
+ :UpdateSIPInboundTrunk,
283
+ request,
284
+ headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
285
+ )
286
+ end
287
+
288
+ # Updates specific fields of an existing SIP inbound trunk. Only the fields
289
+ # set in +update+ are changed.
290
+ #
291
+ # @param sip_trunk_id [String] ID of the SIP inbound trunk to update
292
+ # @param update [Proto::SIPInboundTrunkUpdate] the fields to update
293
+ def update_sip_inbound_trunk_fields(sip_trunk_id, update)
294
+ request = Proto::UpdateSIPInboundTrunkRequest.new(
295
+ sip_trunk_id: sip_trunk_id,
296
+ update: update,
297
+ )
298
+ rpc!(
299
+ :UpdateSIPInboundTrunk,
300
+ request,
301
+ headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
302
+ )
303
+ end
304
+
305
+ # Updates an existing SIP outbound trunk, replacing it entirely.
306
+ #
307
+ # @param sip_trunk_id [String] ID of the SIP outbound trunk to update
308
+ # @param trunk [Proto::SIPOutboundTrunkInfo] the full trunk definition to replace it with
309
+ def update_sip_outbound_trunk(sip_trunk_id, trunk)
310
+ request = Proto::UpdateSIPOutboundTrunkRequest.new(
311
+ sip_trunk_id: sip_trunk_id,
312
+ replace: trunk,
237
313
  )
238
- self.rpc(
239
- :TransferSIPParticipant,
314
+ rpc!(
315
+ :UpdateSIPOutboundTrunk,
240
316
  request,
241
- headers: auth_header(video_grant: VideoGrant.new(roomAdmin: true, room: room_name), sip_grant: SIPGrant.new(call: true)),
317
+ headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
318
+ )
319
+ end
320
+
321
+ # Updates specific fields of an existing SIP outbound trunk. Only the fields
322
+ # set in +update+ are changed.
323
+ #
324
+ # @param sip_trunk_id [String] ID of the SIP outbound trunk to update
325
+ # @param update [Proto::SIPOutboundTrunkUpdate] the fields to update
326
+ def update_sip_outbound_trunk_fields(sip_trunk_id, update)
327
+ request = Proto::UpdateSIPOutboundTrunkRequest.new(
328
+ sip_trunk_id: sip_trunk_id,
329
+ update: update,
330
+ )
331
+ rpc!(
332
+ :UpdateSIPOutboundTrunk,
333
+ request,
334
+ headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
335
+ )
336
+ end
337
+
338
+ # Updates an existing SIP dispatch rule, replacing it entirely.
339
+ #
340
+ # @param sip_dispatch_rule_id [String] ID of the SIP dispatch rule to update
341
+ # @param rule [Proto::SIPDispatchRuleInfo] the full dispatch rule definition to replace it with
342
+ def update_sip_dispatch_rule(sip_dispatch_rule_id, rule)
343
+ request = Proto::UpdateSIPDispatchRuleRequest.new(
344
+ sip_dispatch_rule_id: sip_dispatch_rule_id,
345
+ replace: rule,
346
+ )
347
+ rpc!(
348
+ :UpdateSIPDispatchRule,
349
+ request,
350
+ headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
351
+ )
352
+ end
353
+
354
+ # Updates specific fields of an existing SIP dispatch rule. Only the fields
355
+ # set in +update+ are changed.
356
+ #
357
+ # @param sip_dispatch_rule_id [String] ID of the SIP dispatch rule to update
358
+ # @param update [Proto::SIPDispatchRuleUpdate] the fields to update
359
+ def update_sip_dispatch_rule_fields(sip_dispatch_rule_id, update)
360
+ request = Proto::UpdateSIPDispatchRuleRequest.new(
361
+ sip_dispatch_rule_id: sip_dispatch_rule_id,
362
+ update: update,
363
+ )
364
+ rpc!(
365
+ :UpdateSIPDispatchRule,
366
+ request,
367
+ headers: auth_header(sip_grant: SIPGrant.new(admin: true)),
242
368
  )
243
369
  end
244
370
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LiveKit
4
- VERSION = "0.8.3"
4
+ VERSION = "1.0.0"
5
5
  end
data/lib/livekit.rb CHANGED
@@ -3,6 +3,7 @@
3
3
  require "livekit/access_token"
4
4
  require "livekit/utils"
5
5
  require "livekit/grants"
6
+ require "livekit/errors"
6
7
  require "livekit/token_verifier"
7
8
  require "livekit/version"
8
9
 
@@ -13,3 +14,5 @@ require "livekit/egress_service_client"
13
14
  require "livekit/ingress_service_client"
14
15
  require "livekit/sip_service_client"
15
16
  require "livekit/agent_dispatch_service_client"
17
+ require "livekit/connector_service_client"
18
+ require "livekit/livekit_api"
@@ -11,11 +11,12 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = "LiveKit Server SDK for Ruby"
12
12
  spec.homepage = "https://livekit.io"
13
13
  spec.license = "Apache-2.0"
14
- spec.required_ruby_version = ">= 2.6.0"
14
+ # google-protobuf 4.x requires Ruby >= 3.1; Ruby 3.0 is EOL.
15
+ spec.required_ruby_version = ">= 3.1.0"
15
16
 
16
- # spec.metadata["homepage_uri"] = spec.homepage
17
- # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
18
- # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/livekit/server-sdk-ruby"
19
+ spec.metadata["changelog_uri"] = "https://github.com/livekit/server-sdk-ruby/blob/main/CHANGELOG.md"
19
20
 
20
21
  # Specify which files should be added to the gem when it is released.
21
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -26,11 +27,10 @@ Gem::Specification.new do |spec|
26
27
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
28
  spec.require_paths = ["lib"]
28
29
 
29
- spec.add_dependency "google-protobuf", ">= 3.21.0", "< 4.0"
30
+ spec.add_dependency "faraday", ">= 2.0", "< 3.0"
31
+ spec.add_dependency "google-protobuf", "~> 4.30", ">= 4.30.2"
30
32
  spec.add_dependency "jwt", ">= 2.2.3", "< 3.0"
31
- # workaround for twirp 1.10.0 missing it
32
- spec.add_dependency 'rack', '>= 2.2.3'
33
- spec.add_dependency "twirp", ">= 1.10.0", "< 2.0"
33
+ spec.add_dependency "twirp", "~> 1.13", ">= 1.13.1"
34
34
 
35
35
  # For more information and examples about making a new gem, checkout our
36
36
  # guide at: https://bundler.io/guides/creating_gem.html