loud-furniture-10936
10/31/2025, 12:08 AMtall-airline-16756
10/31/2025, 12:08 AMtall-airline-16756
10/31/2025, 12:08 AMlist_participants API to fetch all participants in a room and then log their details like identity, name, state, and publisher status. Here’s a simple example:
async def log_participants(self, context: RunContext):
room_name = self.job_context.room.name
response = await self.job_context.api.room.list_participants(
api.ListParticipantsRequest(room=room_name)
)
participants = response.participants
for p in participants:
print(f"Participant: {p.identity}, Name: {p.name}, State: {p.state}")
1. Listen to Participant Connection Events: Another great way is to use the on_participant_connected event handler. This lets you log participants in real-time as they join the room. Here’s how you can do it:
def on_participant_connected_handler(participant):
print(f"New participant connected: {participant.identity}")
These methods should help you keep track of participants smoothly. If you have any questions or need a hand with anything else, just let me know—I’m here to help!
Sources: SIP participant | LiveKit Docs | README.md | telephony/sip_lifecycle.py | SIP Integration & Telephony | livekit/livekit_composite | DeepWikiloud-furniture-10936
10/31/2025, 12:09 AMtall-airline-16756
10/31/2025, 12:10 AMListParticipants API: This allows you to easily retrieve all participants in a room by using the LiveKit Server SDK:
import { RoomServiceClient } from 'livekit-server-sdk';
const client = new RoomServiceClient(
process.env.LIVEKIT_URL,
process.env.LIVEKIT_API_KEY,
process.env.LIVEKIT_API_SECRET
);
const participants = await client.listParticipants('your-room-name');
console.log('Participants:', participants);
1. Listening to Participant Events in a Room: If you want to log participants as they join in real-time, this is a great approach:
room.on(RoomEvent.ParticipantConnected, (participant) => {
console.log(`Participant connected:`, participant.identity, participant.attributes);
});
And for SIP participants, you might find it helpful to log extra details like their phone number and call status:
if (participant.kind === 'SIP') {
const phoneNumber = participant.attributes?.['sip.phoneNumber'] || 'Unknown';
const callStatus = participant.attributes?.['sip.callStatus'] || 'Unknown';
console.log(`SIP participant connected: ${phoneNumber}, Call status: ${callStatus}`);
}
If you have any questions or need a hand with anything else, just let me know. I'm here to help!
Sources: Managing participants | LiveKit docs | telephony/sip_lifecycle.py | SIP participant | LiveKit Docsloud-furniture-10936
10/31/2025, 12:13 AMtall-airline-16756
10/31/2025, 12:14 AMroom.name property like this:
import { Room } from '@livekit/rtc-node';
const room = new Room();
// Connect to the room using the LiveKit URL and a participant token
await room.connect(
process.env.LIVEKIT_URL,
token, // generated token with appropriate permissions
{ autoSubscribe: true } // optional connection options
);
// Log the room name after connection
console.log('Connected to room:', room.name);
1. Server-Side Room Management: If you want to retrieve and log room names from the server, you can use the RoomServiceClient.listRooms() method like this:
const rooms = await roomServiceClient.listRooms();
rooms.forEach(r => console.log('Room name:', r.name));
If anything’s unclear or you’d like a hand with the next steps, just let me know—I’m here to help!
Sources: examples/room_example.py | examples/agent-dispatch/index.ts | Server-Side SDKs & Authentication | livekit/livekit_composite | DeepWikiloud-furniture-10936
10/31/2025, 12:20 AMtall-airline-16756
10/31/2025, 12:21 AMroom.name property like this:
room.on('connected', () => {
console.log('Connected to room:', room.name);
});
1. Server-Side Room Management: If you're handling SIP participants on the server side, the room name is usually specified in your dispatch logic or can be fetched via the API:
const rooms = await roomServiceClient.listRooms();
rooms.forEach(r => console.log('Room name:', r.name));
1. In SIP Dispatch Rules: The room name often comes from the dispatch logic, like direct dispatch or callee dispatch. Here's a quick example:
dispatch = await lkapi.agent_dispatch.create_dispatch(
api.CreateAgentDispatchRequest(
agent_name="survey-agent",
room="survey-call-123", // Explicit room name
metadata="..."
)
);
If anything feels unclear or you’d like me to walk you through any step, please don’t hesitate to ask. I’m here to help!
Sources: telephony/survey_caller/make_survey_calls.py | Server-Side SDKs & Authentication | livekit/livekit_composite | DeepWiki | test/integration/sip_test.go | How to Send Logs from the JavaScript SDK to Providers like Datadog | Agent Testing & CI/CD | livekit/livekit_composite | DeepWiki