How can I get the callee phone number on LiveKit W...
# ask-ai
b
How can I get the callee phone number on LiveKit Webhook events?
t
Thanks for reaching out, Dhruvil. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The callee phone number is included in LiveKit webhook payloads for SIP-related events. You can find it in the
participant.attributes['sip.trunkPhoneNumber']
field of the webhook event payload. This attribute contains the phone number associated with the SIP trunk, which, for inbound calls, is the number dialed by the end user (the callee number). For example, in a participant_joined or participant_left webhook event, you can access the callee number as follows:
Copy code
// JavaScript example
if (event.participant.kind === 'SIP') {
  const calleeNumber = event.participant.attributes['sip.trunkPhoneNumber'];
  // Use calleeNumber as needed
}
Note: The
sip.phoneNumber
attribute provides the caller's number, while
sip.trunkPhoneNumber
provides the callee's number. These attributes are only available for SIP participants and may be hidden if the
HidePhoneNumber
option is set in your dispatch rule. Let me know if you need more details or examples. Sources: SIP participant | LiveKit Docs | Webhooks | LiveKit Docs