Manual:Tools/Sms
Contents
Summary
Sub-menu: /tool sms
Package: advanced-tools
Standards:
It is possible to connect GSM modem to RouterOS device and use it to send and receive SMS messages. RouterOS lists such modem as serial port that appears in '/port print' listing. GSM standard defines AT commands for sending SMS messages, and defines how messages should be encoded in these commands.
'advanced-tools' package provides command '/tool sms send' that uses standard GSM AT commands to send SMS.
Sending
Command: /tool sms send
Example
/tool sms send usb3 "20000000" \
message="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#\$%^&*(){}[]\"'~"
Send command takes following parameters:
| Parameter | Description |
|---|---|
| port (string) | Name of port from /port list that GSM modem is attached to. |
| dst (string) | Recepient phone number. Allowed characters are "0123456789*#abc". If first character is "+" then phone number type is set to international, otherwise it is set to unknown. |
| channel (integer) | Which modem channel to use for sending. |
| message (string) | Message contents. It is encoded using GSM 7 encoding (UCS2 currently is not supported), so message length is limited to 160 characters (characters ^{}\[]~ |
| smsc (string) | |
| type (string) | If set to class-0, then send class 0 SMS message. It is displayed immedeately and not stored in phone. |
Note: Since V3.23 there is one port per modem, and modem has channels used for commands and data. Channels have numbers 0,1,2, etc. Some modems may have just two channels, some have more. The SMS tool has channel support since v3.28
Receiving
Since v3.24 RouterOS also supports receiving of SMS messages, and can exectue scripts, and even respond to the sender.
Before router can receive SMS relevant configuration is required in general /tool sms menu. Following parameters are configurable:
| Parameter | Description |
|---|---|
| allowed-number (string; Default: "") | Sender number that will be allowed to run commands, must specify country code ie. +371XXXXXXX |
| channel (integer; Default: 0) | Which modem channel to use for receiving. |
| keep-max-sms (integer; Default: 0) | Maximum number of messages that will be saved. If you set this bigger than SIM supports, new messages will not be received!' |
| port (string; Default: (unknown)) | Modem port (modem can be used only by one process "/port> print" ) |
| receive-enabled (yes | no; Default: no) | Must be turned on to receive messages |
| secret (string; Default: "") | the secret password, mandatory |
Inbox
Sub-menu: /tool sms inbox
If you have enabled the reader, you will see incoming messages in this submenu.
Read-only properties:
| Property | Description |
|---|---|
| src (string) | Senders phone number. |
| text (string) | Message body |
| timestamp (time) | Time when message was received |
| type (string) | Message type |