does this work: if event.room: room_parti...
# ask-ai
b
does this work: if event.room: room_participants = getattr(event.room, "participants", []) for participant in room_participants: if participant.identity and participant.identity.startswith("sip_"): phone_number = extract_phone_from_participant(participant)
t
Thanks for reaching out, Vishnu. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like your code snippet is checking if a room exists and then going through its participants to pick out those whose identity starts with "sip_". That’s a solid way to filter participants in LiveKit! Just a couple of things to double-check: • Room Object: Make sure
event.room
is actually a valid room object. • Participants Attribute: Confirm that
event.room
has a
participants
attribute with the list of participants inside. • Identity Filtering: Each participant’s
identity
property should be accessible and properly formatted. If you run into any problems, feel free to share the exact error or what’s happening, and I’d be happy to help you figure it out! Sources: packages/livekit-server-sdk/src/RoomServiceClient.ts | livekit-android-sdk/src/main/java/io/livekit/android/room/Room.kt | packages/core/src/observables/participant.ts | pkg/rtc/room.go | livekit-agents/livekit/agents/utils/participant.py