Getting SMS messages from the Huawei E3372 LTE modem

Posted on Updated on

If you’ve bought a modem from Optus, here in Australia, you may be delighted – and disappointed that the SMSs that are received on the Modem, are now served through a web interface.

I wasn’t happy about this, as I wanted to interrogate the SMS database through the “Mobile Partner” program. So, because Optus have custom firmware it’s basically not possible to do this (Yes, I was on the phone to both parties), it has caused me to look elsewhere. If you wanted to use a custom firmware, go for it, but I couldn’t be bothered.

Specifically, I have an E3372 modem.

I came across this post and information, it got me thinking…

The same hackaround can be used to programatically send SMS from the LAN using the E3372 API, here’s a simple script that does just that:

#!/bin/bash

DATA=`curl http://192.168.8.1/api/webserver/SesTokInfo`
SESSION_ID=`echo "$DATA" | grep "SessionID=" | cut -b 10-147`
TOKEN=`echo "$DATA" | grep "TokInfo" | cut -b 10-41`

curl http://192.168.8.1/api/sms/send-sms -H "Cookie: $SESSION_ID" -H "__RequestVerificationToken: $TOKEN" --data "<?xml version='1.0' encoding='UTF-8'?><request><Index>-1</Index><Phones><Phone>$1</Phone></Phones><Sca></Sca><Content>$2</Content><Length>-1</Length><Reserved>1</Reserved><Date>-1</Date></request>"

Use it like this:

./send_sms.sh +1234567890 "Hello world!"

 

After studying the code a little, I’ve been able to discover that the SMS messages can easily be read from the stick, as XML.

Request URL:http://192.168.8.1/api/sms/sms-list
Request method:POST
Remote address:192.168.8.1:80
What it should do, is return an response of XML eg:
<?xml version="1.0" encoding="utf-8"?>
<response>
<Count>12</Count>
<Messages>
<Message>
<Smstat>1</Smstat>
<Index>40013</Index>
<Phone>OPTUS</Phone>
<Content>An SMS you tried to send or receive has failed as you are out of credit for that message type. Recharge now to allow future SMS messages to be sent or received.</Content>
<Date>2019-02-13 16:04:02</Date>
<Sca></Sca>
<SaveType>4</SaveType>
<Priority>0</Priority>
<SmsType>1</SmsType>
</Message>
<Message>
<Smstat>0</Smstat>
<Index>40011</Index>
<Phone>OPTUS</Phone>
<Content>An SMS you tried to send or receive has failed as you are out of credit for that message type. Recharge now to allow future SMS messages to be sent or received.</Content>
<Date>2019-02-13 16:03:20</Date>
<Sca></Sca>
<SaveType>4</SaveType>
<Priority>0</Priority>
<SmsType>1</SmsType>
</Message>
</Messages>
</Response>

 

This should be enough to get me started, and once again (possibly) start to read SMS messages from my (new) USB Modem.

While I haven’t tried this method fully yet, but in theory this will be completely possible.

This may also remove the need for Gammu as well.

For other valuable information on these devices (which are all very similar)
https://blog.hqcodeshop.fi/archives/259-Huawei-E5186-AJAX-API.html
http://www.gnuton.org/blog/2015/07/huawei-e3372/
http://blog.asiantuntijakaveri.fi/2015/07/convert-huawei-e3372h-153-from.html
https://sh.com.hr/en/modificiranje-huawei-e3372-lte-sticka/

Advertisements

2 thoughts on “Getting SMS messages from the Huawei E3372 LTE modem

    Tim said:
    September 13, 2019 at 10:21 pm

    I recently bought an Optus E3372h-607 for use in a remote monitoring application. Did you ever manage to write a script to read the messages from the stick via the sms-list API call?

      Stephen Monro responded:
      September 13, 2019 at 11:20 pm

      Hi Tim, I didn’t really pursue this too much in the end. Just enough to write a quick blog “discovery” post. It would be very easy to do this with a php script using curl, or something though.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s