clever-doctor-15083
02/24/2025, 7:14 AMgray-monkey-83525
02/24/2025, 7:14 AMparticipant_left
event can be used to save call-related data when a participant leaves a room. According to the LiveKit Webhooks documentation, this event provides details about the room and participant, which can be useful for logging or database operations.
If you are looking to save data incrementally during a call, you might consider using the agent_speech_committed
and user_speech_committed
events, as suggested in a Slack discussion. These events can help you capture and store data in real-time as the conversation progresses.
Would you like more detailed guidance on implementing these solutions?
Sources:
- Slack discussion on saving chat data
- LiveKit Webhooks documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/24/2025, 8:50 AM'SIP REFER was denied
@millions-hair-24956gray-monkey-83525
02/24/2025, 8:50 AMclever-doctor-15083
02/24/2025, 1:00 PM'participant does not exist'
@millions-hair-24956gray-monkey-83525
02/24/2025, 1:00 PMclever-doctor-15083
02/25/2025, 7:25 AMgray-monkey-83525
02/25/2025, 7:25 AMclever-doctor-15083
02/25/2025, 7:28 AMgray-monkey-83525
02/25/2025, 7:28 AMparticipant_joined
event in LiveKit, you can use the event listener on the Room
object. Here's a basic example using the LiveKit JavaScript SDK:
import { Room, RoomEvent } from 'livekit-client';
// Create a new room instance
const room = new Room();
// Connect to the room
await room.connect('ws://your-livekit-server', 'your-access-token');
// Set up the event listener for participant joined
room.on(RoomEvent.ParticipantConnected, (participant) => {
console.log('Participant joined:', participant.identity);
// Add your logic here, e.g., update UI or notify users
});
This code sets up an event listener for the ParticipantConnected
event, which is triggered when a new participant joins the room. You can replace 'ws://your-livekit-server'
and 'your-access-token'
with your actual server URL and access token.
Would you like more detailed guidance on this implementation?
Sources:
- https://livekit-users.slack.com/archives/C07FYCB7FRQ/p1731067594.737829
- https://docs.livekit.io/home/server/webhooks/ 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/25/2025, 7:30 AMclever-doctor-15083
02/25/2025, 7:30 AMgray-monkey-83525
02/25/2025, 7:30 AMagent_speech_committed
event in LiveKit, you can set up an event listener to capture when the agent's speech is committed to the chat context. This event is useful for logging or processing the final transcription of the agent's speech. Here's a basic example using the LiveKit Python SDK:
from livekit.agents.pipeline import VoicePipelineAgent
# Initialize the VoicePipelineAgent
agent = VoicePipelineAgent(...)
# Define the callback function for the event
def on_agent_speech_committed(msg):
print("Agent speech committed:", msg.text)
# Add your logic here, e.g., save to database or update UI
# Register the event listener
agent.on("agent_speech_committed", on_agent_speech_committed)
# Start the agent
agent.start(room, participant)
This code sets up a listener for the agent_speech_committed
event, which is triggered when the agent's speech is finalized and added to the chat context. You can replace the print
statement with any logic you need, such as saving the transcription to a database.
Would you like more detailed guidance on this implementation?
Sources:
- LiveKit Python SDK documentation
- Slack discussion on using speech committed events 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/25/2025, 7:33 AMgray-monkey-83525
02/25/2025, 7:33 AMRoom Started
event is fired. This event is triggered when a room is initialized, either manually via an API call or automatically when the first participant joins the room. According to the LiveKit Webhooks documentation, this event can be used to perform actions such as logging or initializing resources when a room is created.
Would you like more detailed information on handling this event?
Sources:
- LiveKit Webhooks documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/25/2025, 7:35 AMgray-monkey-83525
02/25/2025, 7:35 AMparticipant_joined
and participant_left
events to capture when a participant enters and exits the room. These events provide timestamps that can be used to calculate the duration of the call.
2. Calculate Duration: Subtract the join timestamp from the leave timestamp to get the call duration for each participant. If you need the total call duration for the room, consider the time from when the first participant joins to when the last participant leaves.
For example, using JavaScript:
import { Room, RoomEvent } from 'livekit-client';
const room = new Room();
let callStartTime;
// Connect to the room
await room.connect('ws://your-livekit-server', 'your-access-token');
// Listen for the first participant joining
room.on(RoomEvent.ParticipantConnected, (participant) => {
if (!callStartTime) {
callStartTime = new Date();
}
});
// Listen for the last participant leaving
room.on(RoomEvent.ParticipantDisconnected, (participant) => {
if (room.participants.size === 0) {
const callEndTime = new Date();
const callDuration = (callEndTime - callStartTime) / 1000; // in seconds
console.log('Call duration:', callDuration, 'seconds');
}
});
Would you like more detailed guidance on implementing this?
Sources:
- https://livekit-users.slack.com/archives/C07FY8WHGPM/p1733240737.020829
- https://docs.livekit.io/home/cloud/analytics-api/#Examples 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/25/2025, 7:59 AMgray-monkey-83525
02/25/2025, 7:59 AMparticipant_connected
event in LiveKit, you can set up an event listener on the Room
object to execute a callback function whenever a new participant joins the room. Here's an example using the LiveKit JavaScript SDK:
import { Room, RoomEvent } from 'livekit-client';
// Create a new room instance
const room = new Room();
// Connect to the room
await room.connect('ws://your-livekit-server', 'your-access-token');
// Set up the event listener for participant connected
room.on(RoomEvent.ParticipantConnected, (participant) => {
console.log('Participant connected:', participant.identity);
// Add your logic here, e.g., update UI or notify users
});
In this example, the ParticipantConnected
event is used to log the identity of the participant who has joined the room. You can replace the console.log
statement with any logic you need, such as updating the user interface or sending notifications.
Would you like more detailed guidance on this implementation?
Sources:
- Slack discussion on participant events 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.clever-doctor-15083
02/25/2025, 8:02 AMgray-monkey-83525
02/25/2025, 8:02 AMparticipant_connected
event in LiveKit using Python, you can set up an event listener on the Room
object. Here's an example using the LiveKit Python SDK:
from livekit import rtc
import asyncio
async def main():
# Create a new room instance
room = rtc.Room()
# Define the callback function for the event
def on_participant_connected(participant):
print(f"Participant connected: {participant.identity}")
# Register the event listener
room.on("participant_connected", on_participant_connected)
# Connect to the room
await room.connect("ws://your-livekit-server", "your-access-token")
# Keep the connection alive
try:
while True:
await asyncio.sleep(1)
except KeyboardInterrupt:
print("Disconnecting from room...")
await room.disconnect()
# Run the main function
if __name__ == '__main__':
asyncio.run(main())
In this example, the participant_connected
event is used to print the identity of the participant who has joined the room. You can replace the print
statement with any logic you need, such as updating a database or notifying other services.
Would you like more detailed guidance on this implementation?
Sources:
- LiveKit Python SDK documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.