# Understanding Phone Data

## Phone Validation JSON Payload

Below is the explanation for the response of Phone Validation.&#x20;

#### countryCode

Any country code associated with the supplied phone number (e.g. '+61', '+64', '+44').

#### areaCode

Any area code associated with the supplied (non-mobile) phone number (e.g. '02').

#### localNumber

The local part of the supplied number (e.g. '12345678')

#### operatorName

The mobile operator associated with the supplied number (e.g. 'Vodafone Australia')

{% hint style="info" %}

* Phone numbers marked with a 'connected|Network confirmed connection' phoneStatus will display the actual provider name (e.g. 'Vodafone Australia') under the 'operatorName' field.
* Phone numbers marked with a 'disconnected|Network confirmed disconnection' phoneStatus will display 'Unknown' under the 'operatorName' field.
* Phone numbers with an 'indeterminate' status will not display any 'operatorName' in the JSON response.
  {% endhint %}

#### phoneStatus

The current status of the mobile phone with the supplied number (e.g. 'connected|Network confirmed connection', 'disconnected|Network confirmed disconnection', 'indeterminate').

#### exception

An exception message outlining the errors that occurred during validation will be shown for phone numbers with following status.

{% hint style="info" %}

* Phone numbers with 'indeterminate' phone status. (e.g. 'Number prefix missing', 'Network is forbidden', 'Invalid destination address.').
* Phone numbers with the 'connected|Network confirmed connection' status are validated in the default countries 'AU' or 'NZ' but may be validated as another country (e.g., 'Validated as another country - IN'). For further insight into the importance of the default country, please refer the '[Default Country for Phone Validation](https://docs.mastersoftgroup.com/harmony-suite/user-guides/version-3.0.0/prerequisites#id-2.-default-country-for-phone-validation)' section.
  {% endhint %}

JSON Representations for connected, disconnected and indeterminate phone status.

```json
    //connected|Network confirmed connection
    
    {
    "ciqPartyDocument": {
        "pdpchangeContext": {},
        "options": {
            "exposeAttributes": "7"
        },
        "phone": {
            "countryCode": "61",
            "numberType": "61",
            "localNumber": "0412345678",
            "phoneQuality": 7,
            "extraAttributes": {
                "MediaType": "61",
                "phoneStatus": "connected|Network confirmed connection",
                "operatorName": "Vodafone Australia"
            }
        },
        "locationInParties": 0,
        "containedInParties": false
    }
}
    
    
```

```json
//connected|Network confirmed connection validated as another country
{
    "ciqPartyDocument": {
        "pdpchangeContext": {},
        "options": {
            "exposeAttributes": "7"
        },
        "phone": {
            "countryCode": "44",
            "localNumber": "1234567878",
            "phoneQuality": 7,
            "extraAttributes": {
                "exception": "Validated as another country - GB",
                "phoneStatus": "connected|Network confirmed connection",
                "operatorName": "MNO - 3 (Hutchison 3G UK Ltd)"
            }
        },
        "locationInParties": 0,
        "containedInParties": false
    }
}
```

```json
// disconnected|Network confirmed disconnection
{
    "ciqPartyDocument": {
        "pdpchangeContext": {},
        "options": {
            "exposeAttributes": "7"
        },
        "phone": {
            "numberType": "61",
            "localNumber": "0412222222",
            "phoneQuality": 5,
            "extraAttributes": {
                "MediaType": "61",
                "phoneStatus": "disconnected|Network confirmed disconnection",
                "operatorName": "Unknown"
            }
        },
        "locationInParties": 0,
        "containedInParties": false
    }
}
```

```json
// indeterminate
{
    "ciqPartyDocument": {
        "pdpchangeContext": {},
        "options": {
            "exposeAttributes": "7"
        },
        "phone": {
            "localNumber": "441112223333",
            "phoneQuality": 5,
            "extraAttributes": {
                "exception": "Number prefix missing",
                "phoneStatus": "indeterminate"
            }
        },
        "locationInParties": 0,
        "containedInParties": false
    }
}

```

## Understanding Phone Data with Various Samples

**Here is a sample input file that comprises of global numbers across different countries AU, IN, NZ and GB, this file has been processed with default locale as "AUSTRALIA". Please refer** [Alignment of Default Locale and 'hosted.defaultCountry for Phone Validation Users](https://docs.mastersoftgroup.com/harmony-suite/user-guides/version-3.0.0/email-and-phone-validation/..#id-1.-alignment-of-default-locale-and-hosted.defaultcountry-for-phone-validation-users) for locale setup.

<div align="left"><figure><img src="https://2735524619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fhp3nSGDGzW6K0AYaMW45%2Fuploads%2FLxbCwgStx2jWCG95FqSw%2Fimage.png?alt=media&#x26;token=a06c2c2e-17ef-4602-89bb-31d181675f52" alt=""><figcaption></figcaption></figure></div>

**Harmony Batch Output.**

Phone numbers with an Output\_phoneStatus as 'connected' are validated.

Phone numbers with an Output\_phoneStatus as 'disconnected' or 'indeterminate' cannot be validated.&#x20;

* Numbers not presented in international format '+##' (e.g., Records 4 and 7).
* Landline numbers (Record 9).
* Disconnected mobile numbers (Record 10).
* Other invalid data (Record 8).

<figure><img src="https://2735524619-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fhp3nSGDGzW6K0AYaMW45%2Fuploads%2Fgz9FfAJgQadcgNT5CZCz%2Fimage.png?alt=media&#x26;token=a05e68fe-8900-4c78-ab51-0138d560cfa1" alt=""><figcaption></figcaption></figure>

## Understanding Phone Validation Exceptions

**Exception generated when Api credentials for phone are not set as detailed in** [**Phone and Email Access Configuration File.**](https://docs.mastersoftgroup.com/harmony-suite/user-guides/version-3.0.0/prerequisites#id-3.-api-user-and-password-to-access-hosted-phone-api)

```json
{
    "ciqPartyDocument": {
        "pdpchangeContext": {},
        "options": {
            "exposeAttributes": "7"
        },
        "containedInParties": false,
        "locationInParties": 0,
        "phone": {
            "localNumber": "+44 123 456 7865",
            "phoneQuality": 5
        }
    },
    "exceptions": [
        {
            "cause": {
                "cause": {
                    "code": "H143",
                    "category": "PDP",
                    "description": "HostedPhoneValidation - ROAD error: Missing API user or password for hosted phone validation",
                    "message": "H143 : HostedPhoneValidation - ROAD error: Missing API user or password for hosted phone validation",
                    "localizedMessage": "H143 : HostedPhoneValidation - ROAD error: Missing API user or password for hosted phone validation"
                },
                "code": "H143",
                "category": "PDP",
                "description": "HostedPhoneValidation - ROAD error: Missing API user or password for hosted phone validation",
                "message": "H143 : HostedPhoneValidation - ROAD error: Missing API user or password for hosted phone validation",
                "localizedMessage": "H143 : HostedPhoneValidation - ROAD error: Missing API user or password for hosted phone validation"
            },
            "code": "H143",
            "category": "PDP",
            "description": "HostedPhoneValidation - ROAD error: Missing API user or password for hosted phone validation",
            "inputData": "+44 123 456 7865",
            "inputType": "PHONE_DATA",
            "message": "H143 : HostedPhoneValidation - ROAD error: Missing API user or password for hosted phone validation",
            "localizedMessage": "H143 : HostedPhoneValidation - ROAD error: Missing API user or password for hosted phone validation"
        }
    ]
}
```

**Exception generated when global phone validation is not enabled as detailed in** [**Activating Global Phone Validation**](https://docs.mastersoftgroup.com/harmony-suite/user-guides/version-3.0.0/prerequisites#activating-global-phone-validation)

```json
{
    "exceptions": [
        {
            "code": "H112",
            "category": "PARSER",
            "description": "No pattern matched for this input - +44 123 456 7865. Check for punctuation errors, duplicate fields, incorrect input format and incorrect input data.",
            "inputData": "+44 123 456 7865",
            "inputType": "PHONE_DATA",
            "message": "H112 : No pattern matched for this input - 44 744 618 4828. Check for punctuation errors, duplicate fields, incorrect input format and incorrect input data.",
            "localizedMessage": "H112 : No pattern matched for this input - 44 744 618 4828. Check for punctuation errors, duplicate fields, incorrect input format and incorrect input data."
        }
    ]
}
```

##
