SIP Inbound Trunk

How to create and configure an Inbound Trunk to accept incoming calls.

To provision an Inbound Trunk with the SIP Service, use the CreateSIPInboundTrunk API. It returns an SIPInboundTrunkInfo object that describes the created SIP Trunk. These parameters can also be queried at any time using the ListSIPInboundTrunk API.

Minimal Inbound Trunk

The following creates an Inbound Trunk with minimal configuration. It will accept all inbound calls to number +1234567890.

Create a file at inboundTrunk.json with the following content:

{
"trunk": {
"name": "Demo Inbound Trunk",
"numbers": ["+1234567890"]
}
}
caution:

Note that Twilio numbers must start with a leading +.

tip:

Multiple inbound numbers can be specified for one Trunk.

Then create the Inbound Trunk using lk:

lk sip inbound create inboundTrunk.json

Accepting calls from specific phone numbers and IPs

The configuration for Inbound Trunk will accept inbound calls to number +1234567890 from caller numbers +11111111 and +22222222 and IP range 1.1.1.0/24.

{
"trunk": {
"name": "Demo Inbound Trunk",
"numbers": ["+1234567890"],
"allowed_numbers": ["+11111111", "+22222222"],
"allowed_addresses": ["1.1.1.0/24"]
}
}
caution:

Note that Twilio numbers must start with a leading +.

tip:

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

Enabling authentication for inbound calls

The following Inbound Trunk configuration requires user/password authentication from a SIP Trunk Provider:

{
"trunk": {
"name": "Demo Inbound Trunk",
"numbers": ["+1234567890"],
"auth_username": "<sip-inbound-user>",
"auth_password": "<sip-inbound-pass>"
}
}