Introduction

SMS Gateway is a gateway that connects computer with a client through SMS, or in general, SMS Gateway can be described as the picture above.


Client does not directly interact with the application / system via the SMS Gateway. While sending the text message (SMS), the most important information needed is the destination number and the message, then that is what is actually processed by the SMS Gateway.
 

Few examples of SMS Gateway application in the academic world today are the announcement for scholarship, test venue, and so on. These announcements are automatically processed by the system in one direction. When the internal information is collected, then the system will write it to the database and then will further be processed by Gammu to be sent to the relevant numbers.
 

The announcements are generally in the form of a spreadsheet file or other formatted files, if the files have not been formatted yet or the files are still in the form of hardcopy, then it still our task to digitalize them, so that they can be read by SMS Sender application. This application does not only read the digital files, but also read information from the (Ubaya Student Affairs) BAAK database.
 

Entities
 

SMS Sender Application
it can be anything as long as it has the ability to write-read the database, and read digital files that have been mentioned above. In this case, the author uses PHP to develop the SMS sender application. Why PHP, because according to the author, the PHP language is more understandable and has many functions even for background process (daemon) although (without web-server), PHP is able. Thereby, according to the author, PHP is the most flexible language for web-based and open source program.
 

Database
it can be anything, as the explanation, Gammu is compatible with the MySQL database, PostgreSQL. It also includes libdbi and is able access many databases such SQLite, Ms.SQL Server, Sybase, Firebird, and etc. The author uses the MySQL database because he is not familiar with the others.


Moreover, the SMS Gateway database that is automatically generated by Gammu contains the SMS applications as on the mobile phone application, such as inbox, outbox, and sent item.
 

 

Gammu
It is a cross-platform application that is used to bridge/communicate the SMS Gateway database with the SMS devices. The Gammu application consists of the daemon that is run under the background. At any time, Gammu will monitor SMS devices and SMS gateway database. When a new SMS enters the SMSdevices, then Gammu will directly send it to the inbox under the SMS gateway database. On the other hand, when the SMS sender application sends the SMS to the outbos under the SMS gateway database, then Gammu will send it to SMS devices and move the SMS to Sent Item on the database.
 

 

SMS Devices
it is an instrument in the form of SMS sender devices such as modem or mobile phone. In order to be used properly, then these devices should meet certain requirements to be integrated with Gammu.
 

Clients
they are students who have received announcements about scholarship, test venue, and so forth. All information sent to the students is processed by the system because it is impossible to manually send SMS to thousands of students.

 

Scope
On the implementation, the author uses:
OS : Ubuntu Lucid 10.04,

MySQL : Ver 14.14 Distrib 5.1.41, for debian-linux-gnu (x86_64) using readline 6.1,

Modem : Wavecom GSM Modem M1306B

    
Installation and Configuration
Gammu is a multi-platform open source, meaning Gammu can be operated on various operating systems. The first thing to do is download the Gammu package from the website http://wammu.eu/download/gammu/ and do the general installation. After the installation completed, attach the modem to the USB port.


The most important thing from Gammu is configuration file, a complete example of configuration file is included on the manual and Gammu Website. There are 2 configuration files for the 2 Gammu sub-applications. Those applications are:

    1. $ gammu

    2. $ gammu-smsd

 

No.1 command is used to manually read and write the modem, while the no.2 command is the background application to monitor the database. No.1 command is not widely used, in this case, the author uses it simply to detect the modem.
 

The configuration file for the no.1 application could be anything, to make it easy, it is named as ./gammurc
 

The contents of the ./gammurc file are:
[gammu]

port = /dev/ttyUSB0

connection = at115200

 

Port: the modem location, connection: determine the desired type of connection. More detail information can be found on the manual or Gammu website.
 

To detect and integrate the modem, the Gammu command is:

 

$ sudo gammu -c ./gammurc identify and it will result:

 

Manufacturer : Wavecom

Model : unknown (MULTIBAND 900E 1800)

Firmware : 641b09gg.Q2403A 1320676 061804 14:38

IMEI : 012345678901234

SIM IMSI : 510015300171610

 

If the aforementioned message has appeared, it means your modem has been integrated with Gammu. In order to run Gammu-smsd that is integrated with monitor database application, we must firstly prepare the Gammu database. Prepare user and database with the specified name, then adjust the structure of existing tables as commanded on http://wammu.eu/docs/manual/smsd/mysql.html

 

On Section [Gammu], we adjust it as commanded on the ./smsdrc file. Section [smsd] is the arrangement of how the background application is operated. Further information can be read on the manual. After the database and configuration files have been adjusted, then run the application using $ gammu-smsd -c ./smsdrc command. In order to send and read the incoming SMS, then the database operation will take over. As an example in sending SMS, the query will be:

INSERT INTO `sms`.`outbox` (`UpdatedInDB`, `InsertIntoDB`, `SendingDateTime`, `Text`, `DestinationNumber`, `Coding`, `UDH`, `Class`, `TextDecoded`, `ID`, `MultiPart`, `RelativeValidity`, `SenderID`, `SendingTimeOut`, `DeliveryReport`, `CreatorID`) VALUES (CURRENT_TIMESTAMP, '0000-00-00 00:00:00', '0000-00-00 00:00:00', NULL, '08199999999999', 'Default_No_Compression', NULL, '-1', 'coba', NULL, 'false', '-1', NULL, '0000-00-00 00:00:00', 'default', '');

Where the `DestinationNumber` is the destined number and `TextDecoded` is the SMS contents.


 

Once the MySQL has been integrated with Gammu structure, then set the configuration file for background application (No.2 application). The file configuration will be named as ./smsdrc, with the commands of:
[gammu]

port = /dev/ttyUSB0

connection = at115200

[smsd]

service = MYSQL #database

logfile = /var/log/smsdlog #letak log file

debuglevel = 1 #level debugging, The higher the level, the deeper it will be

commtimeout = 15

sendtimeout = 15

checksecurity = 0

user = user #user database

password = password #password database

pc = localhost #alamat database

database = sms #nama database

 

To read an incoming SMS, then do the queries:
SELECT * FROM `inbox`

For further integration, such as sending mass SMS, or select incoming SMS, making

SMS autoreply, and even integrating it with existing applications. All are integrated with

the Gammu database, now you can try to be creative with any language applications that

can be used to run the database aims to develop an integrated SMS application.

 

That’s all a brief description about SMS Gateway using Gammu and MySQL.
 

Thank you and Keep Your Creativity Going!

Sources:
http://wammu.eu/gammu/

http://www.mysql.com/

http://www.php.net/

 

Ramadhika A.

UBAYA Management Information Systems Programmer