can I use the same sip trunk id for multiple phone...
# ask-ai
c
can I use the same sip trunk id for multiple phone numbers? or does the same sip id map to a given phone number?
t
Thanks for reaching out, Subham. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Absolutely! You can use a single SIP trunk ID for multiple phone numbers in LiveKit. This is done by setting up the
numbers
field in the trunk settings, which lets you link several phone numbers to the same trunk ID. For inbound trunks, the trunk will happily accept calls to any of the numbers you’ve listed in the
numbers
field. And for outbound trunks, it will choose one of those numbers to make calls from. If you’d like, I’m here to help you with the configuration or answer any other questions you might have! Sources: SIP APIs | LiveKit docs | livekit-protocol/src/livekit.rs | sip/sip.go | packages/livekit-server-sdk/src/SipClient.ts | lib/livekit/sip_service_client.rb
c
how do I chose which number to trigger the call from when using the sip id, currently i use the following dispatch:
Copy code
await ctx.api.sip.create_sip_participant(
            api.CreateSIPParticipantRequest(
                room_name=ctx.room.name,
                sip_trunk_id=trunk_id,
                sip_call_to=phone_number,
                participant_identity=participant_identity,
                wait_until_answered=True,
            )
        )
t
I’m happy to help you choose which number to trigger a call from when using a SIP trunk ID! You can use the
sip_number
parameter in your
CreateSIPParticipant
request to explicitly set the caller ID for your call. Here’s a simple way to update your current dispatch:
Copy code
await ctx.api.sip.create_sip_participant(
    api.CreateSIPParticipantRequest(
        room_name=ctx.room.name,
        sip_trunk_id=trunk_id,
        sip_call_to=phone_number,
        participant_identity=participant_identity,
        sip_number="+15105550100",  # Specify the desired outbound number
        wait_until_answered=True,
    )
)
Just make sure the number you put in
sip_number
is part of your trunk’s configuration, and that your SIP provider supports caller ID passthrough for that number. If you have any questions or need more help, please don’t hesitate to ask—I’m here for you! Sources: lib/livekit/sip_service_client.rb | protobufs/rpc/io.proto | SIP outbound trunk | LiveKit docs | Preserving Caller ID During SIP Transfers in LiveKit Agents
c
that's insightful. Also can you specify how to use the inbound trunks. Can I configure the inbound trunk for multiple numbers? and add dispatch to the specific sip id?
t
You can easily set up an inbound SIP trunk for multiple numbers by listing them in the
numbers
field when creating the trunk. This way, your trunk will be ready to accept calls to any of the numbers you specify. When it comes to dispatching, LiveKit uses dispatch rules to send calls to rooms rather than directly to individual SIP IDs. Here are a couple of options you might find useful: • Direct Dispatch lets you route calls straight to a predefined room. • Individual Dispatch creates a new room for each caller, using a room prefix you define. To give you a clearer picture, here’s an example of how you can configure an inbound trunk:
Copy code
const inboundTrunkRequest = new CreateSIPInboundTrunkRequest({
  trunk: new SIPInboundTrunkInfo({
    name: "My Inbound Trunk",
    numbers: ["+1234567890", "+1987654321"], // Multiple numbers
    allowed_addresses: ["198.51.100.0/24"],
  }),
});
If you want to route calls to specific users or endpoints, using room-based dispatching and making sure the right participant is in the room can work really well. Please feel free to reach out if you’d like me to walk you through more details or provide additional examples—I’m here to help! Sources: SIP inbound trunk | LiveKit docs | Knowledge Base Content | livekit/livekit_composite | DeepWiki | SIP Integration & Telephony | livekit/livekit_composite | DeepWiki | livekit/livekit_sip.pb.go