Live data from Hacker News

Simple Raspberry Pi Powered SMS Gateway

blog.haschek.at

11–20 of 85 posts

Re: Simple Raspberry Pi Powered SMS Gateway

#11
I wrote a similar project this year that runs on my router, in python. I communicates with ModemManager over dbus. I use a Quectel EC25 LTE modem, it forwards incoming SMS to an https webhook as JSON. It listens to http requests to provide an outgoing SMS gateway. It also provides automatic failover for the WAN link, for when Comcast craps out. On another machine I have python script that bridges with prosody, to provide an SMS-XMPP bridge. It works well, receives messages faster than the SMS api services that I have tried, and since it's a real mobile number it works everywhere for 2FA.

ModemManager is great, abstracting away manufacturer specific implementation details. The same script is also working on a Pi connected to The Franklin T9 hotspot that I got for free from T-Mobile, running in QMI mode.

I wish it were easier to bridge voice with asterisk, but from what I have seen it is necessary to run asterisk on the same device and communicate directly with the modem, with modem specific tweaks and custom built modules.

Re: Simple Raspberry Pi Powered SMS Gateway

#12
The article is interesting in general, but this line really needs more than "works like a charm": `usb_modeswitch -W -v 12d1 -p 14fe -K -P 14ac -M "55534243000000000000000000000011060000000000000000000000000000"`

I mean, I believe you, but ... what on earth IS all of that?

Re: Simple Raspberry Pi Powered SMS Gateway

#13

I made something similar a few years back with a Pi 1 and a GSM "hat". It came with a C SDK so I had to write AT commands to communicate directly with the modem and it worked great until I didn't need it anymore. Its purpose was to text me when my power or internet connection went down at home then I could respond with commands such as to shutdown the servers etc. When power/network came back it would text me the new…

> The biggest challenge with the whole setup was finding a SIM from a provider who would let me top it up once per year and maybe send half a dozen texts in that time without deactivating the SIM, for a reasonable price

Good point - so-called "pre-paid" SIMs seem to be hidden subscriptions nowadays. Does anyone have a table of suitable low-usage, long-term SIM vendors?

Re: Simple Raspberry Pi Powered SMS Gateway

#15

The article is interesting in general, but this line really needs more than "works like a charm": `usb_modeswitch -W -v 12d1 -p 14fe -K -P 14ac -M "55534243000000000000000000000011060000000000000000000000000000"` I mean, I believe you, but ... what on earth IS all of that?

Here's what it sounds like. Most of these types of devices (USB/3G) are "multimode" devices. That is, they can act like either USB storage or a USB 3G/4G device. On Windows, that's handy because it can come up as storage and then the end user can install the drivers right from the device, and the drivers then handle the "mode switching" from storage to 3G/4G-device. It's basically a way to bootstrap operation without requiring driver downloads.

This "usb_modeswitch" program handles that for linux. It sniffs the USB traffic and switches the mode to 3G/4G for you. All the crazy args are whatever was in the Windows config file. The -v 12d1 is the "VID" (vendor ID) of the device to sniff traffic for. The -p arg is similar, but the "PID" (product ID). The -P 14ac is the "PID" to switch to to get from storage to 3G/4G device. The -M is the magic payload sent to the device to make it switch.

Re: Simple Raspberry Pi Powered SMS Gateway

#16

I'd love to get a setup like this with voice calls also supported. I'd like to be able to recieve my calls and texts on any device as I can with email/irc/matrix etc

If you don't absolutely need this to originate from a mobile subscription with your name on it, you can for far less money get a DID ("direct inwards dial"; the term colloquially means a virtual mobile number) with any of the numerous VoIP providers out there. Most of them not only provide in- and outbound calls on those DIDs, but also ditto for SMSes. The interface for voice calls is almost exclusively SIP, and for SMSes it's usually an HTTP-based API.

Re: Simple Raspberry Pi Powered SMS Gateway

#17

I'd love to get a setup like this with voice calls also supported. I'd like to be able to recieve my calls and texts on any device as I can with email/irc/matrix etc

If you don't absolutely need this to originate from a mobile subscription with your name on it, you can for far less money get a DID ("direct inwards dial"; the term colloquially means a virtual mobile number) with any of the numerous VoIP providers out there. Most of them not only provide in- and outbound calls on those DIDs, but also ditto for SMSes. The interface for voice calls is almost exclusively SIP, and for…

If you go this route, make sure you absolutely know how to, and that you absolutely lock this down. SIP toll fraud is still a problem and if it happens to you, it can get destructively expensive.

https://www.twilio.com/learn/voice-and-video/toll-fraud

Re: Simple Raspberry Pi Powered SMS Gateway

#18
post #13

I made something similar a few years back with a Pi 1 and a GSM "hat". It came with a C SDK so I had to write AT commands to communicate directly with the modem and it worked great until I didn't need it anymore. Its purpose was to text me when my power or internet connection went down at home then I could respond with commands such as to shutdown the servers etc. When power/network came back it would text me the new…

> The biggest challenge with the whole setup was finding a SIM from a provider who would let me top it up once per year and maybe send half a dozen texts in that time without deactivating the SIM, for a reasonable price Good point - so-called "pre-paid" SIMs seem to be hidden subscriptions nowadays. Does anyone have a table of suitable low-usage, long-term SIM vendors?

Looking at B2B IoT services is one way to find prepaid SIM plans that don't require monthly top-ups, but usually you have to buy 5+ SIMs so it doesn't necessarily fit the single-device use-case...

Re: Simple Raspberry Pi Powered SMS Gateway

#19
post #17

Earlier quoted context omitted.

If you don't absolutely need this to originate from a mobile subscription with your name on it, you can for far less money get a DID ("direct inwards dial"; the term colloquially means a virtual mobile number) with any of the numerous VoIP providers out there. Most of them not only provide in- and outbound calls on those DIDs, but also ditto for SMSes. The interface for voice calls is almost exclusively SIP, and for…

If you go this route, make sure you absolutely know how to, and that you absolutely lock this down. SIP toll fraud is still a problem and if it happens to you, it can get destructively expensive . https://www.twilio.com/learn/voice-and-video/toll-fraud

Common sense obviously applies. With a cell phone, don't call back to unknown numbers ringing once or twice ("wangiri"). With a SIP trunk, don't allow remote anonymous access.

Re: Simple Raspberry Pi Powered SMS Gateway

#20

I made something similar a few years back with a Pi 1 and a GSM "hat". It came with a C SDK so I had to write AT commands to communicate directly with the modem and it worked great until I didn't need it anymore. Its purpose was to text me when my power or internet connection went down at home then I could respond with commands such as to shutdown the servers etc. When power/network came back it would text me the new…

Instead of paying for a separate SIM, I've been piggybacking on the "data only" SIMs that Google Fi let's you add to a normal subscription. No extra per-SIM fees, and you just pay for whatever data it uses at $10/gb.

More details on my modem, monitoring setup, and IPMI backhaul strategy using Wireguard here: http://jsharkey.org/ipmi/

Post reply on HN