cuddly-cartoon-47334
03/27/2025, 7:02 AMtall-airline-16756
03/27/2025, 7:02 AMtall-airline-16756
03/27/2025, 7:02 AMCreateSIPParticipant
request, LiveKit SIP sends an INVITE request to your SIP provider.
• The provider checks authentication credentials and returns a response to LiveKit.
• If the call is accepted, LiveKit dials the user and creates a SIP participant in the LiveKit room.
• If the call is not accepted by the SIP trunk provider, the CreateSIPParticipant
request fails. Sources: Making outbound calls | LiveKit Docs | Accepting inbound calls | LiveKit Docscuddly-cartoon-47334
03/27/2025, 7:03 AMtall-airline-16756
03/27/2025, 7:03 AMJobContext
within a Python server. This might require a deeper look into your server's implementation or the LiveKit SDK documentation.
If you need further assistance, I recommend consulting the LiveKit SDK documentation or reaching out to a developer familiar with your server setup.cuddly-cartoon-47334
03/27/2025, 7:04 AMtall-airline-16756
03/27/2025, 7:04 AMJobContext
in LiveKit. This might require reviewing the LiveKit SDK documentation or your server's implementation details.
If you need further assistance, I recommend consulting the LiveKit SDK documentation or reaching out to a developer familiar with your setup.cuddly-cartoon-47334
03/27/2025, 7:04 AMtall-airline-16756
03/27/2025, 7:04 AM{
"metadata": "{\"is_internal\": true}",
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-"
}
}
}
• Explicitly dispatch agents: For inbound SIP calls, you can define agents using the room_config.agents
field in SIP dispatch rules. This allows you to manage multiple agents within a single project.
• Configure additional properties: You can set participant metadata, attributes, and session properties for all incoming calls that match the trunk. Refer to the CreateSIPInboundTrunk documentation for a full list of available parameters.
These options provide flexibility in managing metadata and agent configurations for inbound SIP calls.
Sources: SIP dispatch rule | LiveKit Docs | Dispatching agents | LiveKit Docs | SIP inbound trunk | LiveKit Docscuddly-cartoon-47334
03/27/2025, 7:05 AMtall-airline-16756
03/27/2025, 7:05 AMcuddly-cartoon-47334
03/27/2025, 7:07 AMtall-airline-16756
03/27/2025, 7:07 AMcuddly-cartoon-47334
03/27/2025, 7:08 AMtall-airline-16756
03/27/2025, 7:08 AM{
"metadata": "{\"is_internal\": true}",
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-"
}
}
}
• Using the CreateSIPInboundTrunk API: When creating an inbound trunk, you can use the metadata
parameter to assign initial metadata to the trunk. This metadata will be added to every SIP participant that uses the trunk. For example: Parameter: metadata
Type: string
Required: no
Description: Initial metadata to assign to the trunk. This metadata is added to every SIP participant that uses the trunk.
However, if you need to dynamically set unique metadata for each call, you may need to implement custom server-side logic to handle the SIP requests and dynamically assign metadata based on the incoming call details.
Sources: SIP dispatch rule | LiveKit Docs | SIP APIs | LiveKit Docscuddly-cartoon-47334
03/27/2025, 7:09 AMsip:[SOME_ID]@[SIP_ID]sip.livekit.cloud
,
so SIP_ID is given by livekit i just redacted it here. what is SOME_ID here? I want to pass some unique id there and somehow get it in JobContext. is this possible?tall-airline-16756
03/27/2025, 7:09 AMSOME_ID
part of the SIP URL and access it in JobContext
in LiveKit. However, this might be achievable by using custom SIP headers or metadata to pass and retrieve such information dynamically.
If this is a critical requirement, I recommend consulting the LiveKit SDK documentation or working with a developer to explore potential solutions for dynamically passing and accessing unique identifiers in your setup.cuddly-cartoon-47334
03/27/2025, 7:10 AMtall-airline-16756
03/27/2025, 7:10 AMX-*
SIP headers to participant attributes. This enables you to route calls or configure workflows based on these headers.
• Setting Headers in INVITE Requests: Use the headers
parameter to include custom X-*
headers in SIP INVITE requests. These headers are sent as-is and can help identify or manage calls.
• Mapping Headers to Attributes: You can map SIP X-*
header names to participant attribute names using headers_to_attributes
. Similarly, you can map SIP headers from INVITE requests to sip.h.*
participant attributes using attributes_to_headers
.
• Documentation: For more details on custom attributes and headers, you can refer to the LiveKit documentation at this link.
Using custom SIP headers, you can pass dynamic information like unique IDs and retrieve them for processing in your application.
Sources: SIP APIs | LiveKit Docs | SIP overview | LiveKit Docscuddly-cartoon-47334
03/27/2025, 7:11 AMtall-airline-16756
03/27/2025, 7:11 AMheaders_to_attributes
configuration to map SIP X-*
headers from INVITE requests to participant attribute names. This allows you to access the header values as participant attributes.
• *Map Headers to sip.h.*
Attributes:* Use the attributes_to_headers
configuration to map SIP headers from INVITE requests to sip.h.*
participant attributes. This provides a structured way to access header data.
• Include Specific Headers: Use the include_headers
option with the SIPHeaderOptions type to specify how SIP headers should be mapped to attributes.
These configurations can be applied when creating a SIP trunk, such as through the CreateSIPInboundTrunk API. This setup allows you to dynamically parse and utilize SIP headers in your backend logic.
Sources: SIP APIs | LiveKit Docs | SIP inbound trunk | LiveKit Docscuddly-cartoon-47334
03/27/2025, 7:11 AMtall-airline-16756
03/27/2025, 7:11 AMSIPHeaderOptions
in LiveKit. However, the SIPHeaderOptions
enum allows you to control which SIP headers are included or mapped. The available options typically include:
• `SIP_NO_HEADERS`: No headers are included.
• `SIP_X_HEADERS`: Only custom X-*
headers are included.
• `SIP_ALL_HEADERS`: All headers are included.
To implement this, you would configure the include_headers
parameter when setting up your SIP trunk or handling SIP requests. For detailed implementation, you may need to refer to the LiveKit SDK documentation or consult with a developer familiar with your setup.cuddly-cartoon-47334
03/28/2025, 1:55 AMtall-airline-16756
03/28/2025, 1:55 AMcuddly-cartoon-47334
03/28/2025, 1:56 AMtall-airline-16756
03/28/2025, 1:56 AMcuddly-cartoon-47334
03/28/2025, 1:56 AMtall-airline-16756
03/28/2025, 1:57 AMcuddly-cartoon-47334
03/28/2025, 1:58 AMtall-airline-16756
03/28/2025, 1:59 AMpublish
parameter to false
when joining the room to ensure you don't publish any tracks.
• Listen for events when participants publish audio tracks.
• Subscribe to the audio tracks and play them using the appropriate audio APIs.
For detailed implementation, I recommend referring to the LiveKit Swift SDK documentation or consulting with a developer familiar with LiveKit. If you have specific questions or need further assistance, feel free to ask!cuddly-cartoon-47334
03/28/2025, 1:59 AMtall-airline-16756
03/28/2025, 1:59 AMcuddly-cartoon-47334
03/28/2025, 2:05 AMtall-airline-16756
03/28/2025, 2:05 AMlk token create \
--api-key <project_key> --api-secret <project_secret> \
--join --room test_room --identity test_user \
--valid-for 24h
2. Using Node.js Server SDK:
import { AccessToken } from 'livekit-server-sdk';
const roomName = 'name-of-room';
const participantName = 'user-name';
const at = new AccessToken('api-key', 'secret-key', {
identity: participantName,
});
at.addGrant({ roomJoin: true, room: roomName });
3. From the LiveKit Dashboard:
You can generate tokens directly from your project's dashboard at LiveKit Dashboard.
Choose the method that best fits your setup. If you need further assistance, feel free to ask!
Sources: CLI Setup | LiveKit Docs | LiveKit JS Server SDK - v2.9.7 | Analytics API | LiveKit Docscuddly-cartoon-47334
03/29/2025, 2:19 AMtall-airline-16756
03/29/2025, 2:19 AMcuddly-cartoon-47334
03/29/2025, 2:20 AMlet room = LiveKit.connect(options: ConnectOptions(url: url, token: token), delegate: self)
...
func room(_ room: Room,
participant: RemoteParticipant,
didSubscribe publication: RemoteTrackPublication,
track: Track) {
/* Do things with track, publication or participant */
}
this is what the docs saytall-airline-16756
03/29/2025, 2:20 AMlk token create \
--api-key <project_key> --api-secret <project_secret> \
--join --room <room_name> --identity <user_identity> \
--valid-for 24h
2. Using Node.js Server SDK:
import { AccessToken } from 'livekit-server-sdk';
const roomName = 'room-name';
const participantName = 'user-identity';
const at = new AccessToken('api-key', 'secret-key', {
identity: participantName,
});
at.addGrant({ roomJoin: true, room: roomName });
const token = at.toJwt();
Once you have the token, you can use it in your Swift code to connect to the room and subscribe to audio tracks:
let room = LiveKit.connect(options: ConnectOptions(url: url, token: token), delegate: self)
If you need further assistance with token generation or Swift implementation, feel free to ask!cuddly-cartoon-47334
03/29/2025, 2:20 AMtall-airline-16756
03/29/2025, 2:21 AM--valid-for
option in the CLI or by setting an expiration time programmatically in the SDK. For example:
Using LiveKit CLI:
lk token create \
--api-key <project_key> --api-secret <project_secret> \
--join --room <room_name> --identity <user_identity> \
--valid-for 24h
Using Node.js Server SDK:
const at = new AccessToken('api-key', 'secret-key', {
identity: participantName,
ttl: 3600 // Token valid for 1 hour (in seconds)
});
After the token expires, the user will no longer be able to connect to the room using that token. You will need to generate a new token for continued access.cuddly-cartoon-47334
03/29/2025, 2:21 AMtall-airline-16756
03/29/2025, 2:22 AMlet room = LiveKit.connect(options: ConnectOptions(url: url, token: token), delegate: self)
func room(_ room: Room,
participant: RemoteParticipant,
didSubscribe publication: RemoteTrackPublication,
track: Track) {
if let audioTrack = track as? RemoteAudioTrack {
// Handle the subscribed audio track
print("Subscribed to audio track: \(audioTrack.trackId)")
}
}
2. Creating a Token for the Entire Session Duration:
To create a token that lasts for the entire session, you can set a sufficiently long expiration time when generating the token. For example:
Using LiveKit CLI:
lk token create \
--api-key <project_key> --api-secret <project_secret> \
--join --room <room_name> --identity <user_identity> \
--valid-for 8h
Using Node.js Server SDK:
const at = new AccessToken('api-key', 'secret-key', {
identity: participantName,
ttl: 28800 // Token valid for 8 hours (in seconds)
});
Ensure the token's validity period is long enough to cover the expected session duration. If you need further assistance, feel free to ask!cuddly-cartoon-47334
03/29/2025, 2:22 AMtall-airline-16756
03/29/2025, 2:23 AMfrom livekit_server_sdk import AccessToken
# Replace with your API key and secret
api_key = "your_api_key"
api_secret = "your_api_secret"
# Replace with the room name and participant identity
room_name = "your_room_name"
participant_identity = "your_participant_identity"
# Create the access token
token = AccessToken(api_key, api_secret, identity=participant_identity)
# Add permissions to join the room
token.add_grant({"roomJoin": True, "room": room_name})
# Generate the token string
token_string = token.to_jwt()
print("Generated Token:", token_string)
Use the generated token in your ctx.connect
call to authenticate and connect to the room. If you need further assistance, feel free to ask!cuddly-cartoon-47334
03/29/2025, 2:23 AMtall-airline-16756
03/29/2025, 2:23 AMRemoteAudioTrack
in Swift LiveKit, you need to use an AudioRenderer
. Here’s how you can do it:
func room(_ room: Room,
participant: RemoteParticipant,
didSubscribe publication: RemoteTrackPublication,
track: Track) {
if let audioTrack = track as? RemoteAudioTrack {
// Add an AudioRenderer to play the audio
let audioRenderer = MyAudioRenderer() // Replace with your AudioRenderer implementation
audioTrack.add(audioRenderer: audioRenderer)
print("Subscribed to audio track: \(audioTrack.trackId)")
}
}
Notes:
• The AudioRenderer
must implement the render(sampleBuffer:)
method to process and play the incoming audio samples.
• You can control the volume of the RemoteAudioTrack
using its volume
property (range: 0.0 to 1.0).
• To stop playing the audio, you can remove the renderer using audioTrack.remove(audioRenderer:)
.
If you need further assistance with implementing the AudioRenderer
, feel free to ask!
Sources: RemoteAudioTrack | Documentation | AudioRenderer Implementations | Documentationcuddly-cartoon-47334
03/29/2025, 2:24 AMtall-airline-16756
03/29/2025, 2:25 AMfunc room(_:participant:didSubscribe:track:)
method is a delegate callback that gets triggered when a participant publishes a track and you successfully subscribe to it. This means you need to be connected to the room to receive this callback and listen to the audio tracks.
If you want to listen to audio without actively joining the room as a participant, you can connect to the room in a "listen-only" mode. This can be achieved by:
• Generating a token with only the roomJoin
permission and no publishing permissions.
• Not publishing any local tracks (audio or video) when connecting to the room.
Here’s an example of connecting in listen-only mode:
let room = LiveKit.connect(options: ConnectOptions(url: url, token: token), delegate: self)
Once connected, you will receive the didSubscribe
callback whenever a remote participant publishes an audio track, and you can handle the audio playback as described earlier.
If you need further clarification or assistance, feel free to ask!cuddly-cartoon-47334
03/29/2025, 2:25 AMroomJoin
permission and no publishing permissions.
• Not publishing any local tracks (audio or video) when connecting to the room.
Here’s an example of connecting in listen-only mode:
tell me how to do this.
in my python codetall-airline-16756
03/29/2025, 2:25 AMroomJoin
permission and no publishing permissions. Here’s how you can do it:
from livekit_server_sdk import AccessToken
# Replace with your API key and secret
api_key = "your_api_key"
api_secret = "your_api_secret"
# Replace with the room name and participant identity
room_name = "your_room_name"
participant_identity = "your_participant_identity"
# Create the access token
token = AccessToken(api_key, api_secret, identity=participant_identity)
# Add permissions to join the room without publishing
token.add_grant({"roomJoin": True, "canPublish": False, "room": room_name})
# Generate the token string
token_string = token.to_jwt()
print("Generated Token:", token_string)
Use this token in your Python code to connect to the room in listen-only mode. Ensure that you do not publish any local tracks when connecting.
If you need further assistance, feel free to ask!cuddly-cartoon-47334
03/29/2025, 4:13 AMtall-airline-16756
03/29/2025, 4:14 AMimport LiveKit
class YourClass: ParticipantDelegate {
// This delegate method will be called when a track is subscribed
func participant(_ participant: RemoteParticipant, didSubscribeTrack publication: RemoteTrackPublication) {
// Handle the subscribed track here
if let audioTrack = publication.track as? RemoteAudioTrack {
print("Subscribed to audio track: \(audioTrack.trackId)")
// You can now use the audio track
}
}
}
// Example of connecting to a room
let room = LiveKit.connect(options: ConnectOptions(url: "your_url", token: "your_token"), delegate: YourClass())
Notes:
• Ensure you import the LiveKit
framework at the top of your file.
• Implement the ParticipantDelegate
protocol to handle track subscription events.
• Use the didSubscribeTrack
method to process the subscribed track.
If you need further assistance, feel free to ask!
Sources: participant(_:didSubscribeTrack:) | Documentation | Subscribing to tracks | LiveKit Docscuddly-cartoon-47334
03/29/2025, 4:16 AMtall-airline-16756
03/29/2025, 4:16 AMconnect
method is not a static method of the LiveKit
module. Instead, it is an instance method of the Room
class. Here’s how you can properly connect to a room:
import LiveKit
let room = Room()
room.connect(url: "your_url", token: "your_token") { result in
switch result {
case .success:
print("Connected to the room successfully!")
case .failure(let error):
print("Failed to connect to the room: \(error)")
}
}
Notes:
• Ensure you import the LiveKit
framework at the top of your file.
• Use the Room
class to create an instance and call the connect
method.
• Provide the correct URL and token for your LiveKit server.
If you need further assistance, feel free to ask!
Sources: Documentation | LiveKitClient class - livekit_client library - Dart APIcuddly-cartoon-47334
03/29/2025, 4:18 AMtall-airline-16756
03/29/2025, 4:18 AMdisconnect()
method of the Room
class. Here’s an example:
room.disconnect()
Notes:
• Calling disconnect()
ensures that you leave the room properly and notify other participants.
• If the application terminates unexpectedly, your participant will automatically disappear from the room after 15 seconds.
• It’s good practice to call disconnect()
when a user intentionally leaves the room while the app continues running.
If you need further assistance, feel free to ask!
Sources: Connecting to LiveKit | LiveKit Docs | disconnect() | Documentationcuddly-cartoon-47334
03/29/2025, 4:21 AMtall-airline-16756
03/29/2025, 4:21 AMLiveKit.connect
method does not exist in the LiveKit Swift SDK, which is why it doesn't work. Instead, you should use the connect
method of the Room
class. Here’s how you can properly connect to a room:
import LiveKit
let room = Room()
room.connect(url: "your_url", token: "your_token") { result in
switch result {
case .success:
print("Connected to the room successfully!")
case .failure(let error):
print("Failed to connect to the room: \(error)")
}
}
Notes:
• Ensure you import the LiveKit
framework at the top of your file.
• The connect
method is an instance method of the Room
class, not a static method of the LiveKit
module.
• Provide the correct URL and token for your LiveKit server.
If you need further clarification or assistance, feel free to ask!cuddly-cartoon-47334
03/29/2025, 7:26 AMtall-airline-16756
03/29/2025, 7:27 AMcuddly-cartoon-47334
03/29/2025, 7:27 AMtall-airline-16756
03/29/2025, 7:27 AMcuddly-cartoon-47334
03/29/2025, 7:27 AMtall-airline-16756
03/29/2025, 7:28 AMlk token create \
--api-key <project_key> --api-secret <project_secret> \
--join --room <room_name> --identity <user_identity> \
--valid-for 24h
Using SDKs (e.g., Node.js):
const at = new AccessToken('api-key', 'secret-key', {
identity: participantName,
ttl: 3600 // Token valid for 1 hour (in seconds)
});
Once the token expires, it can no longer be used to connect to a room. If you need further assistance, feel free to ask!cuddly-cartoon-47334
03/29/2025, 7:28 AMtall-airline-16756
03/29/2025, 7:28 AMttl
(time to live) parameter when generating the token. For example:
const at = new AccessToken('api-key', 'secret-key', {
identity: participantName,
ttl: 3600 // Token valid for 1 hour (in seconds)
});
If you need further assistance, feel free to ask!
Sources: LiveKit JS Server SDK - v2.9.7cuddly-cartoon-47334
03/30/2025, 8:33 AMtall-airline-16756
03/30/2025, 8:33 AMcuddly-cartoon-47334
03/30/2025, 8:33 AMtall-airline-16756
03/30/2025, 8:34 AMcanPublishData
is a Boolean property in LiveKit that indicates whether a participant has permission to publish data to a room. This permission is part of the participant's permissions configuration and can be set when generating an access token or configuring the room.
For example, in the Swift SDK, it is defined as:
let canPublishData: Bool
It is typically used alongside other permissions like canPublish
and canPublishSources
to control what a participant can do in a room.
If you need further clarification or examples, feel free to ask!
Sources: ParticipantPermissions | Documentation | canPublishData | Documentation | canPublishDatacuddly-cartoon-47334
03/30/2025, 8:34 AMtall-airline-16756
03/30/2025, 8:34 AMcanPublishData
property determines whether a participant is allowed to send data messages to other participants in the room. Data messages are typically used for sending non-media information, such as chat messages, control signals, or custom application data.
For example, if canPublishData
is set to true
, the participant can use LiveKit's data publishing features to send messages to other participants. If it is set to false
, the participant will not be able to send such messages.
If you have more questions or need further clarification, feel free to ask!cuddly-cartoon-47334
03/30/2025, 8:35 AMtall-airline-16756
03/30/2025, 8:35 AMroomJoin
when using roomService.updateParticipant
in LiveKit. The method typically requires the room name, participant identity, and the fields you want to update (such as metadata or permissions).
Here’s an example of the parameters you might pass:
await roomService.updateParticipant(
room_name,
participant_identity,
{
metadata: "new_metadata",
permission: {
canPublish: true,
canSubscribe: true
}
}
);
If you have specific fields to update, you only need to include those in the request. Let me know if you need further clarification!
Sources: RoomServiceClient | LiveKit JS Server SDK - v2.9.7cuddly-cartoon-47334
03/30/2025, 8:35 AMtall-airline-16756
03/30/2025, 8:36 AMupdateParticipant
in LiveKit, fields that are not passed in the update will retain their old values. The update will only modify the fields you explicitly include in the request.
For example, if you update only the metadata
field, other fields like permissions
will remain unchanged.
If you have further questions or need clarification, feel free to ask!
Sources: updateAttributescuddly-cartoon-47334
03/30/2025, 10:29 PMtall-airline-16756
03/30/2025, 10:29 PMcuddly-cartoon-47334
03/30/2025, 10:30 PMtall-airline-16756
03/30/2025, 10:30 PMcuddly-cartoon-47334
03/30/2025, 10:42 PMtall-airline-16756
03/30/2025, 10:42 PMcuddly-cartoon-47334
03/30/2025, 10:45 PMtall-airline-16756
03/30/2025, 10:45 PMAutoSubscribe.AUDIO_ONLY
and AutoSubscribe.SUBSCRIBE_ALL
in LiveKit is as follows:
• `AutoSubscribe.AUDIO_ONLY`: This option subscribes only to audio tracks published by participants in the room. Video tracks will not be subscribed to automatically.
• `AutoSubscribe.SUBSCRIBE_ALL`: This option subscribes to all tracks (both audio and video) published by participants in the room.
If you have further questions or need clarification, feel free to ask!
Sources: AutoSubscribe | LiveKit Agentscuddly-cartoon-47334
03/30/2025, 10:46 PMtall-airline-16756
03/30/2025, 10:46 PMuser_participant = await ctx.wait_for_participant()
indicates that the agent is waiting for the first participant to join and then likely processing only that participant's tracks. If you want the AI agent to respond to tracks from multiple participants, you may need to modify the logic to handle all participants in the room, not just the first one.
For example, you could iterate over all participants and subscribe to their tracks dynamically. If you need further assistance with implementation, feel free to ask!cuddly-cartoon-47334
03/30/2025, 10:53 PMtall-airline-16756
03/30/2025, 10:54 PMawait ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
# Process the first participant
user_participant = await ctx.wait_for_participant()
process_participant(user_participant)
# Listen for new participants joining the room
async for participant in ctx.on_participant_joined():
process_participant(participant)
def process_participant(participant):
# Add logic to handle the participant's audio tracks
print(f"Processing participant: {participant.identity}")
This way, you can handle the first participant and dynamically process any new participants who join the room. Let me know if you need further clarification or assistance!cuddly-cartoon-47334
03/30/2025, 10:56 PMtall-airline-16756
03/30/2025, 10:56 PMon_participant_joined
in LiveKit's Python SDK. However, in most event-driven systems, you would typically register a callback or listener for participant join events. Here’s a general example of how it might look:
async def on_participant_joined(participant):
print(f"Participant joined: {participant.identity}")
# Add logic to process the participant's tracks
ctx.on_participant_joined = on_participant_joined
This is a conceptual example, and the actual implementation may vary depending on the SDK. If you need further assistance, feel free to ask or consult the LiveKit Python SDK documentation for event handling.cuddly-cartoon-47334
03/30/2025, 11:26 PMtall-airline-16756
03/30/2025, 11:26 PMcuddly-cartoon-47334
03/31/2025, 8:56 AMtall-airline-16756
03/31/2025, 8:56 AMuser_speech_committed
event trigger earlier in LiveKit. This event's timing might depend on internal configurations or thresholds for detecting speech activity.
If you have access to any configuration settings related to speech detection or activity thresholds, you might be able to adjust them to make the event trigger sooner. Alternatively, you could implement a custom solution to detect speech activity earlier by processing audio tracks directly.
If you need further assistance or have more details about your setup, feel free to share them, and I'll do my best to help!cuddly-cartoon-47334
04/02/2025, 12:53 AMtall-airline-16756
04/02/2025, 12:53 AMcuddly-cartoon-47334
04/03/2025, 6:43 AMtall-airline-16756
04/03/2025, 6:44 AMmetadata
property of the room object. Here’s how you can modify your code to include accessing the room metadata:
async def entrypoint(ctx: JobContext):
"""
This function runs in a *new process* each time the agent
is dispatched to a room.
"""
# Connect to the room
await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
# Access room metadata
room_metadata = ctx.room.metadata
print(f"Room metadata: {room_metadata}")
# Wait for the first participant
user_participant = await ctx.wait_for_participant()
Notes:
• The metadata
property returns the metadata associated with the room as a string.
• Room metadata can only be set using server APIs like CreateRoom
or UpdateRoomMetadata
.
• To handle metadata changes dynamically, you can listen for the RoomMetadataChanged
event.
If you need further assistance, feel free to ask!
Sources: livekit.rtc API documentation | Room metadata | LiveKit Docscuddly-cartoon-47334
04/04/2025, 2:25 AMcuddly-cartoon-47334
04/04/2025, 2:25 AMtall-airline-16756
04/04/2025, 2:25 AMcuddly-cartoon-47334
04/04/2025, 2:37 AMAudioManager.shared.isLegacyMuteMode = true
?cuddly-cartoon-47334
04/04/2025, 2:39 AMcuddly-cartoon-47334
04/04/2025, 2:40 AMcuddly-cartoon-47334
04/04/2025, 5:13 AM