Firmware OpenWrt, Technical Benefits
Send and Receive SMS on 4G Router SSH Shell
The EZRx3 series 4G routers use QMI protocol by default to establish a 4G connection to the mobile networks. We can use UQMI commands to send and receive an SMS text message on the SSH shell.
1) Please log in to the SSH command-line interface. How to access SSH?
2) Use below UQMI commands to access and control the SMS gateway.
UQMI Command | Function | |
--list-messages: |
List SMS messages | |
--get-message <id>: |
Get SMS raw message contents at index <id> | |
--send-message <data>: |
Send SMS message (use options below) | |
--send-message-smsc <nr>: |
SMSC number (required) | |
--send-message-target <nr>: |
Destination number (required) | |
--send-message-flash: |
Send as Flash SMS |
3) Examples
The virtual modem interface is /cdc-wdm0. So the command always starts with uqmi -d /dev/cdc-wdm0.
i. If need to list the received SMS message, on SSH terminal use the command:
uqmi -d /dev/cdc-wdm0 --list-messages
ii. Use the below command to read one of the messages, for example, read No.2 message.
uqmi -d /dev/cdc-wdm0 --get-message 2
iii. When sending an SMS message, we need to attach the target phone number. Below is an example of sending a message of “Testing” to target mobile phone number “2001111“. Make sure without country code, space, and symbols on the phone number.
uqmi -d /dev/cdc-wdm0 --send-message Testing --send-message-target 2001111
Note: Please ensure your SIM card supports the SMS function. Some of the data-plan SIM cards do not support the SMS function.