/
4.1.15 DID Manager

4.1.15 DID Manager

DID manager

URL: /did.ashx

This method allows you to purchase a DID number and download information about your current numbers. This method contains two parameters: dm and pm. The dm parameter describes the name of the method, while the pm parameter describes the parameters of a given method. The following methods are available within the DID manager:

Authorization

Authorization
The method requires authorization using basic authentication. Please use the sip login and password.

Purchasing a DID number

To purchase a number, follow these steps:

  1. Download the country list
  2. Download the list of areas/cities
  3. Call the method to buy a number from a given country and area.
  4. Reading the DID list

1. Request - download the list of countries

Parameter

Description

dm

parameter specifies the name of the method. If you want to retrieve a list of countries, set the value to "getCountries"

curl --location --request POST 'https://xxxxxxxxxx/emcd/did.ashx?dm=getCountries' \
--header 'User-Agent: vippie;ios;1.2.3' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic cGlvdHIyOndpZWxraXBpb3Ry' \
--header 'X-VIPPIE-DEVICE-ID: ff66fc693846285d' \
--header 'X-VIPPIE-DEVICE-NAME: iPhone8,1'

1. Response -download the list of countries

[
 {
  "id": 50,
  "cc": "359",
  "co": "BG",
  "pd": 1,
  "pn": 3,
  "pc": 16.00,
  "sc": 4.00
 },
 {
  "id": 51,
  "cc": "1",
  "co": "CA",
  "pd": 1,
  "pn": 3,
  "pc": 8,
  "sc": 0.5
 },
...
]

where:

  • id - country ID
  • cc - country code
  • co - country
  • pd - period - a numerical value specifying the period type where 1 - Monthly, 2 - Weekly, 4 - Daily
  • pn - period number - number of periods
  • pc - period cost - price for a given period
  • sc - startup cost - activation price

 

2. Request - download the list of areas/cities

Parameter

Description

dm

parameter specifies the name of the method. If you want to retrieve a list of areas, set the value to "getAreas"

pmin parameter you should pass the country id using the JSON object { "id": x} where x is the country id returned in the country list - the "id" field.


curl --location --globoff --request POST 'https://xxxxxxxx/emcd/did.ashx?dm=getAreas&pm={%20%22id%22%3A%222%22}' \
--header 'User-Agent: vippie;ios;1.2.3' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic cGlvdHIyOndpZWxraXBpb3Ry' \
--header 'X-VIPPIE-DEVICE-ID: ff66fc693846285d' \
--header 'X-VIPPIE-DEVICE-NAME: iPhone8,1'


Response on above request:

[{"ac":"212","an":"New York 212","la":3,"vg":-1,"ww":""},{"ac":"917","an":"New York
917","la":4,"vg":-1,"ww":""},{"ac":"978","an":"Massachusetts","la":6,"vg":-1,"ww":""},{"ac":"973","an":"New
Jersey","la":7,"vg":-1,"ww":""}]

2. Response - download the list of areas/cities

[
    {
        "an": "HAIFA",
		"ac": 1,
        "la": -1,
        "vg": 9816
    },
    {
        "an": "HSHARON",
		"ac": 2,
        "la": -1,
        "vg": 9818
    },
    {
        "an": "JERUSALEM",
		"ac": 3,
        "la": -1,
        "vg": 1124
    },
    {
        "an": "SHEVA",
		"ac": 4,
        "la": -1,
        "vg": 9817
    },
    {
        "an": "TEL AVIV",
		"ac": 5,
        "la": -1,
        "vg": 399
    }
]

where:

  • an - area name
  • ac - area code
  • la - loacal area
  • vg - voxbone group

3. Request -  download the list of  dids for selected areas/cities


ParameterDescription
dmparameter specifies the name of the method. If you download a list of did numbers for specific area, you must set the value to "getNumbers"
pm

in params you need to pass a JSON object

{
"id":2,
"ac":"212",
"la":3
}

where

id -  id of the country returned in the country list - "id" field.

ac - area code,

la - local area id

--header 'User-Agent: vippie;ios;1.2.3' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic cGlvdHIyOndpZWxraXBpb3Ry' \
--header 'X-VIPPIE-DEVICE-ID: ff66fc693846285d' \
--header 'X-VIPPIE-DEVICE-NAME: iPhone8,1'

Response:


[
    {
        "nbr": "1212666666"
    }
]

4. Request - purchasing a number

Parameter

Description

dm

parameter specifies the name of the method. If you download a list of areas, you must set the value to "buyDid"

pm

in params you need to pass a JSON object

{
 "id": "2",
 "cc": "1",
 "co": "US"
 "ac": "212",
 "la": "3",
 "nbr": "1212666666"
}

where

  • id - id of the country returned in the country list - "id" field.
  • cc - country code
  • co - country returned in the country list - "what" field
  • ac - area code,
  • la - local area id
  • nbr - choosed did number 


--header 'User-Agent: vippie;ios;1.2.3' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic cGlvdHIyOndpZWxraXBpb3Ry' \
--header 'X-VIPPIE-DEVICE-ID: ff66fc693846285d' \
--header 'X-VIPPIE-DEVICE-NAME: iPhone8,1'

Returned value:

{
    "co": "US",
    "pn": "1212666666",
    "ts": "2024-08-05"
}

If an error occurs on the server or any of the parameters contain an incorrect value, the method will return the appropriate 3-digit error code shown below:

Code

Description

400

Incorrect parameters - one of the parameters was not provided

404

Invalid HTTP method - only POST method accepted

422,442

There are no funds in the account to purchase DID

434Subscription purchase. Transaction status invalid (INVALID PURCHASE STATE)
458There was a problem purchasing DID

500

Internal server error

Canceling a number

Parameter

Description

dm

parameter specifies the name of the method. If you retrieve a list of areas, set the value to "cancelDid"

pm

a JSON object containing information about the canceled number and the method of cancellation

{
 "pn": string,
 "cn": bool
}

where:

  • pn - the DID number he has has been canceled.
  • cn - cancel now - when true, the number will be canceled/removed when the method is called, when false - the number will be deleted at the end of the billing period (done by Events Manager)


--header 'User-Agent: vippie;ios;1.2.3' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic cGlvdHIyOndpZWxraXBpb3Ry' \
--header 'X-VIPPIE-DEVICE-ID: ff66fc693846285d' \
--header 'X-VIPPIE-DEVICE-NAME: iPhone8,1'

response 200


If an error occurs on the server or any of the parameters contain an incorrect value, the method will return the appropriate 3-digit error code shown below:

Code

Description

400

Incorrect parameters - one of the parameters was not provided

404

Invalid HTTP method - only POST method accepted

465Voipswitch Services API DID error. Number not deleted

466

Unknown number. (The number does not belong to the client)

500

Internal server error


4. Request - Reading the did list

Parameter

Description

value

dm

parameter specifies the name of the method. Reading the did list "getDids"

getDids


curl --location --request POST 'https://xxxxxxxxxx/emcd/did.ashx?dm=getDids' \
--header 'User-Agent: vippie;ios;1.2.3' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic cGlvdHIyOndpZWxraXBpb3Ry' \
--header 'X-VIPPIE-DEVICE-ID: ff66fc693846285d' \
--header 'X-VIPPIE-DEVICE-NAME: iPhone8,1'

Response:

[{"co":"US","pn":"1212666666","ds":"a","ts":"2024-08-05","dd":null}]

The response is a JSON array.

[
 {
"co": "Country Code",
"pn": "Phone number",
"ds": "Status",
"ts": "Payment day",
"dd": 
}
]
 


status - values c = canceled (end payment = next payment day) | a = active = (next payment < end payment day).


Related content