Home/Support/Support Forum/How to Send and Receive SMS via WR31
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to Send and Receive SMS via WR31

0 votes
Hi,

I am trying to send and receive SMS to/from a linux PC via the WR31. The PC is connected to the WR31 via Ethernet only, but serial link can also be connected if required.

I have found "sendsms" CLI command and this works fine for sending SMS using an SSH connection from the PC. I see the received SMS messages are shown in the WR31 log file, and I have also stumbled upon "showsms","readsms" and "clearsms" CLI commands. showsms only shows the last SMS received, readsms appears to do nothing, and clearsms appears to clear the SMS that showssms displays.

Questions:
1. Is there any documentation for these SMS related CLI commands? I can find no mention of them in the user guide.
2. What is the best way for the attached PC to read all received SMS from the WR31? Parsing eventlog.txt seems clumsy and error prone.

Thanks.
asked May 14, 2016 in Digi TransPort Cellular by User2204 New to the Community (1 point)

Please log in or register to answer this question.

1 Answer

0 votes
Hi

There are no real documentation in relation to SMS on Transport the main purpose was to provide a was to send commands to the router when IP connection were down.

if you use python there is this library http://www.digi.com/wiki/developer/index.php/Digisms

here is an link to
https://www.digi.com/wiki/developer/index.php/Transport_Python_Programmer's_Guide

here is some sample code that will wait for a sms with some test at that point operates a telemetry card

====================

import sys
import digisms
import time
import sarcli


# here we raise DIO1 for 3 seconds and then drop it.
def telemetry2():
cli1 = sarcli.open()
print "toggling D1 on"
command1 = 'telemetry2 dio -D1 on'
cli1.write(command1)
time.sleep(3)
command2 = 'telemetry2 dio -D1 off'
cli1.write(command2)
print "D1 toggled off"
cli1.close

def smscb(SMSMessage):
print "SMS message received"
print "SMS source: %s" % SMSMessage["source_addr"]
print "SMS message: %s" % SMSMessage["message"]

if(SMSMessage["message"].find("EMERGENCY ALERT") != -1):
print "message contains EMERGENCY ALERT!"
telemetry2()


if __name__ == '__main__':
print "starting"
h = digisms.Callback(smscb)
while 1:
time.sleep(1)

===================

you could setup a tcp server that can send sms and recive them and do something.

if you need any help in this Digi can provide python programing services

regards

James
answered May 16, 2016 by James.Wilson Veteran of the Digi Community (1,225 points)
...