How can i get the phone number of the caller insid...
# ask-ai
s
How can i get the phone number of the caller inside the agent entry point
t
Thanks for reaching out, Youssef. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To get the phone number of the caller inside the agent entry point in LiveKit, you can access the SIP participant attributes. Here is an example of how to do it:
Copy code
# Inside your entrypoint function
participant = await ctx.wait_for_participant()

# Check if the participant is a SIP participant
if participant.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP:
    # Access the caller's phone number
    caller_phone_number = participant.attributes['sip.phoneNumber']
    <http://logger.info|logger.info>(f"Caller phone number is {caller_phone_number}")
    # Add other logic here based on the caller's phone number
This code checks if the participant is a SIP participant and retrieves the phone number using the
sip.phoneNumber
key. You can then use this information to customize your agent's behavior. Sources: SIP participant | LiveKit Docs