livekit find trunk by phone number ?
# ask-ai
r
livekit find trunk by phone number ?
t
Thanks for reaching out, Saurabh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — you’re asking whether you can find a SIP inbound trunk in LiveKit by looking up a phone number. I’ll explain what’s possible and the best practical approach. Short answer • There is no built‑in API to directly look up a trunk by phone number. • Phone numbers are stored on SIP inbound trunks in the trunk’s
numbers
field, so you can find a trunk by listing trunks and checking that field. What you can do (recommended) 1. List inbound trunks via the API (e.g.,
list_sip_inbound_trunk()
). 2. Iterate through each trunk’s
numbers
field and match the phone number you’re searching for. 3. When you find a match, you have the trunk object and its metadata (ID, provider config, etc.). Why this is needed • Trunks are created with a
numbers
parameter that contains the phone numbers routed to that trunk, so the association exists on the trunk record itself. • There’s no documented single-step lookup endpoint for “find trunk by phone number,” so listing + filtering is the practical method. If you want, I can: • Show a short code example (language of your choice) that lists trunks and finds a matching number. • Help you design a server-side index (cache) so lookups are fast if you need to do this frequently. Which would you prefer — a code sample (and which language), or help planning a lookup/cache strategy? Sources: Python SDKs | livekit/livekit_composite | DeepWiki | sip | livekit/livekit_composite | DeepWiki | Preserve caller ID during SIP transfers with Twilio | LiveKit