Simple Raspberry Pi Powered SMS Gateway
blog.haschek.at
blog.haschek.at
I mean, I believe you, but ... what on earth IS all of that?
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 <long-string> is the magic payload sent to the device to make it switch.
Only if you have a relatively new or rare modem, you need to find the magic string yourself (or even reverse engineer it from a windows setup), to make it work.
55 53 42 43: "USBC"
00 00 00 00: CBW Tag
00 00 00 00: Transfer length
00 00 00 00: CBW direction, LUN, CBW CB length, CBW Command Block
00 00 00 11: CBW CB(cont.)
06 00 00 00: (same)
00 00 00 00: (same)
00 00 00 00: (same)
00 00 00 : (same)
---
00 00 00 00 11 06: TUR LUN0 RSVD RSVD RSV1 0001 0110
00 00 00 00 00 00: TUR LUN0 RSVD RSVD RSVD 00RS VD00
00 00 00 00 00 00: TUR LUN0 RSVD RSVD RSVD 00RS VD00
00 00: ?
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 address so I wouldnt need an outside service for DDNS.
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?
In the UK at least most providers keep the SIM active if it sees some activity in a given space of time¹ irrespective of top-up activity². So if “low” use stretches as far as one text every month or two maybe just have it send an “I'm still here” message regularly. Also acts as a double-check that not getting alerts means all is OK instead of that the alerting service is broken.
1: the GiffGaff one I used for pure data for a week-and-a-half when my landline was down in2020, shut off after three months and a few nagging texts IIRC
2: though if you don't top-up once per month you usually drop onto the basic tariff, so no more “unlimited texts”, but if you are topping up that infrequently that is probably fine
Search for “US M2M SIM” for more vendors.
More details on my modem, monitoring setup, and IPMI backhaul strategy using Wireguard here: http://jsharkey.org/ipmi/
I can pay my mobile provider an extra £7.50 per month for a "second SIM" to share the allowance from my main SIM (you're effectively paying to rent another number).
It's not a terrible expense, but for something I need to send an SMS maybe 1 per quarter is a little much. I guess if you look at it as a "service" it's not bad, but this was a home thing, nothing critical would be lost if I couldn't get my home IP until I got home. Now I use DDNS using a small piece of Go code I wrote to update the domain on my Digital Ocean account as a form of "free" DDNS, it runs on my router on connect/reboot.
These: https://shop.blues.io/collections/development-kits/products/...
Come with pre paid 10 year internet data plans - but with a 500MB data limit (which you can top up), all for $79 including the hardware and interface board.
In raw bytes, that'd be enough to send 1000 140character SMS messages a day every day for 10 years. Realistically, there's probably a 10x or 100x overhead for the TCP/SSL/transport/application layers, but you'd probably still get al least 10 140byte payloads a day for a decade with one of those.
(Full disclosure, I have no affiliation with Bluers.io, but I did impulse buy one of those when they first appeared on my radar, which is sitting in the huge pile in my Box Of Unstarted Projects And Broken Dreams.)
We had a USB connected 3G dongle as SMS modem for years, every other month someone had to head over to the DC and re-seat the thing. Because it just stopped working. I don't think they're designed to be connected 24/7.
We eventually switched to an Ethernet connected SMS modem. Much more reliable, and it was actually made for production, had a longer antenna you could fix on top of a rack cabinet.
But it was also purchased in Sweden, from a Swedish retailer, so not sure what good this would do you.
A quick google gives me Induo [1] who make industrial 3G modems, with serial connection among others.
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.
As far as plans every major carrier has 4G IoT plans, prepaid or not depending on what you want. Also look into places like Databalaze if you're doing something at scale commercially.
Few years ago I bought the 4G hat from SixFab because it was marketed as being Verizon certified but it never worked. I’ll have to look into things again…
https://openwrt.org/docs/guide-user/advanced/sms-from-shell
no need to install gammu etc
You could look at this implementation: mmsd-tng [1]. It is used to handle MMSes on the PinePhone for instance.
When there's a local power cut, most people switch to using cellular data, overloading the local backhaul. The same problem doesn't affect outbound SMS.
For example "[YOUR-PHONE-NUMBER]@txt.att.net"
https://www.dialmycalls.com/blog/send-text-messages-email-ad...
I have a customer that routinely emails through various carier's SMS gateways, and has reports several times a month that their messages aren't getting through and ask us to verify everything was handed off correctly. It always was handed off good, but their gateway is backlogged or broken for that half day or day.
This echos my direct experience years ago (before I made my own solution similar to this setup).
[0]: https://hackernoon.com/build-an-sms-center-with-python-kanne...
It would be incredibly useful if Apple (or a third party app) gave people a way to POST to some secret URL and have the form data show up as a notification.
I can think of a billion one-off projects that would benefit from this. The smoker/ribs are done, the pool is up to temperature, a post-interview email from that recruiter has finally arrived, etc.
That would take value add away from apple et all.
Install Xorg.
[1]: https://gotify.net/
Notifications from macOS are possible with osascript:
https://github.com/lodestone/ims/blob/4bb2566224af53904c7267...
Or in brief:
osascript -e 'tell application "Messages" to send "Hello World" to buddy "J Appleseed"'I realize this is meant for deployment on a local trusted network, but I still think that’s worth putting somewhere in big bold fonts.
Yet at the same time, if it were common-sense in practice, I probably wouldn't have a job.
In my experience it's very unstable however. Sending and receiving SMS can take anywhere from 5 to 30 seconds, and the modem can't do both at the same time. I tried configuring gammu's timeouts, loop delays and whatnot, but couldn't get something that's reliable enough for production.
Very very strange I'm the author of the article and I created this post and got the first few comments then when I reloaded the page it says you posted it and I can't upvote the post like it was my own.
What gives? Do you work for ycombinator or somehing? Or did you post it shortly before me and the mods combined our posts and attributed it to you?
I see what you did there.
I just read your article, thought it might be of interest to HN and posted the link here.
If you need more SMS, the next cheapest I've used is RedPocket Mobile-- https://www.ebay.com/itm/2-50-Mo-Red-Pocket-Prepaid-Plan-200... - $30/yr for 200 voice/1000 texts/200mb per month on T-Mobile's network.
That's why I wrote the article on how to do it via SMS with a Pi. I tried to send myself notifications from NodeRed
Could you find that source? Curious precisely what part of ToS it violates.