How to install and configure latest Gammu (1.29) in Ubuntu 10.04

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 :

Check Device Node

Phone registered as ttyACM0 (access it in /dev/ttyACM0)

Save the file. Now, you should test the configuration. Type this command in the terminal:

gammu --identify

if Gammu detect your phone, it should be like the image shown below:

Gammu Identifying Phone

Gammu detects your phone

2. Create new SMSD Configuration file (gammu-smsdrc)

gedit .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).

Gammu Inbox

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 :

  1. Error getting SMS (Unknown error.:27)
    This is Gammu 1.26′s bugs. It’s already fixed in 1.29. Update your Gammu.
  2. 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.
  3. 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
  4. 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.
    Edit Gammu Version
  5. MySQL is Deprecated, bla bla bla..
    You should use ‘service=sql’ and the correct driver ‘driver=native_mysql’ in the Gammu SMSD Config file.

Some notes:

  • 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*

Source : http://pakeklinux.wordpress.com/2011/07/09/how-to-install-and-configure-latest-gammu-1-29-in-ubuntu-10-04/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s