Receiving and processing SMS messages through a script?

4

1

I am attempting to setup a system to receive and process SMS messages automatically. The system is intended for use in a context (an unfunded migrant workers' union in India) where both finances and sysadmin skills are extremely constrained (I would be the only person, in the near future, who would be administering the system). The intention is to make some functions - registration of members, generation of ID cards, communication of alerts and other information - easier.

However, for receiving and sending SMS, I have not been able to find any email to SMS or other kind of gateway that functions in India. Perhaps there is one (edit: apparently Clickatell does have an India service, but the prices appear astronomical). If not, can one rely on a USB mobile modem (such as those provided by many mobile providers in India)? It seems like, with utilities such as gammu or bitpim, SMS operations on such a modem could be scripted. Is this actually feasible, though?

Thanks in advance for your thoughts and suggestions.

edit: Original first question removed since the two questions had little to do with each other. The original first question has been asked separately here

ShankarG

Posted 2011-11-23T06:55:59.677

Reputation: 696

I can't answer your questions specifically, but I can tell you that we had a GSM modem (with SIM card) that could receive and send SMSes, which included an SDK for writing our own code. This was in the early 2000s, so I'm sure what you're asking is feasible. I don't recall the manufacturer. – None – 2011-11-23T09:07:58.880

@RandolphWest - Thanks. Was the SDK provided to you with the modem, or were there general tools that allowed you to do this? – ShankarG – 2011-11-23T10:27:05.493

The SDK was provided with the modem. Linker3000's solution looks much more practical. I like the idea of a spooler with text files because it is modular. And text files are scriptable, of course. – None – 2011-11-23T19:25:15.910

Answers

3

The best tool I found for this was an Open Source Package that runs on a Linux server, or Windows with cygwin. Like Randolph, I ran this with (three) serial-connected GSM modems.

http://smstools3.kekekasvi.com/index.php?p=

The SMS Server Tools 3 is a SMS Gateway software which can send and receive short messages through GSM modems and mobile phones.

You can send short messages by simply storing text files into a special spool directory. The program monitors this directory and sends new files automatically. It also stores received short messages into another directory as text files. Binary messages (including Unicode text) are also supported, for example ring tone messages. It's also possible to send a WAP Push message to the WAP / MMS capable mobile phone.

The program can be run as a SMS daemon which can be started automatically when the operating system starts. High availability can be ensured by using multiple GSM devices (currently up to 64, this limit is easily changeable).

The program can run other external programs or scripts after events like reception of a new message, successful sending and also when the program detects a problem. These programs can inspect the related text files and perform automatic actions, for example storing information into a database (for example MySQL or Microsoft SQL Server), sending an automatic reply, forwarding messages via eMail (SMS to eMail gateway), ... and whatever you like.

The SMS Server Tools runs on Microsoft Windows (with CygWin) and any Unix including Solaris, BSD, FreeBSD and GNU/Linux. This software needs a GSM modem (or mobile phone) with SMS command set according to the european specifications GSM 07.05 (=ETSI TS 300 585) and GSM 03.38 (=ETSI TS 100 900). AT command set is supported. Devices can be connected with serial port, infrared, USB or network modems using a socket.

Linker3000

Posted 2011-11-23T06:55:59.677

Reputation: 25 670

Sorry, I've not been on the net since yesterday. This sounds very good. I gather then that you're suggesting I use the physical device model for the actual SMS receiving and sending, though, I'm thinking, I could use an online or hosting service for backup and processing. One other question: the website of SMS Server Tools has not been updated for more than a year. Just wondering what you think: would it be a better idea to use this anyway since it seems so perfect for the job, or would tools like gammu also be appropriate? – ShankarG – 2011-11-24T14:16:30.057

I can only speak from experience with SMS3: it was a very stable and well-supported package and because we were using 3 modems with SIMs on a pay-as-you-go package, we could top up in the UK for £30/month and get 3000 'free' text messages per SIM (We were typically sending about 8000 texts/month as appointment reminders) - in effect making our cost 1p per text, which was much cheaper than using a gateway service which would have cost about 5-6p per text at that time (just over a year ago). Local circumstances might be different for you so it's worth exploring the options and costs. – Linker3000 – 2011-11-24T17:35:44.633

Thanks, that makes a lot of sense. For the moment I'm experimenting with gammu-smsd, since I have a certain wariness of un-maintained packages. But SMS Server Tools looks great - and more capable than gammu - and finally also has a version on the Debian repositories, so that's next on my list.

– ShankarG – 2011-11-25T10:09:05.283

2

Having largely implemented the application now, I can also answer the question :). Both gammu and gnokii are options (the SMS Server Tools are, as said, unmaintained) and their performance with different actual mobiles varies very widely. I had to do testing of five handsets before I found one that works consistently. I now use gammu-smsd, with an sqlite backend, that triggers a bash script to do SMS processing and handle sending of replies. Use and manipulation of the data is through a Python-coded web application.

I find gammu-smsd much more extensive and powerful than the smsd that comes with gnokii; it offers a range of configuration options, which you can find here. It also provides a useful tool called gammu-smsd-inject that makes sending SMS's very easy. Should note that the gnokii folks were also very friendly and helpful. Hope this information helps someone in future.

ShankarG

Posted 2011-11-23T06:55:59.677

Reputation: 696