I think you already know (enough) about Gammu, so I won’t tell a lot about it. Gammu is a software which has some abilities to control your phone through computer. It provides some useful functions for handling Message. That’s why it widely used and well-known as the backend for simple SMS Gateway System.
Few weeks ago, I got a project to build a LAN Monitoring System. The system is really simple, it’s do an automatic check for LAN and then send SMS notification if there any problem occurs. It combines Gammu (for SMS backend), MySQL (for data storage), and PHP (as the frontend of the System).
It’s easy to install and configure Gammu under my development environment. I use standar Ubuntu 10.04, with the default installed kernel, 2.6.32 and MySQL as Backend for data storage. *You need Apache PHP MySQL on your development environment.
Okay, no more talks, let’s do it !!
Install Latest Stable Version of Gammu
1. Add Gammu’s Official PPA
sudo add-apt-repository ppa:nijel/ppa sudo apt-get update
2. Install Latest Gammu
sudo apt-get install gammu gammu-smsd libgammu7 libgsmsd7
Configure Gammu 1.29
In this tutorial, I use Sony Ericsson w660i (k530i mods) which is connected to computer through an USB Cable. You can use any kind of phone or modem, as long as it supported by Gammu.
1. Create new Gammu Configuration file (gammurc)
cd ~ gedit .gammurc
add the following configurations:
[gammu] device = /dev/ttyACM0 connection = at115200
Parameters value may different for each computer, phone model, and connection type. Check your device node by seeing it in dmesg log (After plugging in your phone type dmesg in terminal). Maybe it shown something like this :
Save the file. Now, you should test the configuration. Type this command in the terminal:
if Gammu detect your phone, it should be like the image shown below:
2. Create new SMSD Configuration file (gammu-smsdrc)
Add these parameters:
[gammu] device = /dev/ttyACM0 connection = at115200 [smsd] service = sql driver = native_mysql LogFile = syslog user = root #mysql user password = root #mysql password pc = localhost database = smsd #database name
You can use any DB Server you desired. We need to create some tables that are required by Gammu Service. Simply run this MySQL.Gammu.tables on your database (check this link for original one). Now you can test your configuration by running this command :
gammu-smsd -c .gammu-smsdrc
It will show nothing if your configuration is correct. Check if your inbox already moved into database by opening table ‘inbox’ (in the database you use).
Sometimes you may got errors after running gammu-smsd command. Gammu-smsd will tell you the detail, so you can fix it easily. These are errors I got while trying to setup Gammu :
- Error getting SMS (Unknown error.:27)
This is Gammu 1.26’s bugs. It’s already fixed in 1.29. Update your Gammu.
- Version of installed libGammu.so (1.26.1) is different to version of Gammu (1.29.0)
You forget to update the following packages : gammu-smsd libgammu7 libgsmsd7
Remember to update those packages too each time you update your Gammu.
- unknown smsd service type: “sql”
Gammu 1.26 doesn’t recognized service type “sql”. So update your Gammu to 1.29 to fix this problem
- DataBase structures are from higher Gammu version
This mean, the version of the Gammu is not compatible with current gammu database structure. Increase/ Decrease the value of field ‘version‘ in the ‘gammu‘ table. You may use phpMyAdmin or (mysql command prompt) to do it.
- MySQL is Deprecated, bla bla bla..
You should use ‘service=sql’ and the correct driver ‘driver=native_mysql’ in the Gammu SMSD Config file.
- After running gammu SMS Daemon, your phone inbox will be moved (‘backed up’) into MySQL Database (inbox table) automatically. Your phone inbox may empty.
- Your phone may still can be used as normal phone while Gammu SMS Daemon running, but it really freakin slow! *in my case*