loud-beach-79426
08/27/2025, 4:27 PMtall-airline-16756
08/27/2025, 4:27 PMtall-airline-16756
08/27/2025, 4:28 PMkind field to see if it’s a SIP participant. Here’s a little example to help you out:
from livekit import rtc
async def on_participant_connected(participant: rtc.RemoteParticipant):
# Let’s see if this participant is a SIP participant
if participant.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP:
print(f"SIP Participant connected: {participant.identity}")
# Grab those SIP-specific details
sip_attributes = participant.attributes
phone_number = sip_attributes.get("sip.phoneNumber", "Unknown")
call_status = sip_attributes.get("sip.callStatus", "Unknown")
trunk_id = sip_attributes.get("sip.trunkID", "Unknown")
print(f"SIP Phone Number: {phone_number}")
print(f"SIP Call Status: {call_status}")
print(f"SIP Trunk ID: {trunk_id}")
else:
print(f"Standard participant connected: {participant.identity}")
# Hook up the event listener
room.on("participant_connected", on_participant_connected)
This little snippet listens for when someone connects, checks if they’re a SIP participant, and then pulls out some handy SIP info like their phone number, call status, and trunk ID.
If you have any questions or want to dive deeper, just let me know—I’m here to help!
Sources: Core API primitives | LiveKit Docs | README.md | complex-agents/ivr-agent/flask_livekit/extension.py | SIP participant | LiveKit Docs | SIP overview | LiveKit Docs