\Aculab\WebServicesWrapperTelephoneNumbersWebService

Telephone Numbers Web Service.

Summary

Methods
Properties
Constants
setWebServicesServer()
setCryptoMethod()
setProxy()
__construct()
purchaseNumbers()
listNumbers()
deleteNumbers()
getSupportedCountries()
getSupportedStates()
getSupportedRegions()
getRegulationAddresses()
No public properties found
VERSION
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

VERSION

VERSION

The wrapper version.

The wrapper version number.

Methods

setWebServicesServer()

setWebServicesServer(string  $wsserver) 

Set the web services server address.

This allows the web service requests to be directed to a specific server. The default is https://ws-<cloud_id>.aculabcloud.net

Parameters

string $wsserver

The base URL of the web services server.

setCryptoMethod()

setCryptoMethod(integer  $method) 

Set the crypto method used when connectiing to the web services server.

This allows a specific crypto method to be used when connecting to the web service server. The values should be one of the STREAM_CRYPTO_METHOD_TLSv1_N_CLIENT constants. The default is STREAM_CRYPTO_METHOD_ANY_CLIENT.

Parameters

integer $method

The crypto method to use.

setProxy()

setProxy(string  $proxy, boolean  $request_fulluri) 

Configures the proxy server to use when making Web Service requests.

Parameters

string $proxy

URI specifying address of proxy server. (e.g. tcp://proxy.example.com:5100).

boolean $request_fulluri

When set to TRUE, the entire URI will be used when constructing the request. While this is a non-standard request format, some proxy servers require it.

__construct()

__construct(string  $cloud_id, string  $username, string  $access_key) 

Create a TelephoneNumbersWebService object.

Parameters

string $cloud_id

The cloud identifier, such as "1-2-0".

string $username

The cloud account username.

string $access_key

The access key for the cloud account.

purchaseNumbers()

purchaseNumbers(\Aculab\WebServicesWrapper\NumberPurchaseRequest  $number_purchase_request, boolean  $development = False) : array

Purchase telephone numbers.

This purchases an inbound telephone numbers. Please note that this service results in an immediate and subsequent monthly cost, unless $development is true.

Parameters

\Aculab\WebServicesWrapper\NumberPurchaseRequest $number_purchase_request

Details the numbers to purchase.

boolean $development

Indicates if this request is for development testing. When true, this request does not result in a purchase and no cost is incurred.

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

array —

An array containing the numbers purchased.

listNumbers()

listNumbers(string  $country = null, string  $state = null, string  $region = null, string  $did_type = null) : array

List purchased numbers.

This lists purchased telephone numbers. It can be filtered by location and type.

Parameters

string $country

The country where the number is located.

string $state

The state where the number is located.

string $region

The region where the number is located. This is a region name for geographic numbers or a number prefix for toll free, mobile or national numbers.

string $did_type

The type of numbers to include in the list. One of "geographic", "national", "mobile" or "tollfree". Default is to list all types.

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

array —

An array of NumberDetails objects, keyed by telephone number.

deleteNumbers()

deleteNumbers(array|string  $numbers) : array

Delete purchased numbers.

This deletes one or more of the purchased telephone numbers. The returned array only contains \Aculab\WebServicesWrapper\NumberDeleteError objects for the numbers that could not be deleted. If all specified numbers have been deleted the array is empty.

Parameters

array|string $numbers

The telephone number or an array of numbers to delete.

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

array —

An array of NumberDeleteError objects, keyed by telephone number.

getSupportedCountries()

getSupportedCountries(string  $did_type = null) : array

Get supported countries.

This obtains a list of the countries for which telephone numbers can be purchased.

Parameters

string $did_type

The type of numbers supported by a country for that country to be listed. One of "geographic", "national", "mobile" or "tollfree". Default is "geographic".

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

array —

An array of countries.

getSupportedStates()

getSupportedStates(string  $country) : array

Get supported states.

This obtains a list of the states in a specified country for which telephone numbers can be purchased. Note that not all countries support states.

Parameters

string $country

The country in which to list the supported states.

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

array —

An array of states.

getSupportedRegions()

getSupportedRegions(string  $country, string  $state = null, string  $did_type = null) : array

Get supported regions.

This obtains a list of the regions, or prefixes, in a specified country for which telephone numbers can be purchased.

Parameters

string $country

The country in which to list the supported regions.

string $state

The state in which to list the supported regions. Required for some countries.

string $did_type

The type of numbers supported by the region to be listed. One of "geographic", "national", "mobile" or "tollfree". Default is "geographic".

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

array —

An array of regions or prefixes.

getRegulationAddresses()

getRegulationAddresses() : array

List regulation addresses.

This lists any regulation addresses that have been registered on a cloud account. Some countries require an address to be specified when purchasing a telephone number.

Throws

\Aculab\WebServicesWrapper\WebServiceException

Returns

array —

An array of RegulationAddressDetails, keyed by address name.