PhoneNumbersClient Class

A client to interact with the AzureCommunicationService Phone Numbers gateway.

This client provides operations to interact with the phone numbers service :param str endpoint:

The endpoint url for Azure Communication Service resource.

Inheritance
builtins.object
PhoneNumbersClient

Constructor

PhoneNumbersClient(endpoint: str, credential: TokenCredential, **kwargs: Any)

Parameters

credential
<xref:TokenCredential>
Required

The credentials with which to authenticate.

credential

Methods

begin_purchase_phone_numbers

Purchases phone numbers.

begin_release_phone_number

Releases an purchased phone number.

begin_search_available_phone_numbers

Search for available phone numbers to purchase.

begin_update_phone_number_capabilities

Updates the capabilities of a phone number.

from_connection_string

Create PhoneNumbersClient from a Connection String. :param str conn_str:

A connection string to an Azure Communication Service resource.

get_purchased_phone_number

Gets the details of the given purchased phone number.

list_purchased_phone_numbers

Gets the list of all purchased phone numbers.

begin_purchase_phone_numbers

Purchases phone numbers.

begin_purchase_phone_numbers(search_id: str, **kwargs: Any) -> LROPoller[None]

Parameters

search_id
str
Required

The search id.

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

Pass in True if you'd like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Return type

begin_release_phone_number

Releases an purchased phone number.

begin_release_phone_number(phone_number: str, **kwargs: Any) -> LROPoller[None]

Parameters

phone_number
str
Required

Phone number to be released, e.g. +55534567890.

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

Pass in True if you'd like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Return type

begin_search_available_phone_numbers

Search for available phone numbers to purchase.

begin_search_available_phone_numbers(country_code: str, phone_number_type: str, assignment_type: str, capabilities: PhoneNumberCapabilities, **kwargs: Any) -> LROPoller[PhoneNumberSearchResult]

Parameters

country_code
str
Required

The ISO 3166-2 country code, e.g. US.

phone_number_type
str or <xref:azure.communication.phonenumbers.models.PhoneNumberType>
Required

Required. The type of phone numbers to search for, e.g. geographic, or tollFree. Possible values include: "geographic", "tollFree".

assignment_type
str or <xref:azure.communication.phonenumbers.models.PhoneNumberAssignmentType>
Required

Required. The assignment type of the phone numbers to search for. A phone number can be assigned to a person, or to an application. Possible values include: "user", "application".

capabilities
<xref:azure.communication.phonenumbers.models.PhoneNumberCapabilities>
Required

Required. Capabilities of a phone number.

area_code
str

The area code of the desired phone number, e.g. 425. If not set, any area code could be used in the final search.

quantity
int

The quantity of phone numbers in the search. Default is 1.

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

Pass in True if you'd like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Return type

LROPoller[<xref:azure.communication.phonenumbers.models.PhoneNumberSearchResult>]

begin_update_phone_number_capabilities

Updates the capabilities of a phone number.

begin_update_phone_number_capabilities(phone_number: str, sms: str or PhoneNumberCapabilityType = None, calling: str or PhoneNumberCapabilityType = None, **kwargs: Any) -> LROPoller[PurchasedPhoneNumber]

Parameters

phone_number
str
Required

The phone number id in E.164 format. The leading plus can be either + or encoded as %2B, e.g. +55534567890.

calling
str or <xref:azure.communication.phonenumbers.models.PhoneNumberCapabilityType>
Required

Capability value for calling.

sms
str or <xref:azure.communication.phonenumbers.models.PhoneNumberCapabilityType>
Required

Capability value for SMS.

continuation_token
str

A continuation token to restart a poller from a saved state.

polling
bool or PollingMethod

Pass in True if you'd like the LROBasePolling polling method, False for no polling, or your own initialized polling object for a personal polling strategy.

polling_interval
int

Default waiting time between two polls for LRO operations if no Retry-After header is present.

Return type

LROPoller[<xref:azure.communication.phonenumbers.models.PurchasedPhoneNumber>]

from_connection_string

Create PhoneNumbersClient from a Connection String. :param str conn_str:

A connection string to an Azure Communication Service resource.

from_connection_string(conn_str: str, **kwargs: Any) -> PhoneNumbersClient

Parameters

cls
Required
conn_str
Required

Returns

Instance of PhoneNumbersClient.

Return type

get_purchased_phone_number

Gets the details of the given purchased phone number.

get_purchased_phone_number(phone_number: str, **kwargs: Any) -> PurchasedPhoneNumber

Parameters

phone_number
str
Required

The purchased phone number whose details are to be fetched in E.164 format, e.g. +11234567890.

Return type

<xref:azure.communication.phonenumbers.models.PurchasedPhoneNumber>

list_purchased_phone_numbers

Gets the list of all purchased phone numbers.

list_purchased_phone_numbers(**kwargs: Any) -> ItemPaged[PurchasedPhoneNumber]

Parameters

skip
int
Required

An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.

Return type

ItemPaged[<xref:azure.communication.phonenumbers.models.PurchasedPhoneNumber>]