> 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/alarms/sms.md).

# Send alarms by text: Datashed and SMS Direct

How DATRAN VI sends alarm texts through the Datashed gateway or SMS Direct, which settings to use for each setup, and how operators acknowledge alarms.

The DATRAN VI Scada system provides users with two options for SMS messaging – **Datashed** and **SMS Direct**. Depending on the user’s needs and situation, DATRAN services can be configured to use either one or both of these services.

{% hint style="info" %}
**Applies to:** DATRAN VI, from QTech's DATRAN VI SMS Configurations application note. The settings tables come from the SMS Truth Table Test Configurations in that note. For the CM910 modem itself, see [CM910 Cellular Modem](https://help.qtech.co.nz/datran/datran-telemetry/cm910-cellular-modem.md).
{% endhint %}

## Datashed or SMS Direct?

|                             | Datashed                                                                                                                                                                     | SMS Direct                                                                                                                                                                 |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| How it works                | An external, internet-based service. Provides a centralised platform to receive and send text messages. The SMS messages are transferred on a secure HTTPS link to Datashed. | Operated directly by DATRAN using a connected modem. Allows direct messaging from DATRAN to operators using the mobile network.                                            |
| Needs                       | Requires a steady internet connection and access to the Datashed servers. You will need to have an account set up on DataShed: please contact QTech to arrange.              | A CM910 Cellular Modem connected to the DATRAN system, with a SIM. No internet required – the service will operate reliably as long as there is cellular network coverage. |
| Texts come from             | A Shortcode number (a short 4 or 5 digit number)                                                                                                                             | A mobile number (the phone number of the SIM in the SMS Direct Modem)                                                                                                      |
| Delivery tracking           | Datashed tracks delivery of all messages. Stores a history of all of the SMS messages which can be used for diagnostic purposes.                                             | SMS Direct does not.                                                                                                                                                       |
| Text charges                | No service fees for end-users.                                                                                                                                               | Standard SMS messaging fees incurred for end-users.                                                                                                                        |
| Acknowledge alarms by reply | Yes                                                                                                                                                                          | Yes, with SMS Direct Full mode                                                                                                                                             |
| Query and control by text   | Yes                                                                                                                                                                          | Yes, from V6.74                                                                                                                                                            |

Typically, SMSDirect is used as a failover for messaging if the SMS Gateway (DataShed) is not available, or for small systems where it becomes the primary method for sending messages.

## The applications involved

| Application              | What it does                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| XML Data Interface (XDI) | The XML Data Interface (XDI) is the main application for SMS services in DATRAN. All messages are handled by the XDI before being sent to any other relevant applications, including SMS Direct. The XDI application MUST be active in order for any messages to be sent from DATRAN. There are three services handled by the XDI application: the XDI-XML service, the SMS service and the Named Pipe service. The Named Pipe service handles the connection from XDI to other applications and must be active to use SMS Direct at all. |
| SMS Direct               | A service that utilises a modem connected to the DATRAN system to send SMS messages directly to operators through the chosen mobile network. The SMS Direct application manages the state of the SMS Direct service, including which of the two possible licences is applied to the service. SMS Direct can be configured to run as a standalone service (Full), or as a backup for Datashed (Backup).                                                                                                                                    |
| Alarm Service            | The Alarm Service application handles the alarms themselves, including who receives the alarm, when and how the alarms are sent out, and whether the alarms should be acknowledged. In the tables below, the ALM Type column refers to the annunciator set in the escalations folder.                                                                                                                                                                                                                                                     |

![The XML Data Interface, SMS Direct and Alarm Service under Applications in DATRAN Browser](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2FudxiADllrXzTxqONUILF%2Fdatran-browser-applications.png?alt=media)

### Where the settings are

| Setting                                                                | Where                                                                                                                                                                                                 |
| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| XML Service: Active, SMS Service: Active, and their licence keys       | XDI, **License** tab                                                                                                                                                                                  |
| Named Pipe, SMS Direct Backup, HTTPS Port Number, SSL Certificate Path | XDI, **Network Info** tab                                                                                                                                                                             |
| Datashed connection settings (gateway, organisation, polling time)     | XDI, **SMS** tab. The component configuration is normally configured by QTech as part of the commissioning of the SMS Service module as it is mainly configuring the connection settings to Datashed. |
| SMS Direct active state and licence (Security Key)                     | SMS Direct, **State** tab                                                                                                                                                                             |
| SMS Direct runtime mode (Full or Backup)                               | SMS Direct, **General Settings** tab                                                                                                                                                                  |
| Modem type, COM port, port settings, call centre                       | SMS Direct, **Modem Settings** tab. See [Set up and check it is working](https://help.qtech.co.nz/datran/datran-telemetry/cm910-cellular-modem/set-up-and-check.md) on the CM910 pages.               |
| Datashed Connected (1 or 0)                                            | XDI, **SMS Service** node                                                                                                                                                                             |

![The XDI License tab with the XML and SMS services active](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2FuJpQbHt7ua6hOpzkD8Vk%2Fxdi-licence-tab.png?alt=media)

![The XDI Network Info tab with Named Pipe and SMS Direct Backup set to True](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2FQvp2MXcpvAdIlzpkSxWw%2Fxdi-network-info-tab.png?alt=media)

![The SMS Direct General Settings tab with Runtime Mode set to Backup](https://3621580088-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fa5hMAUl7E1cWeN5Rghg0%2Fuploads%2Fq7Hms7xSHq7RjGRm6TN8%2Fsms-direct-runtime-mode.png?alt=media)

Any changes made to the SMS Direct or XDI applications will require the altered application to be restarted in Windows Services. SMS Direct must be restarted via the Windows control panel, not the DATRAN service.

## Recommended setups

| Setup                                                                 | XDI XML service | XDI SMS service | XDI named pipe | XDI SMS Direct backup | SMS Direct mode | SMS Direct licence | Annunciator  | Acknowledge by reply  |
| --------------------------------------------------------------------- | --------------- | --------------- | -------------- | --------------------- | --------------- | ------------------ | ------------ | --------------------- |
| **Datashed with SMS Direct backup** (normal setup when you have both) | True            | True            | True           | True                  | Backup          | XDI-SMS            | SMS Logging  | Yes, through Datashed |
| **Datashed only** (no modem)                                          | False           | True            | True           | True                  | Backup          | XDI-SMS            | SMS Logging  | Yes                   |
| **SMS Direct only**                                                   | True            | False           | True           | False                 | Full            | SMSD               | SMSD Logging | Yes                   |

If XDI can’t complete the SMS Message annunciator, it communicates directly with SMS Direct to send the SMS via the cellular modem to the same operator as the original SMS Message would have gone to. SMS Direct does not poll for responses, including alarm ACKs, while in backup mode.

{% hint style="info" %}
**Emergency fallback.** Configuration 13 is an emergency fallback in case Datashed is not functioning properly and the disconnection script ([manual override](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/alarms/force-sms-direct.md)) is unavailable. By switching SMS Direct to FULL and changing the licence and annunciator to match, messages will bypass Datashed completely and be sent and acknowledged entirely through SMS Direct.
{% endhint %}

### Setups that don't work

| What's wrong                                                                 | Result                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| XDI XML service off, SMS Direct in Full mode                                 | Message not sent. XDI-XML service must be running if SMS Direct is FULL.                                                                                                                                                                                                                                                                                                                                                                               |
| XDI named pipe off                                                           | If the XDI Named Pipe is set to false, the XDI cannot connect to SMS Direct at all. Messages and ACKs will still send fine through Datashed, but SMS Direct will not function regardless of its runtime mode.                                                                                                                                                                                                                                          |
| Datashed disconnected, SMS Direct in Full mode but XDI SMS Direct backup off | Message not sent. Doesn’t send SMS as SMS Direct is not set up for backup mode.                                                                                                                                                                                                                                                                                                                                                                        |
| SMS Direct in Backup mode                                                    | Message sent via SMS Direct. SMS Direct does not poll for responses, including alarm ACKs, while in backup mode.                                                                                                                                                                                                                                                                                                                                       |
| Datashed disabled by hand, SMS Direct Full, annunciator SMS Logging          | Message sent via SMS Direct. Alarms sent using that method will have their IDs removed from the waiting list as soon as they are generated, preventing the alarm from being acknowledged by an operator. ACK responses throw error in DATRAN.                                                                                                                                                                                                          |
| SMS Direct Full, annunciator **SMSD** (not SMSD Logging)                     | Message sent via SMS Direct. Alarm IDs are sent with the alarm messages and ACKs can be sent back to DATRAN, but DATRAN will not send any ACK confirmation message even though the acknowledgement is received and processed properly in DATRAN. In configuration 11 the SMSD alarm type does not include the alarm ID in the message; messages can be acknowledged using the alarm ID viewable in DATRAN, and it should not be used in a live system. |

## Licensing for SMS

| Setup                           | SMS Direct licence (Security Key)                                                                                                                            |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| SMS Direct only                 | SMSD. Configuration 7 behaves the same as configuration 4, but the licence used (XDI-SMS) is inappropriate for the use case.                                 |
| Datashed only                   | XDI-SMS. This is fine if the DATRAN system does not have an attached modem for SMS Direct, in which case the SMS Direct application settings can be ignored. |
| Datashed with SMS Direct backup | XDI-SMS                                                                                                                                                      |

Both the XDI-XML service and the SMS service need to be licenced to send SMS messages from DATRAN, which can be done through the **Licence** tab of the XDI. The State tab is where the SMS Direct licence (Security Key) and active state are set. Either the XML Service licence or a dedicated SMS Direct licence can be used depending on how the service will be used. For how to request and enter keys, see [Licensing](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/licensing.md).

The standard version of SMS Direct is outgoing only. Alarms cannot be acknowledged. SMS Direct Full operates in the same way as SMS Direct Standard, but it also allows incoming messages from the operators to be used by DATRAN to acknowledge alarms, or to query values, manipulate I/O etc.

## Set up operators for texts

Each operator who gets texts needs:

* **SMS Number** provides the cell phone number of the Operator. This must begin with the country code e.g. `6427…` as opposed to `027…`.
* **SMS Password** is a per Operator level password that must match the configuration in Datashed for any messages to be allowed through. It IS case sensitive. It can be made global to all SMS Operators by using a SMS Group. The SMS group is set to 1 (active). When a new operator is created this will default to 0 meaning that the parameters of the group are not used and in this case that operator would not have a password.

The Operators name and SMS Number must also match the configuration in Datashed for any messages to be allowed through. Part of the Datashed configuration includes specifying the valid mobile phone numbers that the SMS Service can communicate with. Therefore if you require any of these to change you will need to contact QTech.

## Acknowledge an alarm by text

* **Through Datashed:** SMS Message alarms are acknowledged by replying to the original alarm SMS message with either a blank message or the word `ACK` (as some cell phones cannot send a blank message).
* **With an alarm ID:** when acknowledging the alarm you need to send an SMS with the text `ACK <alarm Id>`, where you replace `<alarm Id>` with the “Alarm Id” number you received in the alarm SMS. E.g. `ACK6`. Alarm acknowledgement via SMS Direct, and alarm acknowledgement extended beyond 5 simultaneous alarms, are supported.

You can also acknowledge the alarm SMS by just sending a blank reply, but with the limitation of a maximum short code pool of 5 simultaneous alarms. Alarm acknowledgement can exceed the short code pool of 5 if configured to use “Alarm ID”. To configure properly you have to setup the Formats of the messages as follows:

* ALM: `ALM [Alm:{Alarm Id}] {(ALM)LocalTime} {Description}`
* ALM Ack: `ACK [Ack:{Alarm Id}] {(ALM Ack)LocalTime} {Description}`

Please note: you have to define a field `[Alm:{Alarm Id}]` for the alarm and `[Ack:{Alarm Id}]` for the ack notification. Note that there are separate annunciator formats for ALM acknowledgements and RTN (return to normal) messages.

If you want to include an ID number for your alarm - either for informational purposes or to enable you to acknowledge it - you need to use the keyword `ALARMID` somewhere in the message. SMS Direct will replace this with a unique number for this alarm. On receipt of an acknowledgement SMS Direct will acknowledge the alarm and then (by default) send out an ALM Ack message to all operators that had previously been informed of the alarm.

When configuring SMS Direct (in backup mode) for alarm acknowledgement the following settings must be used for the annunciator: **Annunciation Life** = Alarm Instance, **Delete Success** = False, **Delete Error** = False.

## Send a one-off text

* SMS Messages are normally configured as part of an Alarm Escalation sequence however, you can simply add them anywhere within your DATRAN tree and once they are created or reapplied they will send the SMS message. This technique could be used to send SMS messages from a script that is run periodically. This can be achieved by adding an `_SMS_Message_` node into DATRAN and completing the fields in the dialog box.
* Use `_SMSDirect_Message_` when Datashed is down. The SMS Direct service provides the ability to send one off text messages where there is a problem for XDI to connect to Datashed.
* The user can send pager, email and text messages from the Operator List screen and the Duty Operator Select screen via the Page Operator, Text Operator, Page Duty Operator and Text Duty Operator buttons in DATRAN Supervisor.

## Keep a record of texts

* The SMS Account is a method of keeping a running total of the number of incoming and outgoing messages for a specified operator or group of operators. It can be viewed at any time under the SMS Service\Accounts node. The account naming is purely for your own benefit and is not related to the cellular networking or SMS usage billing in any way. The account totals are divided into rolling months so you will always have the last 12 months worth of data.
* A new extended view for SMS Message logging (`vwSMSMessageEx`) in the DATRANDatabase includes both the Operator Name and the Operator Alias.
* The Sent SMS Messages screen in DATRAN Supervisor shows alarms that have been sent to DATASHED and subsequently to the operator cell phones.

## Related

* [Alarm texts aren't arriving](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/troubleshooting/alarm-texts-not-arriving.md)
* [Text replies don't reach DATRAN](https://help.qtech.co.nz/datran/datran-vi-scada/datran-vi/troubleshooting/text-replies-not-received.md)
* [SMS Direct can't initialise the CM910](https://help.qtech.co.nz/datran/datran-telemetry/cm910-cellular-modem/troubleshooting/sms-direct-cannot-initialise.md)
