I bought the Portech MV-372 to place free calls to both my and my wife’s mobile phones. Despite some minor hiccups (like the web server not being 100% of the time available or stuff like that) it’s been working fine.
One of the first things I wanted to do was having my twilio number forward text messages (SMS) to my mobile phone… but using the Portech (so that they’re free). The problem with that is that the Portech uses AT Commands that are really something to deal with.
You need to open a telnet connection to the device and then issue the commands required to either verify if there are new text messages or send a new one… there’s no way to tell that an SMS arrived to the Portech other than by polling.
Oh, and I forgot… you can only have one concurrent telnet connection open… and that’s not all… while there’s a connection established, you can’t place new calls. That’s a lovely scenario to work on, right?
- Have a RESTful service that let me send and receive texts
- Have a RESTful service that lets me ask my carrier how much credit I have on my SIMs
I have recently started playing with python… so this is a perfect fit for my ODROID… connect once a minute to check if there were new texts to process and send the ones that were on the queue.
For the second goal my carrier (antel) exposes this through the SIM Applications… that means I had to dig into the STK AT Commands as well. The bright side is that once I select the appropriate option, what I get is just a regular text saying how much credit I have.
After just four days (what made me fall in love with python) I had something that worked. A bridge between the AT Commands and the beautiful REST world… I set up my logic on my windows server and have the bridge running locally on my odroid.
You can find the project on github. There are lots of things to do, but it gets the job done. Basically, when it’s running behind nginx, it exposes a service for you to send texts and when a new text arrives it does a RESTful request to a url specified on
config.py. In order to see which requests it does and what it expects, you should dig into the code… so it’s not exactly ready for production but it has been pretty stable at home.
The setup is pretty raw right now, just an sql script for the database and the only documentation is on the code… but if there’s people interested on it, I could see myself making it more user friendly ;)
If you happen to use it and have something to contribute, feel free to send pull requests.