Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

ByocTrunk Resource


The ByocTrunks resource describes a trunk that can be configured to send/receive traffic to/from a PSTN Carrier.


ByocTrunk Properties

byoctrunk-properties page anchor
Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The SID of the Account that created the BYOC Trunk resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

sidSID<BY>

The unique string that that we created to identify the BYOC Trunk resource.

Pattern: ^BY[0-9a-fA-F]{32}$Min length: 34Max length: 34

friendly_namestring

The string that you assigned to describe the resource.


voice_urlstring<uri>
PII MTL: 30 days

The URL we call using the voice_method when the BYOC Trunk receives a call.


voice_methodenum<http-method>

The HTTP method we use to call voice_url. Can be: GET or POST.

Possible values:
GETPOST

voice_fallback_urlstring<uri>

The URL that we call when an error occurs while retrieving or executing the TwiML requested from voice_url.


voice_fallback_methodenum<http-method>

The HTTP method we use to call voice_fallback_url. Can be: GET or POST.

Possible values:
GETPOST

status_callback_urlstring<uri>

The URL that we call to pass status parameters (such as call ended) to your application.


status_callback_methodenum<http-method>

The HTTP method we use to call status_callback_url. Either GET or POST.

Possible values:
GETPOST

cnam_lookup_enabledboolean

Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See CNAM Lookups for more information.


connection_policy_sidSID<NY>

The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.

Pattern: ^NY[0-9a-fA-F]{32}$Min length: 34Max length: 34

from_domain_sidSID<SD>

The SID of the SIP Domain that should be used in the From header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a SIP Domain to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".

Pattern: ^SD[0-9a-fA-F]{32}$Min length: 34Max length: 34

date_updatedstring<date-time>

The date and time in GMT that the resource was last updated specified in RFC 2822(link takes you to an external page) format.


urlstring<uri>

The absolute URL of the resource.


Create a ByocTrunk resource

create-a-byoctrunk-resource page anchor
POST https://voice.twilio.com/v1/ByocTrunks

Request body parameters

request-body-parameters page anchor
Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.


VoiceUrlstring<uri>Optional

The URL we should call when the BYOC Trunk receives a call.


VoiceMethodenum<http-method>Optional

The HTTP method we should use to call voice_url. Can be: GET or POST.

Possible values:
GETPOST

VoiceFallbackUrlstring<uri>Optional

The URL that we should call when an error occurs while retrieving or executing the TwiML from voice_url.


VoiceFallbackMethodenum<http-method>Optional

The HTTP method we should use to call voice_fallback_url. Can be: GET or POST.

Possible values:
GETPOST

StatusCallbackUrlstring<uri>Optional

The URL that we should call to pass status parameters (such as call ended) to your application.


StatusCallbackMethodenum<http-method>Optional

The HTTP method we should use to call status_callback_url. Can be: GET or POST.

Possible values:
GETPOST

CnamLookupEnabledbooleanOptional

Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See CNAM Lookups for more information.


ConnectionPolicySidSID<NY>Optional

The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.

Pattern: ^NY[0-9a-fA-F]{32}$Min length: 34Max length: 34

FromDomainSidSID<SD>Optional

The SID of the SIP Domain that should be used in the From header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a SIP Domain to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".

Pattern: ^SD[0-9a-fA-F]{32}$Min length: 34Max length: 34

Create a ByocTrunk

create-a-byoctrunk page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.voice.v1.byocTrunks
_10
.create()
_10
.then(byoc_trunk => console.log(byoc_trunk.sid));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"sid": "BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"friendly_name": "friendly_name",
_17
"voice_url": "https://byoc.example.com/twilio/app",
_17
"voice_method": "POST",
_17
"voice_fallback_method": "POST",
_17
"voice_fallback_url": "https://byoc.example.com/twilio/fallback",
_17
"status_callback_method": "POST",
_17
"status_callback_url": "https://byoc.example.com/twilio/status_callback",
_17
"cnam_lookup_enabled": false,
_17
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"from_domain_sid": "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"date_created": "2020-03-18T23:31:36Z",
_17
"date_updated": "2020-03-18T23:31:36Z",
_17
"url": "https://voice.twilio.com/v1/ByocTrunks/BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}


Fetch a ByocTrunk resource

fetch-a-byoctrunk-resource page anchor
GET https://voice.twilio.com/v1/ByocTrunks/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<BY>required

The Twilio-provided string that uniquely identifies the BYOC Trunk resource to fetch.

Pattern: ^BY[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.voice.v1.byocTrunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(byoc_trunk => console.log(byoc_trunk.friendlyName));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"sid": "BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"friendly_name": "friendly_name",
_17
"voice_url": "https://byoc.example.com/twilio/app",
_17
"voice_method": "POST",
_17
"voice_fallback_method": "POST",
_17
"voice_fallback_url": "https://byoc.example.com/twilio/fallback",
_17
"status_callback_method": "POST",
_17
"status_callback_url": "https://byoc.example.com/twilio/status_callback",
_17
"cnam_lookup_enabled": false,
_17
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"from_domain_sid": "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"date_created": "2020-03-18T23:31:36Z",
_17
"date_updated": "2020-03-18T23:31:37Z",
_17
"url": "https://voice.twilio.com/v1/ByocTrunks/BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}


Read multiple ByocTrunk resources

read-multiple-byoctrunk-resources page anchor
GET https://voice.twilio.com/v1/ByocTrunks

Property nameTypeRequiredPIIDescription
PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

List multiple ByocTrunks

list-multiple-byoctrunks page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.voice.v1.byocTrunks
_10
.list({limit: 20})
_10
.then(byocTrunks => byocTrunks.forEach(b => console.log(b.sid)));

Output

_30
{
_30
"meta": {
_30
"page": 0,
_30
"page_size": 50,
_30
"first_page_url": "https://voice.twilio.com/v1/ByocTrunks?PageSize=50&Page=0",
_30
"previous_page_url": "https://voice.twilio.com/v1/ByocTrunks?PageSize=50&Page=0",
_30
"url": "https://voice.twilio.com/v1/ByocTrunks?PageSize=50&Page=0",
_30
"next_page_url": "https://voice.twilio.com/v1/ByocTrunks?PageSize=50&Page=1",
_30
"key": "byoc_trunks"
_30
},
_30
"byoc_trunks": [
_30
{
_30
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"sid": "BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"friendly_name": "friendly_name",
_30
"voice_url": "https://byoc.example.com/twilio/app",
_30
"voice_method": "POST",
_30
"voice_fallback_method": "POST",
_30
"voice_fallback_url": "https://byoc.example.com/twilio/fallback",
_30
"status_callback_method": "POST",
_30
"status_callback_url": "https://byoc.example.com/twilio/status_callback",
_30
"cnam_lookup_enabled": false,
_30
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"from_domain_sid": "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_30
"date_created": "2020-03-18T23:31:36Z",
_30
"date_updated": "2020-03-18T23:31:37Z",
_30
"url": "https://voice.twilio.com/v1/ByocTrunks/BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_30
}
_30
]
_30
}


Update a ByocTrunk resource

update-a-byoctrunk-resource page anchor
POST https://voice.twilio.com/v1/ByocTrunks/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<BY>required

The Twilio-provided string that uniquely identifies the BYOC Trunk resource to update.

Pattern: ^BY[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.


VoiceUrlstring<uri>Optional

The URL we should call when the BYOC Trunk receives a call.


VoiceMethodenum<http-method>Optional

The HTTP method we should use to call voice_url

Possible values:
GETPOST

VoiceFallbackUrlstring<uri>Optional

The URL that we should call when an error occurs while retrieving or executing the TwiML requested by voice_url.


VoiceFallbackMethodenum<http-method>Optional

The HTTP method we should use to call voice_fallback_url. Can be: GET or POST.

Possible values:
GETPOST

StatusCallbackUrlstring<uri>Optional

The URL that we should call to pass status parameters (such as call ended) to your application.


StatusCallbackMethodenum<http-method>Optional

The HTTP method we should use to call status_callback_url. Can be: GET or POST.

Possible values:
GETPOST

CnamLookupEnabledbooleanOptional

Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See CNAM Lookups for more information.


ConnectionPolicySidSID<NY>Optional

The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.

Pattern: ^NY[0-9a-fA-F]{32}$Min length: 34Max length: 34

FromDomainSidSID<SD>Optional

The SID of the SIP Domain that should be used in the From header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a SIP Domain to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".

Pattern: ^SD[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.voice.v1.byocTrunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({friendlyName: 'friendly_name'})
_10
.then(byoc_trunk => console.log(byoc_trunk.friendlyName));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"sid": "BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"friendly_name": "update_name",
_17
"voice_url": "https://byoc.example.com/twilio_updated/app",
_17
"voice_method": "GET",
_17
"voice_fallback_method": "GET",
_17
"voice_fallback_url": "https://byoc.example.com/twilio_updated/fallback",
_17
"status_callback_method": "GET",
_17
"status_callback_url": "https://byoc.example.com/twilio_updated/status_callback",
_17
"cnam_lookup_enabled": true,
_17
"connection_policy_sid": "NYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"from_domain_sid": "SDXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"date_created": "2020-03-18T23:31:36Z",
_17
"date_updated": "2020-03-18T23:31:37Z",
_17
"url": "https://voice.twilio.com/v1/ByocTrunks/BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
_17
}


Delete a ByocTrunk resource

delete-a-byoctrunk-resource page anchor
DELETE https://voice.twilio.com/v1/ByocTrunks/{Sid}

Property nameTypeRequiredPIIDescription
SidSID<BY>required

The Twilio-provided string that uniquely identifies the BYOC Trunk resource to delete.

Pattern: ^BY[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.voice.v1.byocTrunks('BYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();


Rate this page: