When I add a trunk with multiple phone numbers, do...
# ask-ai
b
When I add a trunk with multiple phone numbers, does it automatically rotate them?
t
Thanks for reaching out, Wesley. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — great question. You're asking whether a trunk that contains multiple phone numbers will automatically rotate those numbers. No — adding multiple phone numbers to a trunk does not automatically rotate them. All numbers in the trunk’s
numbers
array are available for inbound calls and can be used by dispatch rules (for example, routing calls to rooms based on the called number or trunk ID). For outbound calling, rotation between those numbers is not performed by the trunk; outbound calls require an outbound trunk configuration and won’t automatically cycle through the inbound trunk’s number list. If you want rotation or selection for outbound calls, tell me which behavior you need (round-robin, failover, select by caller ID, or per-call selection) and what platform or API you’re using — I can suggest specific configuration or implementation options. Sources: sip | livekit/livekit_composite | DeepWiki
b
this is outbound only
t
Thanks — noted that this is outbound only. To be clear: trunks do not automatically rotate through the phone numbers you added for outbound calls. Outbound dialing must use an outbound trunk configuration and the system will not cycle those inbound numbers for outbound rotation. If you want to rotate or select numbers for outbound calls, I can help design an approach. A few options we can implement: • Round-robin selection: your outbound call logic picks the next number from a list each time. • Failover: use a primary outbound number and switch to another only when the call fails. • Per-call selection: choose the outbound caller ID based on caller, customer segment, or destination. • Weighted rotation: assign weights so some numbers are used more frequently. Tell me which behavior you want (round-robin, failover, per-call selection, weighted, or something else) and which API or platform you’re using for outbound calls. I’ll provide the specific configuration or sample logic to implement it.
b
I use this file to configure an outbound call
Copy code
{
  "sip_trunk_id": "ST_ncKqpey",
  "sip_call_to": "+5511985742635",
  "room_name": "outbound-test-1771937649",
  "participant_identity": "outbound-test",
  "participant_name": "Outbound Caller",
  "krisp_enabled": true,
  "wait_until_answered": true
}
There is no call number there
t
Thanks — I see you’re making outbound-only calls and your request payload has no explicit caller ID. I’ll clarify how this works and what you can do next. Short answer • The outbound caller ID is determined by the SIP trunk configuration (the
sip_trunk_id
you pass). The
CreateSIPParticipantRequest
payload you showed does not include a from/ caller ID field, so LiveKit will send the call through the configured outbound trunk and the provider will supply the outbound number. • LiveKit does not automatically rotate numbers on a trunk for outbound calls. Rotation or per-call caller ID selection is handled either by your SIP provider or by logic you add on your side. Options to get the behavior you want • Use provider-side rotation: Ask your SIP provider whether they rotate or load-balance caller IDs for outbound trunks when multiple numbers are assigned. If they do, LiveKit will simply send calls through the trunk and the provider’s rules will apply. • Per-call caller ID (if provider allows): Some providers allow you to override the outbound caller ID per call (often via a
sip_number
or similar parameter). LiveKit can include such a field in the outbound call request if your provider accepts it—but the provider must permit dynamic caller ID and typically requires the number to be verified. • Programmatic rotation client-side: Implement rotation in your application: a. Maintain a list of allowed numbers (either numbers you own or trunks configured with single numbers). b. On each outbound call, select the next number (round-robin, weighted, failover, or per-call rules). c. Initiate the call through the trunk that corresponds to the chosen number (for example, separate outbound trunks each tied to a single number, or include a
sip_number
override if supported). • Failover strategy: Use a primary caller ID and switch to another only after failure. This is also implemented client-side by selecting an alternate trunk/number after a failed attempt. What I recommend next • Tell me your SIP provider (for example: Twilio, Telnyx, etc.). I can then: ◦ Show whether LiveKit supports sending a
sip_number
override for that provider and give an example payload. ◦ Or show a simple client-side rotation pattern (code/pseudocode) to pick a number per call and call the appropriate trunk. • If you prefer, say which rotation method you want (round-robin, weighted, failover, or per-call selection) and I’ll provide a concrete example for implementing it with your provider. If you share your provider and preferred rotation behavior, I’ll give the exact request example or sample logic to implement it. Sources: Preserving Caller ID During SIP Transfers in LiveKit Agents | Preserve caller ID during SIP transfers with Twilio | LiveKit