SMSD

From Automated Home

Jump to: navigation, search

be6d836379d4586f9e6fc.txt;120;120

Contents

[edit] 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

[edit] 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.

[edit] 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 similar to the following:

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

Ofcourse 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('+31972343123', 'Tetsing Testing everyone');

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

[edit] 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=+31657773858 body="testing"
Retrieved from "http://wiki.binkey.nl/SMSD"
Personal tools