function telecoms.ddi.check

This function can be used to check whether a phone number is actually in service. It does this by making a very brief test call to that number.

Note: In many cases the call is ended before the remote phone actually rings, but sometimes the user may receive a missed call alert.

See also:

Arguments:

argrequired?syntaxinfo
ddiYTelNumthe phone number to be checked
custIDNposintthe customer account that will be charged for the test call (default is the account of the current API user)
use_cacheNbooleanwhether to use previously cached results for the number being checked, if available (default=1 (true))

Return Values

Other return values for additional information

Note that unless is_range=0 and length_error=0 then no actual test call will be made as it is already known that the number is not valid. Therefore the below values will be null. If however the range and length look valid, then the number will be called in order to gather more detail. The below values will therefore also be set:

Example 1

Check phone number 01174960000.

JSON example request:

POST https://live.apicontrol.co.uk/1/json
{
    "auth" : {
        "username" : "YOURUSERNAME",
        "password" : "YOURPASSWORD",
    },
   "func" : "telecoms.ddi.check",
   "args" : {
     "ddi" : "01174960000"
   }
}

JSON example response:

{
   "success" : 1,
   "results" : {
      "ddi_valid" : 1,
      "is_range" : 1,
      "length_error" : 0,
      "progress_detected" : 1,
      "ringing_detected" : 1,
      "answered" : 0,
      "clearcause" : 16,
      "clearcause_desc" : "Normal call clearing",
      "ttl" : 10367850
   }
}

In the above response, success = 1 which tells us that the API call completed successfully.

Within the results section, we can see:


Example 2

Check phone number 0117496000.

JSON example request:

POST https://live.apicontrol.co.uk/1/json
{
    "auth" : {
        "username" : "YOURUSERNAME",
        "password" : "YOURPASSWORD",
    },
   "func" : "telecoms.ddi.check",
   "args" : {
     "ddi" : "01174960000"
   }
}

JSON example response:

{
   "success" : 1,
   "results" : {
      "ddi_valid" : 0,
      "is_range" : 1,
      "length_error" : -1,
      "progress_detected" : null,
      "ringing_detected" : null,
      "answered" : null,
      "clearcause" : null,
      "clearcause_desc" : null,
      "ddi_allowed" : null
   }
}

In the above response, success = 1 which tells us that the API call completed successfully.

Within the results section, we can see:

The remaining values are null because no test call was attempted. This is because we already know that the number is not valid because it is 1 digit short:


Example 3

Check phone number 011749600000.

JSON example request:

POST https://live.apicontrol.co.uk/1/json
{
    "auth" : {
        "username" : "YOURUSERNAME",
        "password" : "YOURPASSWORD",
    },
   "func" : "telecoms.ddi.check",
   "args" : {
     "ddi" : "011749600000"
   }
}

JSON example response:

{
   "success" : 1,
   "results" : {
      "ddi_valid" : 0,
      "is_range" : 1,
      "length_error" : 1,
      "progress_detected" : null,
      "ringing_detected" : null,
      "answered" : null,
      "clearcause" : null,
      "clearcause_desc" : null,
      "ddi_allowed" : null
   }
}

In the above response, success = 1 which tells us that the API call completed successfully.

Within the results section, we can see:

The remaining values are null because no test call was attempted. This is because we already know that the number is not valid because it is 1 digit too long:


Example 5

Check phone number 01174960022.

JSON example request:

POST https://live.apicontrol.co.uk/1/json
{
    "auth" : {
        "username" : "YOURUSERNAME",
        "password" : "YOURPASSWORD",
    },
   "func" : "telecoms.ddi.check",
   "args" : {
     "ddi" : "01174960022"
   }
}

JSON example response:

{
   "success" : 1,
   "results" : {
      "ddi_valid" : 0,
      "is_range" : 1,
      "length_error" : 0,
      "progress_detected" : 0,
      "ringing_detected" : 0,
      "answered" : 0,
      "clearcause" : 1,
      "clearcause_desc" : "Unallocated number",
      "ttl" : 604800,
      "ddi_allowed" : 1
   }
}

In the above response, success = 1 which tells us that the API call completed successfully.

Within the results section, we can see:

The remaining values are not null, therefore we know that a test call was made:


Example 6

Check phone number 09000129292. This is a premium rate number; by default we don't allow customers to dial premium rate numbers.

JSON example request:

POST https://live.apicontrol.co.uk/1/json
{
    "auth" : {
        "username" : "YOURUSERNAME",
        "password" : "YOURPASSWORD",
    },
   "func" : "telecoms.ddi.check",
   "args" : {
     "ddi" : "09000129292"
   }
}

JSON example response:

{
   "success" : 1,
   "results" : {
      "is_range" : 1,
      "length_error" : 0,
      "ddi_allowed" : 0,
      "ddi_valid" : null,
      "progress_detected" : null,
      "ringing_detected" : null,
      "answered" : null,
      "clearcause" : null,
      "clearcause_desc" : null
   }
}

In the above response, success = 1 which tells us that the API call completed successfully.

Within the results section, we can see:

Because 09000129292 is not a permitted destination number from this API account, no test call was made, therefore all of the remaining values are null. You do however know from the values in is_range and length_error that the number fits within an assigned number range and is of the correct length.