Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SIP API support #63

Merged
merged 9 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ task :proto do
"./protocol/protobufs/livekit_egress.proto",
"./protocol/protobufs/livekit_ingress.proto",
"./protocol/protobufs/livekit_sip.proto",
"./protocol/protobufs/livekit_metrics.proto",
"./protocol/protobufs/livekit_models.proto",
"./protocol/protobufs/livekit_room.proto",
"./protocol/protobufs/livekit_webhook.proto")
Expand Down
1 change: 1 addition & 0 deletions lib/livekit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
require "livekit/room_service_client"
require "livekit/egress_service_client"
require "livekit/ingress_service_client"
require "livekit/sip_service_client"
8 changes: 7 additions & 1 deletion lib/livekit/auth_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
module LiveKit
# Create authenticated headers when keys are provided
module AuthMixin
def auth_header(video_grant)
def auth_header(
video_grant,
sip_grant: nil
)
headers = {}
t = ::LiveKit::AccessToken.new(api_key: @api_key, api_secret: @api_secret)
t.add_grant(video_grant)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we handle passing in a nil video grant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does work right now by constructing a default video grant but I can handle the case explicitly, yes

if sip_grant != nil
t.add_sip_grant(sip_grant)
end
headers["Authorization"] = "Bearer #{t.to_jwt}"
headers["User-Agent"] = "LiveKit Ruby SDK"
headers
Expand Down
4 changes: 2 additions & 2 deletions lib/livekit/proto/livekit_agent_dispatch_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/livekit/proto/livekit_agent_dispatch_twirp.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Code generated by protoc-gen-twirp_ruby 1.10.0, DO NOT EDIT.
# Code generated by protoc-gen-twirp_ruby 1.11.0, DO NOT EDIT.
require 'twirp'
require_relative 'livekit_agent_dispatch_pb.rb'

Expand All @@ -9,7 +9,7 @@ class AgentDispatchServiceService < ::Twirp::Service
service 'AgentDispatchService'
rpc :CreateDispatch, CreateAgentDispatchRequest, AgentDispatch, :ruby_method => :create_dispatch
rpc :DeleteDispatch, DeleteAgentDispatchRequest, AgentDispatch, :ruby_method => :delete_dispatch
rpc :ListDispatch, ListAgentDispatchRequesst, ListAgentDispatchResponse, :ruby_method => :list_dispatch
rpc :ListDispatch, ListAgentDispatchRequest, ListAgentDispatchResponse, :ruby_method => :list_dispatch
end

class AgentDispatchServiceClient < ::Twirp::Client
Expand Down
2 changes: 1 addition & 1 deletion lib/livekit/proto/livekit_agent_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/livekit/proto/livekit_agent_twirp.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Code generated by protoc-gen-twirp_ruby 1.10.0, DO NOT EDIT.
# Code generated by protoc-gen-twirp_ruby 1.11.0, DO NOT EDIT.
require 'twirp'
require_relative 'livekit_agent_pb.rb'

Expand Down
2 changes: 1 addition & 1 deletion lib/livekit/proto/livekit_egress_twirp.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Code generated by protoc-gen-twirp_ruby 1.10.0, DO NOT EDIT.
# Code generated by protoc-gen-twirp_ruby 1.11.0, DO NOT EDIT.
require 'twirp'
require_relative 'livekit_egress_pb.rb'

Expand Down
2 changes: 1 addition & 1 deletion lib/livekit/proto/livekit_ingress_twirp.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Code generated by protoc-gen-twirp_ruby 1.10.0, DO NOT EDIT.
# Code generated by protoc-gen-twirp_ruby 1.11.0, DO NOT EDIT.
require 'twirp'
require_relative 'livekit_ingress_pb.rb'

Expand Down
23 changes: 23 additions & 0 deletions lib/livekit/proto/livekit_metrics_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions lib/livekit/proto/livekit_metrics_twirp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Code generated by protoc-gen-twirp_ruby 1.11.0, DO NOT EDIT.
require 'twirp'
require_relative 'livekit_metrics_pb.rb'

module LiveKit
module Proto
end
end
Loading
Loading