rapid-painting-51133
04/08/2026, 3:29 PMtall-airline-16756
04/08/2026, 3:29 PMtall-airline-16756
04/08/2026, 3:30 PMdata.from.
Examples:
1. Participant-connected handler (Python)
@room.on("participant_connected")
async def on_participant_connected(participant):
called_number = participant.metadata.get("data.from")
print(f"Caller dialed: {called_number}")
1. From job/agent context (find SIP participant)
sip_participant = next(
(p for p in ctx.room.remote_participants.values() if p.kind == ParticipantKind.PARTICIPANT_KIND_SIP),
None
)
if sip_participant:
called_number = sip_participant.metadata.get("data.from")
print(f"Call was received on number: {called_number}")
If you want, tell me which language or part of your agent (entrypoint, tool, or event handler) you're using and I’ll give a targeted snippet.
Sources: Agents telephony integration | LiveKit Documentation | sip | livekit/livekit_composite | DeepWiki | How to do call transfers with Five9 | LiveKit, with interactive elementsrapid-painting-51133
04/08/2026, 3:50 PMtall-airline-16756
04/08/2026, 3:51 PMparticipant.metadata is a string. Two ways to get the called number (DNIS):
• If the metadata string contains JSON with data.from, parse it first. Example (Python):
import json
meta = participant.metadata # string
data = json.loads(meta)
called_number = data.get("data", {}).get("from")
• Prefer using participant attributes when available: SIP headers (DNIS) are often mapped to participant attributes via headers_to_attributes. Example:
called_number = participant.attributes.get("five9.call_dnis") # or whatever attribute key your trunk maps to
Which integration are you using (SIP trunk provider or LiveKit Phone Numbers)? I can give a tailored snippet for your case.
Sources: Agent Builder | LiveKit Documentation | Server-side | livekit/livekit_composite | DeepWiki | How to do call transfers with Five9 | LiveKit | livekit-protocol/livekit/protocol/sip.pyi | livekit/attrs.go, with interactive elementsrapid-painting-51133
04/08/2026, 4:04 PMtall-airline-16756
04/08/2026, 4:04 PMmetadata is coming back empty. To help quickly, I need a few details about your setup:
• Are you using a SIP trunk provider or LiveKit Phone Numbers?
• Where and when are you reading participant.metadata (event handler, agent entrypoint, or after join)?
• Do you have a headers_to_attributes mapping configured on your trunk (or any SIP header mappings)?
• Can you share a short snippet of how you’re accessing the participant (no secrets)?
With those, I’ll tell you the exact place to read DNIS (attributes vs parsed metadata) and a targeted code snippet to extract it.
, with interactive elements