calm-eye-57311
10/01/2025, 12:35 PMtall-airline-16756
10/01/2025, 12:36 PMtall-airline-16756
10/01/2025, 12:36 PMremoteParticipants property of the room object. This collection includes everyone connected to the room except the agent, since the agent is represented separately by localParticipant.
Let me share some examples in Python and Node.js to guide you through it:
Python:
# Loop through all participants except the agent
for participant in ctx.room.remote_participants.values():
print(participant.identity)
Node.js:
// Loop through all participants except the agent
for (const rp of ctx.room.remoteParticipants.values()) {
console.log(rp.identity);
}
This way, you’re sure to access only the remote participants (those who aren’t the agent) in the room. If you have any more questions or need further clarification, feel free to ask—I’m here to help!
Sources: Docs::Agents | Inside a session | LiveKit Docs | agents/src/job.tscalm-eye-57311
10/01/2025, 12:37 PMtall-airline-16756
10/01/2025, 12:37 PMattributes["sip.phoneNumber"] field, as long as the hide_phone_number setting isn’t turned on. This field shows the caller’s phone number for inbound calls or the number dialed for outbound calls.
• Agent-Initiated Outbound Calls: When an agent starts an outbound call, the phone number is usually stored in ctx.job.metadata. You can get it like this: dial_info = json.loads(ctx.job.metadata)
phone_number = dial_info["phone_number"]
• Phone Number Management: If you’re managing assigned numbers, the PhoneNumberService API is a handy tool to list or get details about numbers linked to your account.
Just a heads-up: non-SIP participants, such as web or mobile users, won’t have a phone number attribute unless you add it manually as custom metadata. Also, if hide_phone_number is enabled, the number won’t be visible.
Sources: Docs::Telephony | SIP participant | LiveKit Docs | Docs::Telephony | livekit-protocol/src/livekit.rs | Agents telephony integration | LiveKit Docscalm-eye-57311
10/01/2025, 12:50 PMtall-airline-16756
10/01/2025, 12:51 PMctx.room.remote_participants dictionary will be empty before you call ctx.connect(), since the agent hasn’t connected to the room yet. No worries though! Here are a few friendly steps to help you handle this smoothly:
1. Start by calling `ctx.connect()`: This will establish the connection to the room. Once connected, you can easily check for any participants already in the room:
2. Wait for participants to join: If you want to pause your code until someone joins, you can use await ctx.wait_for_participant() like this:
3. Set up a listener for participant events: This way, you’ll be notified whenever a new participant connects, making it easy to respond right away:
By following these steps, you’ll be all set to handle both existing and new participants smoothly once your connection is up and running. If you have any questions or need a hand, I’m here to help!
Sources: Docs::Agents | examples/other/transcription/multi-user-transcriber.py | complex-agents/drive-thru/tools/management_tools.py