A Python CLI program that I made a long time ago and recently updated, that allows you to work with SMS received on a 4G Huawei router.
Why ?
As a 4G router takes a SIM card, it have a phone number and then, can be used to send SMS.
The problem with that is that you need to access your Huawei router interface on the internet.
So this app allows you to transfer these received SMS to your phone, or to automatically reply to them.
Credits:
This program uses the Huawei LTE API created by Salamek.
These features are configurable from the config.yaml
file at the root of the project (/src
).
The configuration is defined inside a YAML file, I decided to use that instead of the original .env
file because it's a lot more user-friendly, even if putting a password inside of it is not the best practice, as the network is local,
the risk is minimal, I could add an .env file only for the password later if necessary.
If you really don't want to put your password inside the config file, you can create a config.dev.yaml
next to the original config.yaml
, it will load this one instead of the original one. I added it to the .gitignore
for my own config.
Someone contacted me to add this feature, so it'll be the perfect example of what can be done with it:
The Internet provider that this person uses limits the internet speed after a 20GB daily usage, his provider then sends a message informing him that the connection speed is now limited to 64/64kbps (download/upload), and that if he wants 20 more GBs, he needs to send "NADALJUJ" ("CONTINUE" in Slovene), a great way to do that could be to use the replier system:
So now, if the number +33123456789
sends a message that contains Obvescamo vas, da ste presegli celotno kolicino
at any place inside of it, the router will send NADALJUJ
back.
Of course , multiple repliers can be added, and multiple filters too:
repliers:
- phone_number: "+33123456789"
messages:
- filter: "HI"
reply: "HELLO"
- filter: "HELLO"
reply: "HI"
- phone_number: "+33 9 87 65 43 21" # Supporting spaces
...
Here's an example of a forwarded SMS inside the history, the history can be found inside /logs/history.json
.
Details:
Note: Tested only on a B525s-65a but it should work with the routers listed inside the Huawei API doc.
(Device must support NETWork mode aka. "HiLink" version, it wont work with serial mode)
(probably will work for other Huawei LTE devices too)