early-afternoon-97327
09/19/2025, 12:24 PMtall-airline-16756
09/19/2025, 12:25 PMtall-airline-16756
09/19/2025, 12:25 PMearly-afternoon-97327
09/19/2025, 12:32 PMtall-airline-16756
09/19/2025, 12:33 PMimport asyncio
from livekit import api
async def main():
livekit_api = api.LiveKitAPI()
# Update specific fields of the trunk
trunk = await livekit_api.sip.update_inbound_trunk_fields(
trunk_id="<sip-trunk-id>",
allowed_numbers=["+13105550100", "+17145550100"],
name="My updated trunk",
)
print(f"Successfully updated trunk {trunk}")
await livekit_api.aclose()
asyncio.run(main())
2. Replace the entire trunk with a new configuration:
import asyncio
from livekit import api
from livekit.protocol.sip import SIPInboundTrunkInfo
async def main():
livekit_api = api.LiveKitAPI()
# Create a new trunk configuration
trunk = SIPInboundTrunkInfo(
numbers=['+15105550100'],
allowed_numbers=["+13105550100", "+17145550100"],
name="My replaced inbound trunk",
)
# Replace the existing trunk
updated_trunk = await livekit_api.sip.update_inbound_trunk(
trunk_id="<sip-trunk-id>",
trunk=trunk
)
print(f"Successfully replaced trunk {updated_trunk}")
await livekit_api.aclose()
asyncio.run(main())
Just to clarify, the first method lets you update only certain fields like name, numbers, or allowed_numbers. The second method is great if you want to replace the entire trunk configuration with a new one. If you have any questions or need a hand with anything else, please don’t hesitate to reach out—I’m here to help!
Sources: livekit-protocol/livekit/protocol/sip.pyi | SIP inbound trunk | LiveKit Docs