faint-arm-51818
10/11/2025, 2:24 PMtall-airline-16756
10/11/2025, 2:24 PMtall-airline-16756
10/11/2025, 2:24 PMsip.trunkPhoneNumber and sip.phoneNumber from JobContext without needing to use wait_for_participant.
These attributes are conveniently added to SIP participants by LiveKit and become accessible through the JobContext.room object once the SIP participant has joined. You’ll find them inside the participant's attributes dictionary, which is set up when the SIP participant is created.
Here are a couple of friendly ways to get these attributes:
• From New Participant Events: You can listen to the participant_connected event and grab the attributes right when a SIP participant joins.
• From Existing Participants: Or, you can loop through job_context.room.remote_participants to access the attributes of participants who are already in the room when you start.
If you'd like, I’m here to help with more details or examples on how to implement this—just let me know!
Sources: SIP participant | LiveKit Docs | rpc/sip_test.go | telephony/warm_handoff.pyfaint-arm-51818
10/11/2025, 2:44 PMtall-airline-16756
10/11/2025, 2:44 PMsip.trunkPhoneNumber and `sip.phoneNumber`:
1. From New Participant Events:
def on_participant_connected_handler(participant):
if participant.kind == "PARTICIPANT_KIND_SIP":
trunk_phone = participant.attributes.get("sip.trunkPhoneNumber")
user_phone = participant.attributes.get("sip.phoneNumber")
print(f"Trunk Phone Number: {trunk_phone}")
print(f"User Phone Number: {user_phone}")
Here, you listen to the participant_connected event and grab the attributes right when a SIP participant joins. It’s a great way to catch those details in real time.
2. From Existing Participants:
for participant in ctx.room.remote_participants.values():
if participant.kind == "PARTICIPANT_KIND_SIP":
trunk_phone = participant.attributes.get("sip.trunkPhoneNumber")
phone = participant.attributes.get("sip.phoneNumber")
print(f"SIP Participant: {trunk_phone} → {phone}")
This example goes through job_context.room.remote_participants to find the attributes of participants who are already in the room when you start up. It’s handy for picking up existing info.
If you have any questions or want me to walk you through more examples, just let me know—I’m here to help!