RPi - SMS to Mail with Raspberry Pi and ZTE MF823 Surfstick
(posted 2019.09.12, last updated 2020.05.21)

Goal

I want my Raspberry Pi Zero W to receive SMS on a spare SIM card / contract / number and send the contents to my mail account. Use case: some web services require your mobile number for registration but I do not like to give them my main number.

Update: Decided to try to use my OpenWRT instead of the Raspberry.

Update2: Fixed some issues with Modem switching from ttyUSB2 to ttyUSB3 and back.

Steps

Setup USB-Surf-Stick ZTE MF823

The Surf-Stick is in network mode by default, in this mode no serial devices ttyUSB are offered (Other Surf-Sticks offer the modem directly by default). Sending/Receiving SMS could be handled using the web interface (as an API), but I would prefer to directly access the modem. The device can be put in modem mode and then gammu can be used to access it. Unfortunately, receiving SMS did not work at first, while sending was working well. Luckily, while experimenting I realized that changing the Preferred Message Storage solved that.

Setup SIM

Setup RPi Software

Alternatively: Setup OpenWRT Software

The issues with ttyUSB lead me back to a RPi configuration...

Update2: Fixed issue with ttyUSB*

The following did not help, still searching for a solution...

Had some issues where the modem switched from ttyUSB2 to ttyUSB3 and thereby gammu loosing connection

Someone had the same problem and I was able to use the solution posted there: (de) https://forum-raspberrypi.de/forum/thread/46635-warum-disconnected-gsm-modem-zte-mit-gammu-gesteuert-alle-2-stunden/

However, I had to adapt the solution, as there is no udev functionality for OpenWRT. Sadly, it is just a hack, as the PRODUCT/VENDOR code is the same for all ttyUSB0,1,2/3 that are created by the stick, so I just hope that either 2 or 3 is the one I want to access....

References

Raspberry Pi - Receive/Send SMS (gammu)

Switch ZTE Surfstick to Modem Mode (instead of Network Mode which offers no serial USB interface)

SMS / CPMS Info

ZTE AT Commands

ZTE use SMS using calls to the URL interface

ZTE + OpenWRT

Gammu + OpenWRT