most-dawn-67700
12/09/2025, 1:52 AMtall-airline-16756
12/09/2025, 1:52 AMtall-airline-16756
12/09/2025, 1:52 AMPARTICIPANT_KIND_SIP / ParticipantKind.SIP).
• Read the sip.phoneNumber attribute from the participant's attributes — it contains the caller's number in E.164 format.
Example (Python):
if participant.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP:
phone_number = participant.attributes.get("sip.phoneNumber")
if phone_number:
print(f"Caller phone number: {phone_number}")
Example (Node.js/TypeScript):
if (participant.kind === ParticipantKind.SIP) {
const phoneNumber = participant.attributes['sip.phoneNumber'];
console.log(`Caller phone number: ${phoneNumber}`);
}
Notes:
• sip.phoneNumber is populated for inbound calls and may be omitted if a dispatch rule has HidePhoneNumber enabled.
• If not present, also check participant identity or job metadata (outbound calls may pass numbers via job metadata). Sources: SIP participant | LiveKit docs | Agents telephony integration | LiveKit docsmost-dawn-67700
12/09/2025, 2:42 AMtall-airline-16756
12/09/2025, 2:42 AMctx.room.metadata, ctx.job.metadata, participant.attributes / participant.metadata, and session.userdata.
• session.userdata is useful for passing custom state between agents during handoffs.
If you want, tell me which metadata field you need (e.g., sip.phoneNumber, job metadata, or session.userdata) and which language/runtime you’re using — I’ll provide a short code example.
Sources: Job lifecycle | LiveKit docs | Agents and handoffs | LiveKit docsmost-dawn-67700
12/09/2025, 3:31 AMtall-airline-16756
12/09/2025, 3:31 AMsession.userdata and it will be available to all subsequent agents for the rest of that session.
• Use session.userdata to store any custom state or structured data (e.g., caller number, disposition, flags).
• When an agent hands off control, include the updated `session.userdata`; the next agent reads the same session.userdata.
• Accessible fields include ctx.room.metadata, ctx.job.metadata, and participant.attributes, but session.userdata is the explicit mechanism for passing custom state between agents.
If you’d like, tell me your language/runtime and the specific fields you want to persist and I’ll provide a concise code example.most-dawn-67700
12/09/2025, 3:38 AMtall-airline-16756
12/09/2025, 3:38 AMroom_join handler).
• Subagents are instantiated and activated via handoffs within that session; they reuse the original entrypoint and share session context.
• Implement subagent-specific logic in lifecycle methods like on_enter() or by returning/updating the active agent during a tool call; no separate network entrypoint is required. Sources: examples/drive-thru | livekit/livekit_composite | DeepWiki | Agents and handoffs | LiveKit docs