This site is now 100% read-only, and retired.

SMS Daemon

Posted by chris on Mon 17 Jul 2006 at 06:13

Tags: ,

So you've got a webserver and you'd like to be able to send/receive SMS? You've seen adverts that read "Send FOO to to get ..." and would like something similar? With the gnokii package and a supported phone you should be able to do all that and more.

Having found an old mobile lying around I thought I'd give it a go.

First - lets get the packages installed.

root@host:~# aptitude install gnokii-smsd-mysql

This brought in all that was missing. Note that there is also a postgresql version of the package available, called gnokii-smsd-pgsql.

Now - what equipment will you need? Well - a mobile phone and data cable that is supported by gnokii along with a SIM card

I had an old Nokia 6210 and I obtained a DLR-3P cable from a local Nokia franchise. I then got a non-subscription SIM (pay-as-you-go/cash/whatever its called where you are - the one without a monthly fee)

Now all we need to do is get it all to play together

Software setup

Create a database and a user with permissions who can work with it. Grab the SQL from /usr/share/doc/gnokii-smsd-mysql/sms.tables.mysql.sql to create the required tables.

Now - we need to get gnokii configured. There is a sample config in /usr/share/doc/gnokii/examples/gnokiirc.gz which you can copy/extract to $HOME/.gnokiirc as a starting point. I found it quite well documented - and much good info on the gnokii home page particularly the Getting Started link.

Here is what I am now using

port = /dev/ttyS0
model = 6210
initlength = default
connection = dlr3p
use_locking = no
serial_baudrate = 19200
smsc_timeout = 10

bindir = /usr/local/sbin/

TELEPHONE = 12345678

debug = off
rlpdebug = off
xdebug = off

This is basically the example gnokiirc with my port, model and connection and with all comments removed

Now we need to make sure that gnokii can see the phone

gnokii --identify

should be able to identify the phone with some meaningful info (see the getting started page on the gnokii site for more info on this). I spent ages on this - was working fine on my laptop running unstable but - on the server running stable - despite the correct permissions on /dev/ttyS0 (being a member of the dialout group) no dice. Took me ages to recall that the serial port was disabled in the BIOS. So - remember - serial port enabled - rw access (easiest to add your user to the dialout group)

If gnokii cannot identify your phone then you'll have to stop here. Acording to the website "most" Nokia phones are supported, but if you're using something else you're probably out of luck.

Finally - lets start the sms daemon

/usr/sbin/smsd -u dbusr -p dbpass -d dbname -c dbhost -m mysql -f logfile

Incoming SMS will be placed in the inbox table, entries in the outbox table will be sent. For more info see the file /usr/share/doc/gnokii-smsd/README.gz

So - from here - you can now create any script you like to check/update the tables - I'll probably be using perl scripts running from cron from this point in - Good Luck!



Re: SMS Daemon
Posted by Anonymous (220.253.xx.xx) on Thu 27 Jul 2006 at 12:08
When I attempt to use this package i get the following error:

/usr/local/lib/smsd/ undefined symbol: DB_ByeCannot load database module mysql in directory /usr/local/lib/smsd!

Any help would be muchly appreciated...

[ Parent ]

Re: SMS Daemon
Posted by chris (212.17.xx.xx) on Sat 29 Jul 2006 at 09:40
[ View Weblogs ]
The library itself is in /usr/share/smsd/

Now - as to why you get the error I'm not sure. I'm currently sitting on a GPRS connection - so its a little hard to check things. I'll take a look when I get back in august.

[ Parent ]

Re: SMS Daemon
Posted by Anonymous (87.53.xx.xx) on Sat 12 Aug 2006 at 21:23
I get the same error as #1 :-(

[ Parent ]

Re: SMS Daemon
Posted by Anonymous (212.242.xx.xx) on Tue 15 Aug 2006 at 16:02
I get exactly the same error as #1 - a colleague of mine had the same error and decided to compile gnokii and smsd from scratch from the binaries at - I am going to confirm the same.

[ Parent ]

SMS Tools
Posted by thoger (62.168.xx.xx) on Sun 30 Jul 2006 at 16:24
You can also try Stefan Frings' "SMS Server Tools" (smstools Debian package, but not updated for quite some time).

It works well with many GSM modems, also some mobile phones are supported. Works nice also on Windows with Cygwin.

[ Parent ]

Re: SMS Daemon
Posted by Anonymous (80.186.xx.xx) on Fri 25 Aug 2006 at 08:05

I get an error like this

dlopen error: /usr/lib/smsd/ cannot open shared object file: no such file or directory!

and fixed it like this

ln -s /usr/share/smsd /usr/lib/smsd

// Pekka

[ Parent ]

Re: SMS Daemon
Posted by Anonymous (202.33.xx.xx) on Mon 3 Nov 2008 at 03:19
I got here too but it did solve by ln -s /usr/share/smsd /usr/lib/smsd

Still can't populate my smsu database from the sms.tables.mysql.sql

Any other way?

[ Parent ]

Re: SMS Daemon
Posted by chris (217.8.xx.xx) on Fri 25 Aug 2006 at 08:46
[ View Weblogs ]
For those having problems with the linking of the mysql libraries

Are you using unstable/sid?

In the BTS I find:

Raised only a couple of days ago. I guess this could be why I don't see the issue (seems to work fine on my stable box).

[ Parent ]

Re: SMS Daemon
Posted by chris (213.187.xx.xx) on Wed 31 Oct 2007 at 18:57
[ View Weblogs ]
Started reading this article after searching (moving my phone from a sarge box to an etch one).

First thought : Hmm - could be useful

Second thought : Hmm - seems familiar

Third thought : Hang on - I wrote it!

I really ought to do something about my memory :)

[ Parent ]

Re: SMS Daemon
Posted by Steve (82.32.xx.xx) on Wed 31 Oct 2007 at 19:12
[ View Weblogs ]

I've had the same thoughts in the past. Usually as a result of googling for documentation and then ending up reading an article upon this site.


[ Parent ]