participant = await ctx.wait_for_participant(kind=...
# ask-ai
b
participant = await ctx.wait_for_participant(kind=participant_kinds) how this is used?
t
Thanks for reaching out, mateuszkasprowicz. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're asking how
participant = await ctx.wait_for_participant(kind=participant_kinds)
is used — this waits until a participant of a specified kind (or kinds) joins the room, then returns that participant. Quick details and examples: • Purpose: block the agent until a matching participant appears so the agent interacts only with intended participant types (e.g., human callers, SIP callers). • Parameter:
kind
can be a single kind or a list. Example kinds:
rtc.ParticipantKind.PARTICIPANT_KIND_STANDARD
,
rtc.ParticipantKind.PARTICIPANT_KIND_SIP
,
rtc.ParticipantKind.PARTICIPANT_KIND_AGENT
, etc. • Default: calling
await ctx.wait_for_participant()
with no
kind
waits for any participant. Examples: 1) Wait for a SIP caller only
Copy code
participant = await ctx.wait_for_participant(kind=rtc.ParticipantKind.PARTICIPANT_KIND_SIP)
2) Wait for either a standard user or SIP caller
Copy code
participant_kinds = [
  rtc.ParticipantKind.PARTICIPANT_KIND_STANDARD,
  rtc.ParticipantKind.PARTICIPANT_KIND_SIP
]
participant = await ctx.wait_for_participant(kind=participant_kinds)
3) Wait for any participant
Copy code
participant = await ctx.wait_for_participant()
If you want, tell me which participant kinds you expect (web user, SIP caller, agent) and I’ll suggest the exact filter and next steps for handling that participant. Sources: livekit/livekit_composite | DeepWiki | Job lifecycle | LiveKit docs | Rooms, participants, and tracks | LiveKit docs
b
what's a different way to get the RemoteParticipant object during the session?
t
You're asking for other ways to obtain a RemoteParticipant during a session — here are the common options you can use. • Iterate current participants after connecting
Copy code
await ctx.connect()
for rp in ctx.room.remote_participants.values():
    # rp is a RemoteParticipant
    print(rp.identity)
• Listen for participant-connected events
Copy code
@ctx.room.on("participant_connected")
def on_participant_connected(participant: rtc.RemoteParticipant):
    print(participant.identity)
• Use track subscription events (gives participant when a track is subscribed)
Copy code
@ctx.room.on("track_subscribed")
def on_track_subscribed(track, publication, participant: rtc.RemoteParticipant):
    print(participant.identity)
Which SDK/language are you using (Python or Node)? I can provide a tailored example or show how to filter by participant kind. Sources: Job lifecycle | LiveKit docs | Building an Automated IVR Menu Caller | LiveKit docs | SIP participant | LiveKit docs