how do i get number of caller ?
# ask-ai
g
how do i get number of caller ?
t
Thanks for reaching out, Andrii. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd be happy to help you retrieve the phone number of a caller in LiveKit! You can find this information using the
sip.phoneNumber
attribute, which is part of a SIP participant's
attributes
field when the participant type is
SIP
. Let’s walk through the steps together: Steps to Retrieve the Caller’s Number: 1. First, check if the participant’s kind is
SIP
by using
participant.kind == ParticipantKind.SIP
. 2. Then, access the
sip.phoneNumber
from the participant’s attributes dictionary. Example (Node.js):
Copy code
if (participant.kind == ParticipantKind.SIP) {
  console.log(participant.attributes['sip.phoneNumber']);
}
Example (Python):
Copy code
if participant.kind == rtc.ParticipantKind.PARTICIPANT_KIND_SIP:
    caller_number = participant.attributes.get('sip.phoneNumber')
    if caller_number:
        <http://logger.info|logger.info>(f"Caller phone number is {caller_number}")
Just a couple of important things to keep in mind: • If
HidePhoneNumber
is set to
true
in your dispatch rule configuration, the
sip.phoneNumber
attribute won’t be available. • For outbound calls, the
sip.phoneNumber
reflects the number dialed by the SIP participant, not the caller’s actual number. If you have any questions or need further assistance, feel free to ask—I’m here to help! Sources: SIP participant | LiveKit Docs