Configuring for incoming SMS commands

The Auto-Response facility (in all console servers with Firmware V3.5.1 and later) monitors nominated ports/ devices / probes/ states for Check Conditions to trigger action sequences. This faq discusses the configuration of your console server so an incoming SMS command message from a nominated caller, will provides the trigger condition for a programmed sequence of trigger actions.
You can only configure an incoming SMS Command as a Check Condition trigger if there is an internal or external USB cellular modem detected, and you have enabled the cellular modem for SMS.
- Select Cellular Modem in the SMS Settings field in the Alerts & Logging: SMTP&SMS menu
Note: Sending or receiving an SMS through a CDMA cellular modem (e.g. when the Opengear is connected to the Verizon network in USA) requires V3.6.0 firmware or later.
In the following example we use Auto-Response to set up an SMS command that on receipt will reboot the console server:
- Create a New Auto-Response and set the general parameters that will be applied to it on the Alerts & Logging: Auto-Response. Name the Auto-Response (e.g. "Remote reboot").
Note: For general info on Auto-Response trigger conditions refer faq409-Auto-Response-Alerts - In the Check Conditions box, click on SMS Command
- You can tell it which Phone Number to accept messages from. Leave blank to accept from any mobile. Mobile number is in international format without +
- Type in a string in Incoming Message Pattern to be matched against incoming SMS message (e.g. "rebootdevice123"). The string can be a PCRE regular expression
Note: With V3.11 or later an admin can configure a single SMS triggered Auto-Response with multiple trusted SMS source phone numbers (comma delimited) so that you don't have to configure a separate Auto-Response for each number.
- Click Save Auto-Response button to save the Check Condition. This must be done before any Trigger Action can be added
- Click on the Custom Script option in the Trigger Action table
- Give the action an Action Name (e.g. "Execute reboot")
- In the Executable field, type in "/sbin/reboot" (without quotes)
- Save New Action
Note: For more general info on the sequence of Trigger Actions that can be initiated in the event of the trigger condition refer Trigger-Action FAQ
Earlier firmware versions - receiving SMS message commands

With firmware earlier than V3.4.1, if your console server has an attached or internal cellular modem, you will be given the option to receive SMS messages and set them up as the trigger to execute a nominated script.
- Check Receive Messages in the SMS via Cellular Modem field in the Alerts & Logging: SMTP&SMS menu. A custom script will be called on receipt of incoming SMS messages (as described below)
- You may need to enter the phone number of the carrier’s SMS Message Centre (only if advised by your carrier or Support)
- If you selected the Receive Messages option, the smstool program is configured to call /etc/config/scripts/sms-event on message receipt. This is a customer written script, which can take actions in response to incoming SMS message content e.g. the script below will cycle an RPC:
port:#!/bin/bash
if [[ "$1" == "RECEIVED" ]]; then
password_set=`grep secretpassword $2`
if [ -n "$password_set" ]; then
/bin/pmport -l port02 -o 1 cycle
fi
fi
This script looks for secretpassword inside the message so it has a modicum of security.
Comments
0 comments
Article is closed for comments.