Skip to main content

SIP inbound trunk

How to create and configure an inbound trunk to accept incoming calls.

After you purchase a phone number and configure your SIP trunking provider, you must create an inbound trunk and dispatch rule to accept incoming calls. The inbound trunk allows you to limit incoming calls to those coming from your SIP trunking provider.

You can also configure additional properties for all incoming calls that match the trunk including SIP headers, participant metadata and attributes, and session properties. For a full list of available parameters, see CreateSIPInboundTrunk.

Note

LiveKit supports username and password authentication for inbound trunks, but your SIP trunking provider must also support it. Support varies by provider—for example, Twilio Elastic SIP Trunking doesn’t support it, though you can use username and password authentication with TwiML. Check with your provider to confirm.

To learn more about LiveKit SIP, see SIP overview. To learn more about SIP API endpoints and types, see SIP API.

Inbound trunk example

The following examples create an inbound trunk that accepts calls made to the number +1-510-555-0100 and enables Krisp noise cancellation. This phone number is the number purchased from your SIP trunking provider.

Create a file named inbound-trunk.json with the following content:

{
"trunk": {
"name": "My trunk",
"numbers": ["+15105550100"],
"krisp_enabled": true
}
}
Important

The leading + in the phone number assumes the Destination Number Format is set to +E.164 for your Telnyx number.

Then create the inbound trunk using lk:

lk sip inbound create inbound-trunk.json

Accepting calls from specific phone numbers

The configuration for inbound trunk accepts inbound calls to number +1-510-555-0100 from caller numbers +1-310-555-1100 and +1-714-555-0100.

Important

Remember to replace the numbers in the example with actual phone numbers when creating your trunks.

{
"trunk": {
"name": "My trunk",
"numbers": ["+15105550100"],
"allowed_numbers": ["+13105550100", "+17145550100"]
}
}
Important

The leading + in the phone number assumes the Destination Number Format is set to +E.164 for your Telnyx number.

Tip

Allowed caller numbers can also be filtered with a Dispatch Rule.

List inbound trunks

Use the ListSIPInboundTrunk API to list all inbound trunks and trunk parameters.

lk sip inbound list

Update inbound trunk

Use the UpdateSIPInboundTrunk API to update specific fields of an inbound trunk or replace an inbound trunk with a new one.

Update specific fields of an inbound trunk

The UpdateSIPInboundTrunkFields API allows you to update specific fields of an inbound trunk without affecting other fields.

Create a file named inbound-trunk.json with the following content:

{
"name": "My trunk",
"numbers": ["+15105550100"]
}
Important

The leading + in the phone number assumes the Destination Number Format is set to +E.164 for your Telnyx number.

Update the inbound trunk using lk:

lk sip inbound update --id <trunk-id> inbound-trunk.json

Replace inbound trunk

The UpdateSIPInboundTrunk API allows you to replace an existing inbound trunk with a new one using the same trunk ID.

The instructions for replacing an inbound trunk are the same as for updating a trunk.