For LiveKit telephone services, I have users that ...
# ask-ai
e
For LiveKit telephone services, I have users that purchase numbers on Telnyx and we automate the pathing process to create inbound trunks with the right dispatch rules. I'm now looking at automating this for outbound agents too and I notice that the trunk rules include username / password in the configs. Is there a CLI method to just append numbers to trunks or do I need to design a workflow to store username/password in a secrets manager / create a new config to append on the old one? If I read the outbound trunk does it actually give me the username/password so that I can just append number to the numbers block?
t
Thanks for reaching out, Arthur. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your two questions about appending numbers to outbound trunks and whether credentials are readable. Short answer • There is no CLI method to append numbers to an existing outbound trunk. • Outbound trunk SIP credentials (username/password) are only shown at trunk creation and are not retrievable afterwards. What that means for automation • You must store the SIP credentials securely (e.g., HashiCorp Vault, AWS Secrets Manager) when you create the trunk. • To add numbers you need to: a. Retrieve the stored credentials from your secrets manager. b. Delete the existing trunk. c. Recreate the trunk with the original credentials and the updated numbers list. Commands you’ll use • Create trunk (only time you set credentials):
Copy code
lk sip outbound create --sip-uri=<http://sip.telnyx.com|sip.telnyx.com> --username=... --password=... --numbers="+1555..., +1666..."
• List trunks (does not return credentials):
Copy code
lk sip outbound list
• Delete trunk:
Copy code
lk sip outbound delete ST_XXXXXX
If you'd like, I can help with: • A sample script (bash/Python) that reads creds from a secrets manager, composes the full numbers list, deletes, and recreates the trunk. • Recommended secrets storage patterns for this workflow. Which would you prefer to see next? Sources: Server-side | livekit/livekit_composite | DeepWiki | sip | livekit/livekit_composite | DeepWiki
e
Rather than delete - is it just better to create one trunk per new number to not risk errors on deleting and losing all numbers in the process if the create goes wrong?
t
Good question — you’re rightly weighing safety vs. manageability. Recommendation • Creating a new trunk per new number is safer operationally: it avoids deleting an existing trunk (and the brief window where numbers could be lost if a recreate fails). This reduces risk of service disruption during automated updates. Trade-offs to consider • Pros of one-trunk-per-number ◦ Safer deployments (no destructive replace step). ◦ Simpler automation: create = idempotent if you track created trunks. ◦ Easier rollback — you can delete a failed new trunk without touching others. • Cons of one-trunk-per-number ◦ More objects to manage (inventory, billing visibility). ◦ Potentially more SIP endpoints and routing complexity on the provider side. ◦ Might complicate dialing logic if your system expects a single trunk for many numbers. Suggested safe automation pattern 1. Store SIP credentials in a secrets manager at trunk creation. 2. For each new number: ◦ Create a new outbound trunk with the number and credentials. ◦ Verify the trunk is usable (status checks, test calls). ◦ Only then mark the trunk as active in your system. 1. If you ever need to consolidate numbers into fewer trunks, do that as a planned maintenance window with careful validation and rollback steps. If you want, I can: • Provide a sample script that creates a trunk per number and verifies it (bash or Python). • Outline a small inventory schema to track trunks, numbers, and credentials. Which would help more?