Open Source option (Gammu) to connect your Phone
Posted by admin on September 7, 2016
I started this experiment to be able to test the integration of a web based (PHP) application and SMS using a phone connected to machine on which web server is running.
Gammu seems to be a good open source option to setup PC to phone connection. Gammu comes with multiple utilities such as Wammu (which adds UI based interface to this). Since I was looking specifically for SMS based options, there is a utility called gammu-smsd which comes bundled with Gammu which runs as daemon and can be used to integrate incoming and outgoing SMS. It comes with multiple options for integration such as file based integration, SQL (MySQL, PostgreSQL, SOL Lite) based integrations.
While trying Gammu or gammu-smsd one of the first things to so it set up configuration file so that these applications can connect with Phone and if needed DB (which was true in our case). Config file follows ini file pattern and all the options are very well explained at gummu-config , for gammu-smsd config options look at gammu-smsd config. After going through these links I created a simple config file
---------------------------------
[gammu]
device = com3:
connection = at115200
[smsd]
Service = sql
Driver = native_mysql
PIN = 1234
LogFile = c:\syslog
User = root
Password = password
PC = localhost
Database = sms
----------------------------------------
I connected my Nokia 5800 using Bluetooth with my windows based machine. Com3 was the port on which my phone was connected. After setting up the config file I tried the information command from command line and got following output
So that means the connection was established. After this the next step I tried was connecting gammu-smsd. Gammu comes with db schema for creating database so that gammu-smsd can connect with it. The schema is located in source code under folder
Gammu-1.29.0-Windows\Gammu-1.29.0-Windows\share\doc\gammu\examples\sql
I created the db named smsd and imported the tables and ran the command to connect gammu-smsd and got error
I thought I had setup the DB etc correctly but it was somehow looking foe sms database and not smsd (Initially I had set smsd as database name in config file). So it seems there is a bug in version 1.29.0 that it always looks for sms named database. Realizing this I modified the DB name and modified the config file and then the gammu-smsd ran successfully.
It seems that gammu is not able to send SMS using Nokia 5800 Express music since I got following output
Same is reported on Gammu site as well (Nokia 5800). I think I will have to get hold of a supported phone to test outgoing and incoming messages.
Gammu also comes with PHP classe gammu, which has wrapper to send and other functions exposed by gammu which can easily be used to integrate with PHP.
So it seems very much possible to be able to create a web based application that can send SMS using a GSM phone connected via Gammu.