> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/troubleshooting/text-replies-not-received.md).

# Text replies don't reach DATRAN

Operators get alarm texts through Datashed, but their replies and queries don't reach DATRAN VI. Check internet access, the port, certificates and the XML Data Interface settings.

These instructions show how to check if an incoming Push SMS connection is working and how to diagnose it. If it worked previously, the answer ends up being that their IT support has reconfigured a router.

{% hint style="info" %}
**Applies to:** DATRAN VI using Datashed in **Push** mode: as soon as a SMS Message is received by Datashed it is immediately sent to Datran. In **Poll** mode, Datran periodically polls Datashed to see if there are any messages for it. Depending on the poll period the messages could be many minutes old. This configuration is outside of the scope of QTech's work.
{% endhint %}

## How replies reach DATRAN

Because an incoming SMS message is an unsolicited message a port needs to be opened on the client's firewall. Their firewall may need to be set up to forward messages from that port to their Datran PC. The **HTTPS Port Number** defaults to 12121.

## Check, in this order

### XDI has no internet access

Before we consider getting messages from Datashed in to XDI we need to ensure XDI has internet access. By default it doesn't! On installation XDI is installed the same as the other services, with a local logon user (DatranService) that will not have internet access. An example of diagnostics if XDI does not have internet access is shown below. This will be seen within 20 seconds of XDI startup:

`XML TCP Module Error: Received WinInet exception: 12030` `XML TCP Module Error: The connection with the server was terminated abnormally`

Fix: it needs to be changed from Control Panel, Services to a domain user that does have access. Once you have changed it to an appropriate user account you will need to log in using that account and set up any proxy information and test that a web browser can retrieve a web page. If the XDI-SMS service is active then in around 10 seconds time, after XDI restart, it will send a request to Datashed. Once successful the following will be seen: `XML TCP Module Success: Sending HTTPS`. Note the success reply code back from Datashed.

### The port isn't open

This is something that we have to do on the Datran PC. There is a free online service that can interrogate external ports on a network. Enter the port number (12121 by default) and run the port probe. If the port is Open all is fine.

### The certificates aren't right

SMS requires two certificates. These reside in the folder as specified in the **SSL Certificate Path** of XDI configuration (with a trailing backslash).

1. **Datashed's root certificate** is a Trusted Root Certificate Authority and has been provided by Datashed. Ensure it is installed by going to the Certificate Repository. This can be run by going to Control Panel, Internet Options, click on the Content tab and click on the Certificates button. Once there select the Trusted Root Certification Authorities tab and you should see Datashed's certificate installed. If it isn't installed then double click on the certificate and click the install button on the displayed dialog. Accept all of the default options over the next couple of dialogs and then the certificate should be installed.
2. **`XML_certificate.cer`**: there are two files associated with this, the other one is `XML_privatekey.pem`. These two files form a pair and must both be present. The important thing is that:

   * the certificate has been signed by Datashed
   * it is linked to the Datashed certificate in the **Certificate Path** tab
   * it hasn't expired.

   To check this certificate is OK double click on it. If there is something wrong with the certificate or the Datashed root certificate then there will either be a yellow triangle with an exclamation mark or a red circle with a cross in it over the top of the certificate icon.
3. The certificate can be tested using a web browser by going to `https://sms.datashed.co.nz/client`. A successful result will display the current time from the Datashed server. It will also show that it is a secured link (padlock, coloured URL etc). It should not ask if you wish to trust this site! If it does then the certificate installation has failed.

The validity of the certificate is not checked on start up of XDI. Therefore if a certificate of the correct name is present everything will work until an incoming message is received, at which point you will start to get errors in the log. When an incoming SMS message arrives the diagnostics show `alert certificate unknown`.

### XDI isn't listening

From a web browser on the Datran PC enter the URL `https://localhost:12121`. This will check the following but can only be performed on the Datran PC. If the configuration is OK you will be prompted by the web browser to accept the certificate. If you do you will see a page that contains the text "The XML Server is running OK". If any of the following XDI configuration is wrong you will get a "The page cannot be displayed" error in the web browser:

* XDI is running and is listening on the correct port – default 12121
* XDI has a valid license
* **SSL Certificate Path** setting in the Network Info tab is correct - i.e. points to a directory that contains a certificate and a private key called `XML_certificate.cer` and `XML_privatekey.pem`
* **SSL Certificate Path** has a trailing backslash
* **HTTPS Port Number** is correct – defaults to 12121
* **HTTPS Port Number** is available for use – i.e. not being used by a different application
* **HTTPS Pool Size** is a value > 0 – we normally have this set to 2.

At this point you should be looking at the diagnostics with the **XML TCP Module Success** and the **XML TCP Module Error** values turned on. Restart XDI and ensure you see a line like `XML TCP Module Success: HTTPS Server listening on port 12121`. This shows that the HTTPS server is running and listening on the specified port. If the HTTPS Pool Size = 0 then this line will not be displayed. If the SSL Certificate Path is incorrect or doesn't have a trailing backslash you will see lots of red text on start up and diagnostics like `XML TCP Module Error: error:02001002:system library:fopen:No such file or directory`.

### The operator isn't recognised

Unless you are configured as an Operator in that Datran's TBD file the reply SMS message will not reach your handset. It will be blocked by Datashed with an error message Invalid Sender Credentials. This means that a message has been generated by Datran and the supplied Datran Operator information does not match that specified in Datashed. See [Set up operators for texts](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/alarms/sms.md#set-up-operators-for-texts).

## Still not working? Contact QTech

The link to the customer's Datran PC can only be checked from Datashed as that is the only place where the SSL connection is valid. Email <techsupport@qtech.co.nz>.
