SMSD

From GnokiiWiki
(Redirected from Smsd)
Jump to: navigation, search

Contents

Introduction

This is what I used, you may alter according to taste, however some of my instructions are specific to Debian...

Server

You're going to need a computer to run this on, preferably one running the latest stable release of Debian (3.1 at the time of writing) as most of the instructions here will be Debian specific.

This machine doesn't have to be dedicated to being an SMS gateway, nor does it even have to be very powerful. A low-end pentium should suffice. It will, however, require a serial port or usb interface or bluetooth.

Cellphone Interface

We're going to be using SMSD from the gnokii project so you can use pretty much any GSM interface they support, I personally use a Nokia 5110 or 6110 series handset with a Nokia DAU-9P serial cable. A list of devices supported by Gnokii is available here.

You can usually find these items on EBay, the serial cables are better known as the Nokia Data Suite.

Beware of 3rd party no-name cables, they may not work as expected.

Setup

Running the following should install all the required packages and dependencies we'll require for our basic SMS gateway:

apt-get install gnokii-smsd-mysql

We assume you have a running database since you must be geeky to be doing this, if not install package "mysql-server" aswell. Dont forget "bluez-utils" too if your going for bluetooth phone connections instead of serial.

mysql -u root 

Create a database (we'll call ours 'smsgw'):

create database smsgw;

Quit the MySQL client, and run the following to populate the smsgw database with the requisite tables and fields:

mysql -u root smsgw < /usr/share/doc/gnokii-smsd-mysql/sms.tables.mysql.sql

Phones

Now edit /etc/gnokiirc and change the port and model settings to match your setup.

In my case I changed it to work with a bluetooth phone a Nokia 6021. So instead of setting a serial port i changed it to

port = 00:1A:DC:F6:59:B9

To get the mac-address from your phone run

hcitool scan

Which will show you phone around your pc with the correct macs.

Also for my part I had to user a passkey agent as a daemon for my first connection when starting up smsd.

passkey-agent --default 1234

This will allow people to connect to your system with pincode 1234. Once your done with pairing you should kill the passkey-agent again. (only needed once) This passkey-agent does not come default with debian, it has been removed. But it should come as a source file with bluez-utils and is found in /usr/share/doc/bluez-utils/examples. If you run gnome (dont know why as a server) you can try and use bluez-passkey-gnome perhaps.

SMSD

/usr/sbin/smsd -u root -d smsgw -c localhost -m mysql -b IN -f /var/log/smsdaemon.log

The "-b IN" is used to say which type of memory is used for incoming sms. Check the manuals which one you need. Advised is to create a seperate userid/pwd for the database too, but you will manage that if you come so far too.

You should now see that your phone wants to pair over bluetooth. Type in the pincode you used with the passkey-agent. Once done also go to paired devices on the phone and set the value of the paired connection to "doesn't need confirmation to connect" which basicly means that if you reset your phone you dont have to acknowledge again.

Send a text message to the handset connected to the SMS gateway... you should see the SMS notification display on the handset's screen quickly before disappearing as smsd reads and deletes it.

Hit CTRL-C to stop smsd, log back into MySQL (mysql -u root smsgw) and run select * from inbox;, you should see something similiar to the following:

+----+---------------+---------------------+----------------+-------------+-------+-----------+
| id | number        | smsdate             | insertdate     | text        | phone | processed |
+----+---------------+---------------------+----------------+-------------+-------+-----------+
|  1 | +317972123456 | 2005-11-20 16:03:15 | 20071120150343 | Testing 456 |  NULL |         0 |
+----+---------------+---------------------+----------------+-------------+-------+-----------+
1 row in set (0.00 sec)

Of course you can now also send messages via the mysql database by doing an insert into it. Once its send, it will show as processed = 1. (mysql -u root smsgw) and run

insert into outbox (number,text) values('+31972123456', 'Tetsing Testing everyone');

And your first sms message is out of this world towards that +31972123456.

Xpl-Perl

I've written a perl module, so that you can send sms messages via the xpl-sms-send part of XPL-perl based on the SMS::Send module. Here is the Gnokiismsd.pm so you can then use something like:

xpl-sender -m xpl-cmnd -c sendmsg.basic to=+31657123456 body="testing"

See http://wiki.binkey.nl/SMSD for the original version.

Troubleshooting

  • make sure that gnokii can handle your messages, see troubleshooting for details
  • if you have encoding problems in the console check the LANG variable (any UTF-8 locale should work, other locales will work if they can represent your message) and if you're using phpmyadmin double check with a command line client (or your application) as the encoding might be different
  • use the file module (smsd --module file) to isolate database problems
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox