Manage Telephone Numbers Sample

A console application that provides access to the telephone number management facilities of the Aculab Cloud Web Services API. It allows one or more telephone numbers to be purchased and can be configured to create corresponding inbound services for each new number based on an existing service.

Usage

python manage_telephone_numbers.py [--wsserver <cloudWebServerAddress>] <cloudId> <username> <apiAccessKey> <command>

Arguments

cloudWebServerAddress

The address of the cloud web server. By default the wrappers call web services on https://ws-<cloudId>.aculabcloud.net. In certain circumstances you may need to use a different address which you can set here.

cloudId

Cloud region id (e.g. 1-2-0)

username

Cloud account username

apiAccessKey

Cloud API Access key

command

One of the following...

listcountries [<telNoType>]

liststates "<country>"

listregions "<country>[:<state>]" [<telNoType>]

listnumbers ["<country>[:<state>]" ["<region>" [<telNoType>]]]

listregaddresses

delete <number> | <numbersFile>

purchase "<country>[:<state>]" "<region>" [<quantity> [<allowpartial> [<baseonservice> ["<regaddress>" [<telNoType>]]]]]

purchasedev "<country>[:<state>]" "<region>" [<quantity> [<allowpartial> [<baseonservice> ["<regaddress>" [<telNoType>]]]]]

Where...

telNoType

One of the telephone number types: geographic, national, mobile or tollfree.

country

One of the returned country strings.

state

One of the returned state strings.

region

One of the returned region strings.

quantity

The quantity of telephone numbers to purchase. Defaults to 1.

allowpartial

(true/false) determines whether the request succeeds even if the requested quantity of telephone numbers are not available. Defaults to false.

baseonservice

The name of an existing inbound service (including the "sip:" prefix). If set then a new service will be created for each new number purchased, based on the settings within this service.

regaddress

The name of a regulation address that exists on the cloud account being used. Some countries require a regulation address to be specified.

number

A single inbound telephone number.

numbersFile

The name of a file containing 1 or more telephone numbers, comma-separated.

Note

For users running Python 2 under Windows, this tool does not support command line arguments containing non-ASCII characters. If you wish to specify command line arguments containing non-ASCII characters, please use Python 3.

Examples

  1. List countries

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword listcountries
    
  2. List states in Canada

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword liststates "Canada"
    
  3. List regions in France

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword listregions "France"
    
  4. List regions in Michigan

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword listregions "United States:Michigan"
    
  5. List numbers

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword listnumbers
    
  6. List numbers in Stockholm

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword listnumbers "Sweden" "Stockholm / 8"
    
  7. List numbers in Dallas

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword listnumbers "United States:Texas" "Dallas / 972"
    
  8. List regulation addresses

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword listregaddresses
    
  9. Delete number

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword delete 7890123
    
  10. Delete numbers listed in csv file

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword delete numbersToDelete.csv
    
  11. Purchase a number in Dallas

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword purchase "United States" "Dallas / 972"
    
  12. Purchase a number in Dallas with the state specified

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword purchase "United States:Texas" "Dallas / 972"
    
  13. Purchase 2 numbers in Stockholm

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword purchase "Sweden" "Stockholm / 8" 2
    
  14. Purchase 2 numbers in Stockholm

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword purchase "Sweden" "Stockholm / 8" 2 true sip:MyExistingService
    
  15. Purchase 3 numbers in Stockholm

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword purchase "Sweden" "Stockholm / 8" 3 true sip:MyExistingService
    
  16. Purchase 3 numbers in Nantes

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword purchase "France" "Nantes / 2" 3 false sip:MyExistingService "My French Place"
    
  17. Purchase 1 number in Bamberg

    python manage_telephone_numbers.py 0-2-0 bob@acompany.com bobsPword purchase "Germany" "Bamberg / 951" 1 false "" "MyGermanAddress"