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
Resource properties
account_sidtype: SID<AC>Not PII

sidtype: SID<BY>Not PII

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


friendly_nametype: stringNot PII

The string that you assigned to describe the resource.


voice_urltype: string<URI>PII MTL: 30 days

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


voice_methodtype: enum<HTTP METHOD>Not PII

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

Possible values:
HEADGETPOSTPATCHPUTDELETE

voice_fallback_urltype: string<URI>PII MTL: 30 days

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


voice_fallback_methodtype: enum<HTTP METHOD>Not PII

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

Possible values:
HEADGETPOSTPATCHPUTDELETE

status_callback_urltype: string<URI>PII MTL: 30 days

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


status_callback_methodtype: enum<HTTP METHOD>Not PII

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

Possible values:
HEADGETPOSTPATCHPUTDELETE

cnam_lookup_enabledtype: booleanNot PII

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(link takes you to an external page) for more information.


connection_policy_sidtype: SID<NY>Not PII

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


from_domain_sidtype: SID<SD>Not PII

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(link takes you to an external page) to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".


date_createdtype: string<DATE TIME>Not PII

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


date_updatedtype: string<DATE TIME>Not PII

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


urltype: string<URI>Not PII

The absolute URL of the resource.


Create a ByocTrunk resource

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

Parameters

create-parameters page anchor
Request body parameters
FriendlyNametype: stringNot PII

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


VoiceUrltype: string<URI>PII MTL: 30 days

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


VoiceMethodtype: enum<HTTP METHOD>Not PII

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

Possible values:
HEADGETPOSTPATCHPUTDELETE

VoiceFallbackUrltype: string<URI>PII MTL: 30 days

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


VoiceFallbackMethodtype: enum<HTTP METHOD>Not PII

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

Possible values:
HEADGETPOSTPATCHPUTDELETE

StatusCallbackUrltype: string<URI>PII MTL: 30 days

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


StatusCallbackMethodtype: enum<HTTP METHOD>Not PII

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

Possible values:
HEADGETPOSTPATCHPUTDELETE

CnamLookupEnabledtype: booleanNot PII

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(link takes you to an external page) for more information.


ConnectionPolicySidtype: SID<NY>Not PII

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


FromDomainSidtype: SID<SD>Not PII

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(link takes you to an external page) to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".

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}

URI parameters
Sidtype: SID<BY>Not PII
Path Parameter

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

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

URI parameters
PageSizetype: integerNot PII
Query Parameter

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


Pagetype: integerNot PII
Query Parameter

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


PageTokentype: stringNot PII
Query Parameter

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}

URI parameters
Sidtype: SID<BY>Not PII
Path Parameter

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


Request body parameters
FriendlyNametype: stringNot PII

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


VoiceUrltype: string<URI>PII MTL: 30 days

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


VoiceMethodtype: enum<HTTP METHOD>Not PII

The HTTP method we should use to call voice_url

Possible values:
HEADGETPOSTPATCHPUTDELETE

VoiceFallbackUrltype: string<URI>PII MTL: 30 days

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


VoiceFallbackMethodtype: enum<HTTP METHOD>Not PII

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

Possible values:
HEADGETPOSTPATCHPUTDELETE

StatusCallbackUrltype: string<URI>PII MTL: 30 days

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


StatusCallbackMethodtype: enum<HTTP METHOD>Not PII

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

Possible values:
HEADGETPOSTPATCHPUTDELETE

CnamLookupEnabledtype: booleanNot PII

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(link takes you to an external page) for more information.


ConnectionPolicySidtype: SID<NY>Not PII

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


FromDomainSidtype: SID<SD>Not PII

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(link takes you to an external page) to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".

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}

URI parameters
Sidtype: SID<BY>Not PII
Path Parameter

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

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: