This didn't work, do you know the answer?
# ask-ai
a
This didn't work, do you know the answer?
t
Thanks for reaching out, Taha. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I completely understand how convenient it would be to use a wildcard (*) in the
numbers
array for your inbound trunk configuration when bridging from FreeSWITCH to LiveKit. However, the
numbers
field is actually designed to accept a list of specific phone numbers, meaning calls are only accepted for those explicitly listed. If you often add new numbers, you'll need to update the configuration manually each time. Please feel free to reach out if you'd like help with this setup or if you have any other questions—I'm here to support you! Sources: SIP Integration & Telephony | livekit/livekit_composite | DeepWiki | SIP outbound trunk | LiveKit Docs | sip/sip.go | livekit-protocol/src/livekit.rs
a
is there an api I can use to make this happen programmatically?
t
I'm happy to help you with updating the
numbers
array in your inbound trunk configuration using the
UpdateSIPInboundTrunk
API. This makes it really convenient to add or change numbers without having to do it manually each time. For instance, if you're using the Python SDK, you can try the
update_inbound_trunk_fields
method like this:
Copy code
await sip_service.update_inbound_trunk_fields(
    trunk_id="trunk_123",
    numbers=["+15105550100", "+15105550101"]
)
And if Kotlin is your preference, the
updateSipInboundTrunk
function with a
ListUpdate
object will help you manage the numbers list smoothly. Alternatively, if you want to work directly with the API, just send a POST request to
/twirp/livekit.SIP/UpdateSIPInboundTrunk
including the trunk ID and the updated numbers in the request body. Just be sure your request carries a signed access token with SIP admin permissions. Please feel free to reach out if you'd like me to walk you through any part of this or if you have any questions—I'm here to support you! Sources: protobufs/livekit_sip.proto | livekit-protocol/livekit/protocol/sip.pyi | src/main/kotlin/io/livekit/server/SipServiceClient.kt | SIP inbound trunk | LiveKit Docs | SIP APIs | LiveKit Docs
a
can I use livekit cli to add a number to an existing inbound trunk?
how about nodejs?
t
I'm happy to help you with updating the
numbers
array in the configuration of an inbound trunk using the LiveKit Node.js SDK. You can easily do this by using the
updateSipInboundTrunkFields
method from the
SipClient
class to update the numbers programmatically. Here's a simple example to guide you:
Copy code
await sipClient.updateSipInboundTrunkFields(sipTrunkId, {
  numbers: {
    set: ['+1-555-1234', '+1-555-5678']
  }
});
This method is quite flexible—it lets you add, remove, or replace numbers in your trunk configuration. If you have any questions or need a hand with implementing this, please don’t hesitate to reach out. I’m here to support you! Sources: packages/livekit-server-sdk/src/SipClient.ts | protobufs/livekit_sip.proto | livekit-api/livekit/api/sip_service.py