NAME
Twilio::Rest::Trunking::V1::Trunk::PhoneNumber - The PhoneNumber resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $phone_number = $client->trunking->v1->trunks($trunk_sid)->phone_numbers->create($phone_number_sid);
for my $phone_number ($client->trunking->v1->trunks($trunk_sid)->phone_numbers->read({}, 20)) {
...
}
my $phone_number = $client->trunking->v1->trunks($trunk_sid)->phone_numbers($sid)->fetch;
$client->trunking->v1->trunks($trunk_sid)->phone_numbers($sid)->delete;
DESCRIPTION
Phone numbers associated with trunks
This file holds PhoneNumberList, PhoneNumberPage, PhoneNumberContext and PhoneNumberInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
PhoneNumberList
Returned by $client->trunking->v1->trunks($trunk_sid)->phone_numbers. See also Twilio::ListResource.
create
my $phone_number = $client->trunking->v1->trunks($trunk_sid)->phone_numbers->create($phone_number_sid);
Returns a PhoneNumberInstance.
The required values are:
$phone_number_sid-
The SID of the Incoming Phone Number that you want to associate with the trunk.
read
my @records = $client->trunking->v1->trunks($trunk_sid)->phone_numbers->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($trunk_sid)->phone_numbers->stream(\%options, $limit, $page_size);
Takes the same arguments as "read", and returns a Twilio::Stream.
page
my $page = $client->trunking->v1->trunks($trunk_sid)->phone_numbers->page(\%options, $page_size, $page_token, $page_number);
Fetches one page, and returns a Twilio::Page.
get_page
my $page = $client->trunking->v1->trunks($trunk_sid)->phone_numbers->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->trunking->v1->trunks($trunk_sid)->phone_numbers->get_context($sid);
Returns a PhoneNumberContext, and makes no request.
PhoneNumberPage
A Twilio::Page of PhoneNumberInstance objects.
records_key
build_instance
Used by Twilio::Page.
PhoneNumberContext
Returned by $client->trunking->v1->trunks($trunk_sid)->phone_numbers($sid). It makes no request until one of these methods is called.
fetch
my $phone_number = $client->trunking->v1->trunks($trunk_sid)->phone_numbers($sid)->fetch;
Returns a PhoneNumberInstance.
delete
$client->trunking->v1->trunks($trunk_sid)->phone_numbers($sid)->delete;
Returns true.
PhoneNumberInstance
See also Twilio::InstanceResource.
It has fetch and delete, which work as they do on the context.
Its fields are:
- account_sid
-
The SID of the Account that created the PhoneNumber resource.
- address_requirements
-
One of
none,any,localorforeign. - api_version
-
The API version used to start a new TwiML session.
- beta
-
Whether the phone number is new to the Twilio platform. Can be:
trueorfalse. - capabilities
-
The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are
Voice,SMS, andMMSand each capability can be:trueorfalse. A Twilio::Base::PhoneNumberCapabilities object. - 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.
- friendly_name
-
The string that you assigned to describe the resource.
- links
-
The URLs of related resources.
- phone_number
-
The phone number in E.164 format, which consists of a + followed by the country code and subscriber number.
- sid
-
The unique string that we created to identify the PhoneNumber resource.
- sms_application_sid
-
The SID of the application that handles SMS messages sent to the phone number. If an
sms_application_sidis present, we ignore allsms_*_urlvalues and use those of the application. - sms_fallback_method
-
The HTTP method we use to call
sms_fallback_url. Can be:GETorPOST. One ofGETorPOST. - sms_fallback_url
-
The URL that we call using the
sms_fallback_methodwhen an error occurs while retrieving or executing the TwiML fromsms_url. - sms_method
-
The HTTP method we use to call
sms_url. Can be:GETorPOST. One ofGETorPOST. - sms_url
-
The URL we call using the
sms_methodwhen the phone number receives an incoming SMS message. - status_callback
-
The URL we call using the
status_callback_methodto send status information to your application. - status_callback_method
-
The HTTP method we use to call
status_callback. Can be:GETorPOST. One ofGETorPOST. - trunk_sid
-
The SID of the Trunk that handles calls to the phone number. If a
trunk_sidis present, we ignore all of the voice URLs and voice applications and use those set on the Trunk. Setting atrunk_sidwill automatically delete yourvoice_application_sidand vice versa. - url
-
The absolute URL of the resource.
- voice_application_sid
-
The SID of the application that handles calls to the phone number. If a
voice_application_sidis present, we ignore all of the voice URLs and use those set on the application. Setting avoice_application_sidwill automatically delete yourtrunk_sidand vice versa. - voice_caller_id_lookup
-
Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be:
trueorfalse. - voice_fallback_method
-
The HTTP method that we use to call
voice_fallback_url. Can be:GETorPOST. One ofGETorPOST. - voice_fallback_url
-
The URL that we call using the
voice_fallback_methodwhen an error occurs retrieving or executing the TwiML requested byurl. - voice_method
-
The HTTP method we use to call
voice_url. Can be:GETorPOST. One ofGETorPOST. - voice_url
-
The URL we call using the
voice_methodwhen the phone number receives a call. Thevoice_urlis not be used if avoice_application_sidor atrunk_sidis set.
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.