[ Home | Feed | Twitter | Vector Art | Ascii Art | Tutorials ]

GSM SMS Daemon on Debian

Mon, 30 Dec 2013

The gsm-utils package provides a GSM SMS Daemon that can be used to send and receive SMS, on a PC equipped with a GSM modem. The package has a couple of issues and pit-falls that makes installing it non-trivial.

The Debian version that we are working with is Debian Squeeze. The package itself can be installed with apt-get.

$ apt-get install gsm-utils

The GSM SMS daemon will not be started automatically. The daemon has to be configured through /etc/default/gsm-utils, before it can be started. The options are fairly straight forward. A copy of the file is pasted below for reference.

PHONEDEV=/dev/ttyUSB0  # or /dev/ttyS0 or /dev/ircomm0
PIN=""  # or 1234

# RUNGSMSMS: If set to anything other that 'yes', the asterisk init.d script
#              will not run. The default is 'yes'.
# You should probaly also install the crontab from /usr/share/doc/gsm-utils/examples


SUBJECT="SMS delivery report:"

SMSPROCESSOR=""  # or /usr/bin/gsmsmsprocessor

do_accounting () { true; }  # it's your turn

SMS Daemon Fails to Start

The comment in the above config indicates that the RUNGSMSMS has to be set to yes for the deamon to start-up. But even after setting up the variable to yes the SMS daemon fails to start-up.

if [ "$RUNGSMSMS" != "yes" ];then
        echo "GSM SMS deamon not yet configured."
        exit 0

SMS Processor Configuration

Once the SMS daemon is up and running, the next step is to get the daemon to forward the received SMS to another daemon / application for further storage or processing. This is done through the SMSPROCESSOR variable. This variable is passed on the daemon through the -a option.

According to the documentation, the SMS daemon will invoke the specified program, when an SMS is received and will pipe the details of the SMS to its standard input.

One would expect that the any command could be passed here. But what is not mentioned in the docs, or the comments in the config file, is that the command is not invoked through the shell. So for instance you cannot set the variable as

SMSPROCESSOR="cat > /tmp/test.txt"
# or event
SMSPROCESSOR="tee /tmp/test.txt"

Since the programs is not invoked through the shell, the entire string is treated as the programs name, which will result in a command or file not found" error. The best thing to do would be to wrap the program is a shell script and set SMSPROCESSOR to the point to the shell script.

With this in place you should be able to forward received SMS to another daemon / application.

Permalink | Add Comment | Share: Twitter, Facebook, Buzz, ... | Tags: doc, foss

blog comments powered by Disqus

Powered by Python | Made with PyBlosxom | Valid XHTML 1.1 | Best Viewed With Any Browser | Icon Credits | CC-BY-SA