NAME
Twilio::Rest::Trunking::V1::Trunk - The Trunk resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $trunk = $client->trunking->v1->trunks->create(\%options);
for my $trunk ($client->trunking->v1->trunks->read({}, 20)) {
...
}
my $trunk = $client->trunking->v1->trunks($sid)->fetch;
$client->trunking->v1->trunks($sid)->update(\%options);
$client->trunking->v1->trunks($sid)->delete;
DESCRIPTION
Represents a SIP trunk
This file holds TrunkList, TrunkPage, TrunkContext and TrunkInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
TrunkList
Returned by $client->trunking->v1->trunks. See also Twilio::ListResource.
create
my $trunk = $client->trunking->v1->trunks->create(\%options);
Returns a TrunkInstance.
The options are:
cnam_lookup_enabled-
Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP 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.
disaster_recovery_method-
The HTTP method we should use to call the
disaster_recovery_url. Can be:GETorPOST. One ofGETorPOST. disaster_recovery_url-
The URL we should call using the
disaster_recovery_methodif an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See Disaster Recovery for more information. domain_name-
The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and
-and must end withpstn.twilio.com. See Termination Settings for more information. friendly_name-
A descriptive string that you create to describe the resource. It can be up to 64 characters long.
secure-
Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See Secure Trunking for more information.
transfer_caller_id-
One of
from-transfereeorfrom-transferor. transfer_mode-
One of
disable-all,enable-allorsip-only.
read
my @records = $client->trunking->v1->trunks->read(\%options, $limit, $page_size);
Returns the records as a list, fetching as many pages as it needs.
stream
my $stream = $client->trunking->v1->trunks->stream(\%options, $limit, $page_size);
Takes the same arguments as "read", and returns a Twilio::Stream.
page
my $page = $client->trunking->v1->trunks->page(\%options, $page_size, $page_token, $page_number);
Fetches one page, and returns a Twilio::Page.
get_page
my $page = $client->trunking->v1->trunks->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->trunking->v1->trunks->get_context($sid);
Returns a TrunkContext, and makes no request.
TrunkPage
A Twilio::Page of TrunkInstance objects.
records_key
build_instance
Used by Twilio::Page.
TrunkContext
Returned by $client->trunking->v1->trunks($sid). It makes no request until one of these methods is called.
fetch
my $trunk = $client->trunking->v1->trunks($sid)->fetch;
Returns a TrunkInstance.
update
my $trunk = $client->trunking->v1->trunks($sid)->update(\%options);
Returns a TrunkInstance.
The options are:
cnam_lookup_enabled-
Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP 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.
disaster_recovery_method-
The HTTP method we should use to call the
disaster_recovery_url. Can be:GETorPOST. One ofGETorPOST. disaster_recovery_url-
The URL we should call using the
disaster_recovery_methodif an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See Disaster Recovery for more information. domain_name-
The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and
-and must end withpstn.twilio.com. See Termination Settings for more information. friendly_name-
A descriptive string that you create to describe the resource. It can be up to 64 characters long.
secure-
Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See Secure Trunking for more information.
transfer_caller_id-
One of
from-transfereeorfrom-transferor. transfer_mode-
One of
disable-all,enable-allorsip-only.
delete
$client->trunking->v1->trunks($sid)->delete;
Returns true.
credentials_lists
my $list = $object->credentials_lists;
my $context = $object->credentials_lists($sid);
See Twilio::Rest::Trunking::V1::Trunk::CredentialList.
ip_access_control_lists
my $list = $object->ip_access_control_lists;
my $context = $object->ip_access_control_lists($sid);
See Twilio::Rest::Trunking::V1::Trunk::IpAccessControlList.
origination_urls
my $list = $object->origination_urls;
my $context = $object->origination_urls($sid);
See Twilio::Rest::Trunking::V1::Trunk::OriginationUrl.
phone_numbers
my $list = $object->phone_numbers;
my $context = $object->phone_numbers($sid);
See Twilio::Rest::Trunking::V1::Trunk::PhoneNumber.
recordings
my $context = $object->recordings;
See Twilio::Rest::Trunking::V1::Trunk::Recording.
TrunkInstance
See also Twilio::InstanceResource.
It has fetch, update, delete, credentials_lists, ip_access_control_lists, origination_urls, phone_numbers and recordings, which work as they do on the context.
Its fields are:
- account_sid
-
The SID of the Account that created the Trunk resource.
- auth_type
-
The types of authentication mapped to the domain. Can be:
IP_ACLandCREDENTIAL_LIST. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic. - auth_type_set
-
Reserved.
- cnam_lookup_enabled
-
Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP 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.
- date_created
-
The date and time in GMT when the resource was created specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- date_updated
-
The date and time in GMT when the resource was last updated specified in RFC 2822 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- disaster_recovery_method
-
The HTTP method we use to call the
disaster_recovery_url. Can be:GETorPOST. One ofGETorPOST. - disaster_recovery_url
-
The URL we call using the
disaster_recovery_methodif an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See Disaster Recovery for more information. - domain_name
-
The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and
-and must end withpstn.twilio.com. See Termination Settings for more information. - friendly_name
-
The string that you assigned to describe the resource.
- links
-
The URLs of related resources.
- recording
-
The recording settings for the trunk. Can be:
do-not-record,record-from-ringing,record-from-answer. If set torecord-from-ringingorrecord-from-answer, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g./Trunks/[Trunk_SID]/Recording -XPOST -d'Mode=record-from-answer'. See Recording for more information. - secure
-
Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See Secure Trunking for more information.
- sid
-
The unique string that we created to identify the Trunk resource.
- symmetric_rtp_enabled
-
Whether Symmetric RTP is enabled for the trunk. When Symmetric RTP is disabled, Twilio will send RTP to the destination negotiated in the SDP. Disabling Symmetric RTP is considered to be more secure and therefore recommended. See Symmetric RTP for more information.
- transfer_caller_id
-
One of
from-transfereeorfrom-transferor. - transfer_mode
-
One of
disable-all,enable-allorsip-only. - url
-
The absolute URL of the resource.
CONSTRUCTORS
new
Objects here come from the methods above, so there is no need to call new directly.
LICENSE
Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.