im building a livekit based phone agent. I have co...
# ask-ai
r
im building a livekit based phone agent. I have connected my agent to a phone number. I want to know, as the session starts, the caller phone number and the called phone number. Hoe to get these info?
t
Thanks for reaching out, Taresh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! Could you please share a bit more about how you've connected the phone number with your LiveKit-based phone agent? For instance, are you using a particular telephony integration or API to manage the calls? Understanding this will really help me guide you better.
r
yes I am using twilio sip integration
t
I'm happy to help you retrieve the caller and called phone numbers in your LiveKit session using Twilio SIP integration. You can find these details in the participant object like this: • Caller’s phone number:
sip.phoneNumber
• Called/trunk phone number:
sip.trunkPhoneNumber
To make sure these attributes are populated correctly, please double-check the following setup: 1. Configure a Twilio SIP trunk and connect it to your LiveKit SIP URI. 2. Set up an inbound trunk in LiveKit with the matching SIP credentials. 3. Create a dispatch rule in LiveKit and set
hidePhoneNumber
to
false
so the caller ID is visible. If any of these steps feel unclear or you’d like me to walk you through them in more detail, just let me know—I’m here to help! Sources: SIP participant | LiveKit Docs | Docs::Telephony | Docs::Telephony | packages/sip--um-actually/src/setup-twilio.ts | Preserving Caller ID During SIP Transfers in LiveKit Agents