# Introduction

The SMSC service is designed to send SMS messages and Flashcall. The service operates on the basis of the SMPP 3.4 protocol

SMPP protocol requires a client. For the most popular programming languages, there are freely distributed SMPP clients implemented as specialized libraries.

The following sections provide instructions and recommendations for working with SMSC.


# SMPP parameters

Below are the parameters required to connect to the SMSC service. They are provided by Revicom and specified in the SMPP client settings.

| **Parameter**     | **Description**                          |
| ----------------- | ---------------------------------------- |
| **system\_id**    | User name (login) to connect to the SMSC |
| **smsc-password** | Password to connect to the SMSC          |
| **host**          | smpp.revicom.ltd                         |
| **port**          | Port to connect to the SMSC              |

{% hint style="info" %}
**IMPORTANT**:

* recommended transfer rate: no more than 100 PDU/sec;
* maximum response packet wait time (wait time for an ENQUIRE\_LINK\_RESP packet): 30 sec;
* timeout in case of unsuccessful connection: 60 sec;
* the length of the sender ID must not exceed 11 characters;
* the subscriber’s number (destination\_addr) is transmitted in the E.164 format without the “+” at the beginning;
* phone numbers of RF operators must start with the number 7 (for example, 79111234567); never use the character “8” instead of “7” at the beginning of the number.
  {% endhint %}


# Supported connection types

Below are the supported connection types:

* TRANSCEIVER is a universal connection type used both for sending and receiving packets. **It is recommended for use**;
* TRANSMITTER is a connection type used only for sending packets to the server, but not receiving them.
* RECEIVER is a connection type used to receive packets only, but not to send them.

:warning:**IMPORTANT**:

To receive delivery reports, use the TRANSCEIVER connection.


# Supported packet types

SMSC support the below packet types:

* BIND\_TRANSCEIVER;
* BIND\_TRANSMITTER;
* BIND\_RECEIVER;
* UNBIND;
* SUBMIT\_SM;
* DELIVER\_SM;
* ENQUIRE\_LINK;
* QUERY\_SM.


# Encoding setting

Messages sent via the service SMSC may consist of Latin and Cyrillic letters, as well as include special characters (Russian and Latin letters with diacritical marks, letters of the Greek and other alphabets, specific punctuation marks, as well as non-printing characters). When sending messages, it is recommended to use the settings tabled below.

| **Text** | **Data coding** | **Encoding** | **Message length** |
| -------- | --------------- | ------------ | ------------------ |
| Latin    | 0x00            | GSM          | 160 characters     |
| Latin    | 0x01            | US-ASCII     | 160 characters     |
| Latin    | 0x03            | ISO-8859-1   | 160 characters     |
| Cyrillic | 0x08            | UCS-2        | 70 characters      |

:warning:**IMPORTANT**

Be careful about using the following characters in SMS:

£,¥,è,é,ù,ì,ò,Ç,Ø,ø,Å,å,Δ,Φ,Γ,Λ,Ω,Π,Ψ,Σ,Θ,Ξ,Æ,æ,ß,É,¤,¡,Ä,Ö,Ñ,Ü,§ ¿,ä,ö,ñ,ü,à,

NUL,SOH,STX,ETX,EOT,ENQ,ACK,BEL,BS,TAB,VT,SO,SI,DLE,DC1,DC2,DC3,DC4,

NAK,SYN,ETB,CAN,EM,SUB,FS,GS,RS,US,\`,DEL.

**Operators may not support these characters or convert messages to Unicode due to their platform or specification, thereby increasing the number of message parts charged.**


# Concatenated SMS sending

According to the SMPP protocol specification, the maximum length of one SMS to be sent is:

* for messages in Latin: 160 characters;
* for messages in Cyrillic: 70 characters.

SMS exceeding the maximum length are called **multipart or concatenated SMS** and are usually split into parts when sent. The length of one part is:

* for messages in Latin: 153 characters;
* for messages in Cyrillic: 67 characters.

To send concatenated SMS, one of the following three technologies is employed:

* UDH (user data header) is a special header at the beginning of the text of the SMS;
* SAR is analogue of the UDH header; due to the location in TLV fields, it will not reduce the size of one part of an SMS
* message\_payload is TLV field hosting the entire message content

Detailed information about the above technologies can be found in the [SMPP protocol specification.](https://smpp.org/SMPP_v3_4_Issue1_2.pdf)

:warning:**IMPORTANT:**

In each part of a multipart SMS, the values of the following fields must match:

* service\_type;
* source\_addr\_ton;
* source\_addr\_npi;
* source\_addr;
* dest\_addr\_ton;
* dest\_addr\_npi;
* destination\_addr;
* esm\_class;
* protocol\_id;
* priority\_flag;
* validity\_period;
* registered\_delivery;
* data\_coding.

A message cannot be delivered until all of its parts have been received.

The wait time for all parts of a concatenated message is 10 minutes. If all parts are not received after this period, the message will not be sent.


# Tracking SMS delivery statuses

There are two possible options to track the delivery status: active and passive.

The passive option provides for setting the registered\_delivery flag of the SUBMIT\_SM packet. After the message transits to the final state, the server sends the DELIVER\_SM packet with the Delivery\_Receipt message.

To request a delivery report, the SUBMIT\_SM package must have the registered\_delivery=0x01 flag set. In response, the SMSC sends a DELIVER\_SM packet containing the short\_message field with a delivery report.

**Example of a delivery report**

`(deliver: (pdu: 0 5 0 393653) (addr: 1 1 msisdn)  (addr: 5 0 Sender_Name)  (sm: enc: UTF-8 msg: id:616d2dbfde073b06 sub:001 dlvrd:001 submit date:2110181118 done date:2110191118 stat:UNDELIV err:999 text:<r:FINAL>)  (opt: (oct: (tlv: 1059) 03ffff)  (byte: (tlv: 1063) 5)  (str: (tlv: 30) 616d2dbfde073b06) ) )`

The parameters included in the report are described in detail in the table below.

**SMS delivery parameters**

| **Parameter** | **Description**                                                |
| ------------- | -------------------------------------------------------------- |
| id            | message ID                                                     |
| sub           | number of messages sent                                        |
| dlvrd         | number of messages delivered                                   |
| submit date   | message sending time                                           |
| done date     | message finalization time                                      |
| stat          | message status (dlvrd – delivered, or undeliv – not delivered) |
| err           | error code (if any)                                            |
| text          | message status (intermediate or finalized)                     |
| tlv           | additional parameters                                          |

**Description of additional parameters:**                 &#x20;

| Parameter value | Parameter              | Description                                                                                                                                                                 |
| --------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1059            | network\_error\_code   | The network\_error\_code parameter is used to denote the actual network error code for a failed delivery.                                                                   |
| 1063            | message\_state         | SMSC uses this parameter in PDU deliver\_sm and data\_sm to transmit the message final status for SMSC Delivery Receipt. Status descriptions are listed in the table below. |
| 30              | receipted\_message\_id | The receipted\_message\_id parameter denotes ID of the message received in SMSC Delivery Receipt.                                                                           |

**Description of the message\_status values:**

| Code | Message status | Description                                  |
| ---- | -------------- | -------------------------------------------- |
| 1    | ENROUTE        | Message is being sent                        |
| 2    | DELIVERED      | Message is delivered to the recipient        |
| 3    | EXPIRED        | Permitted message sending period has expired |
| 4    | DELETED        | Message has been deleted                     |
| 5    | UNDELIVERABLE  | Message cannot be delivered                  |
| 6    | ACCEPTED       | Message is in the accepted status            |
| 7    | UNKNOWN        | Message is in an unknown status              |
| 8    | REJECTED       | Message is in the rejected status            |

&#x20;

**Receiving multipart messages statuses**

When sending a multipart message, the SMSC immediately returns the delivery status for all parts except the last one. At the same time, in the short\_message field for each of the parts, except for the last one, the following is transmitted:

`text:<r:PROGRESS>`

The actual delivery status of the multipart message is transmitted to the last part received. For this, after short\_message,

`text:<r:FINAL>`

will be transmitted


# Reserved error codes

The error codes that SMSC returns in response to BIND and **SUBMIT\_SM** packets are tabled below.

| **Error code** | **Error message text**      | **Description**                                                             |
| -------------- | --------------------------- | --------------------------------------------------------------------------- |
| 0x00000005     | ЕSME already in bound state | Session with system\_id is deemed active                                    |
| 0x0000000A     | Invalid Source Address      | Invalid sender ID (short number, source address)                            |
| 0x0000000B     | Invalid Dest Addr           | Invalid recepient’s name (MSISDN, dest address)                             |
| 0x0000000D     | Bind failed                 | Selected connection type is no supported, produced BIND packet is incorrect |
| 0x0000000E     | Invalid password            | Invalid password to connect to the SMSC                                     |
| 0x0000000F     | Invalid System ID           | Specified connection parameters are invalid                                 |
| 0x00000500     | Bad character code          | Content contains bad words                                                  |

Below are tabled the error codes that the SMSC returns in response to the **DELIVER\_SM** packet for SMS.

| Error code | Error message text               | Description                                                                                           |
| ---------- | -------------------------------- | ----------------------------------------------------------------------------------------------------- |
| 11         | error-address-format             | Recipient phone number is wrong or not existing                                                       |
| 127        | Timeout of getting status        | Getting message status has expired                                                                    |
| 453        | Block list msisdn                | The message is rejected due to blocklisted msisdn. This error code is also relevant for Flashcall.    |
| 454        | Block list sender                | The message is rejected due to blocklisted sender ID. This error code is also relevant for Flashcall. |
| 455        | -                                | Sending messages in this direction is restricted.                                                     |
| 456        | -                                | The subscriber's phone number does not exist.                                                         |
| 457        | -                                | The sender's ID is not registered.                                                                    |
| 458        | -                                | Traffic is blocked on the platform.                                                                   |
| 501, 1501  | Unknown subscriber               | Phone number does not exist or is not in service                                                      |
| 502, 1502  | SMSC failure                     | Internal routing error on the operator's side                                                         |
| 503, 1503  | Region not supported             | SMS delivery to this region is not available for the operator                                         |
| 504, 1504  | Teleservice not provisioned      | The subscriber's device does not support SMS                                                          |
| 505, 1505  | Call barred service activated    | The subscriber has blocked incoming messages or is restricted by the operator                         |
| 506, 1506  | Illegal subscriber               | The subscriber is blocked by the operator or SMS service is not provided                              |
| 508, 1508  | Absent subscriber                | Subscriber is unavailable (switched off or out of coverage)                                           |
| 509, 1509  | Roaming restrictions             | Subscriber is roaming or lacks roaming agreements                                                     |
| 510, 1510  | Subscriber barred during mnp     | Bank SMS blocked due to recent SIM card change (24-hour restriction)                                  |
| 511, 1511  | Message queue full               | The operator's message queue for the subscriber is full                                               |
| 513, 1513  | Oper invsrcaddr                  | Sender name is blocked by the operator                                                                |
| 515, 1515  | Equipment protocol error         | Subscriber's device cannot receive SMS due to a technical issue                                       |
| 517, 1517  | Memory capacity exceeded         | Subscriber's phone memory is full                                                                     |
| 520, 1520  | Msisdn blacklisted               | The number is blacklisted by the operator                                                             |
| 522, 1522  | Black list                       | Sender name is blacklisted or not allowed for the recipient                                           |
| 523, 1523  | Subscriber is busy               | The subscriber's device is busy and cannot receive SMS                                                |
| 526, 1526  | Unknown equipment                | Device (IMEI) is unknown or not allowed in the network                                                |
| 527, 1527  | SMSC timeout                     | Delivery report not received within the expected time (network/device issue)                          |
| 529, 1529  | Unauthorized subscriber          | Recipient is on an opt-out list                                                                       |
| 532, 1532  | Duplicate error                  | Message blocked as duplicate                                                                          |
| 561, 1561  | Invalid subscriber               | Invalid number format (landline, unsupported numbering, or recent operator change)                    |
| 564, 1564  | Template not allowed             | Message blocked by spam filters (forbidden words or sender restrictions)                              |
| 575, 1575  | Fraud                            | Number blocked due to suspected fraud (auto-unblock in 24h)                                           |
| 601        | Not viber user                   | The recipient is not a Viber user                                                                     |
| 605        | Status error user blocked        | The recipient has blocked notifications                                                               |
| 607        | No suitable device               | The app version does not support service messages                                                     |
| 614        | Error caption too long           | Button caption exceeds the allowed length                                                             |
| 616        | Message limit exceeded           | Maximum allowed messages delivered                                                                    |
| 617        | Not template match               | No matching message template found                                                                    |
| 618        | Filtered                         | Message contains prohibited words                                                                     |
| 621        | Marketing template undeliverable | Marketing message limit reached for the recipient                                                     |
| 644        | Not whatsapp user                | The recipient is not a WhatsApp user                                                                  |
| 662        | User is part of an experiment    | User is in a test group with restricted marketing messages                                            |
| 663        | Message undeliverable            | Generic WhatsApp delivery failure (exact cause unknown)                                               |
| 680        | Session not started              | Template issues: blocked, warned, or mismatched                                                       |
| 681        | Media download error             | Failed to download media from the provided link                                                       |
| 682        | Generic whatsapp error           | Unknown WhatsApp error (no specific details)                                                          |
| 724        | Image is invalid                 | Invalid image or missing text in the message                                                          |
| 733        | Generic MMS error                | General MMS delivery failure (contact support)                                                        |
| 734        | No success status                | MMS center did not return a success status                                                            |
| 735        | Invalid MMS                      | MMS creation failed (invalid content)                                                                 |
| 736        | MMS center error                 | Failed to send request to the MMS center                                                              |
| 737        | File too large                   | File size exceeds the allowed limit                                                                   |
| 738        | Image resolution exceeded        | Image resolution is too high                                                                          |
| 739        | Unsupported file type            | File type is not supported                                                                            |
| 740        | Delivery not confirmed           | No delivery confirmation (device issue or undownloaded MMS)                                           |
| 741        | MMS without image                | Invalid message due to missing image                                                                  |
| 999        | Unknown Error                    | Unknown error                                                                                         |

Below are tabled the error codes the SMSC returns in response to the DELIVER\_SM packet for Flashcall.

| Error code | Error message text       | Description                                                                                     |
| ---------- | ------------------------ | ----------------------------------------------------------------------------------------------- |
| 263        | unknown-error            | Unknown error                                                                                   |
| 265        | invalid-message          | Invalid message                                                                                 |
| 266        | destination-denied       | Destination or operator is not supported                                                        |
| 267        | number-generation-failed | Code transmission number has not been generated                                                 |
| 268        | duplicate                | Message is duplicate (duplicating is sending a message to the same number within a minute)      |
| 269        | sending error            | Request has been received but not sent to the operator due to an unexpected system failure      |
| 270        | rejected                 | Call cannot be made (the phone number is busy with another call, or other SIP-error has arisen) |

Below are tabled the error codes for Telegram Gateway.

| Error code | Error message text           | Description                                                                                                                            |
| ---------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| 1400       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1401       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1402       | phone-number-invalid         | Incorrect phone number                                                                                                                 |
| 1403       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1404       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1405       | ttl-invalid                  | Incorrect TTL value                                                                                                                    |
| 1406       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1407       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1408       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1409       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1410       | gateway-ttl-expired          | The expired status returned in the message delivery report. TTL expired on the Gateway API side, the message was deleted from the chat |
| 1411       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1412       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1413       | flood-wait-retries-exceeded  | Telegram blocked sending after repeated attempts                                                                                       |
| 1414       | submit-retries-exceeded      | Telegram did not respond to the request after repeated attempts                                                                        |
| 1415       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1416       | authorization-code-not-found | The code was not found in the message text                                                                                             |
| 1417       | gateway-error                | Temporary difficulties in delivery on the Telegram side                                                                                |
| 1418       | phone-number-not-available   | Unavailable phone number                                                                                                               |


