SMS Daemon
Posted by chris on Mon 17 Jul 2006 at 06:13
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
[global] port = /dev/ttyS0 model = 6210 initlength = default connection = dlr3p use_locking = no serial_baudrate = 19200 smsc_timeout = 10 [gnokiid] bindir = /usr/local/sbin/ [connect_script] TELEPHONE = 12345678 [disconnect_script] [logging] 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!
/usr/local/lib/smsd/libmysql.so: undefined symbol: DB_ByeCannot load database module mysql in directory /usr/local/lib/smsd!
Any help would be muchly appreciated...
[ Parent | Reply to this comment ]
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 | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
http://smstools.meinemullemaus.de/
It works well with many GSM modems, also some mobile phones are supported. Works nice also on Windows with Cygwin.
[ Parent | Reply to this comment ]
I get an error like this
dlopen error: /usr/lib/smsd/libmysql.so: 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 | Reply to this comment ]
Still can't populate my smsu database from the sms.tables.mysql.sql
Any other way?
[ Parent | Reply to this comment ]
Are you using unstable/sid?
In the BTS I find:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=384162
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 | Reply to this comment ]
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 | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | 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 | Reply to this comment ]