Jumat, 06 November 2009

sms gateway with gammu on linux

The applications of the SMS gateway can be searched and downloaded from the internet. You would be able to found a number of SMS gateway applications from the various platforms.
One of them that will be discussed in this article is Gammu, As we are going to use Gammu application for sms gateway, because apart from we can download free also it’s easy to configure and can be use in both i.e. Windows and Linux. Another reason is to use Gammu is because MySQL can be used. But here we will discuss that how we can setup SMS gateway using Gammu with Linux.
The mobile phone that succeeded in being tried by me is Nokia 3310 and Siemens C35i using Linux platform.

Before installation is done, first read information repeatedly about Gammu here:
http://www.mwiacek.com/gsm/soft/gammu.html
Have you gathered the information?
OK.
.
Now let’s gather the requirement to develop the SMS Gateway using Gammu.

Download Gammu.

1. gammu.tar.gz
Download the gammu package from: www.mwiacek.com/zips/gsm/gammu/gammu.tar.gz
# wget www.mwiacek.com/zips/gsm/gammu/gammu.tar.gz
2. Web Server (If you have webserver, don’t ignore this, if not yet then you must install first apache, myslq, php)
3. The Nokia mobile phone 3310 or Siemens C35i. For other mobiles phone please read again:

http://www.mwiacek.com/gsm/soft/gammu.html

Gammu supports various types of the mobile phones. How come? look this: Gammu currently supports: majority of Nokia phones from DCT3 generation with Nokia operating system – for example Nokia 3210, 3310, 3315, 3410, 5110, 5130, 6110, 6510, 6610, 7210, 8310
Many AT devices – for example many Siemens, Sony Ericsson, Nokia, Alcatel models, Alcatel from BE5/BF5/BH4 generation – for example 501, 511, 512, also some functions with OBEX and Symbian devices
4. The Serial cable for the mobile phone

If you have successfully downloaded gammu.tar.gz, please extract it:

#tar xvfz gammu.tar.gz
After extracted automatically you will find the folder gammu-1.08.00, now enter into the extracted folder.
#cd gammu-1.08.00
Before installation make a custom read README, INSTALL, etc.
#. /configure
#make
Here must be paid attention by you whether being that error or not if the error occurs that means a significant library mysql you are still being more incomplete, usually an error that appear was found when MySql doesn’t support the gammu. (his installation process repeatedly try to find the mysql library which is needed)
#make shared
#make install
#make installshared
Further it’s necessary for you to upgrade the “library”
# vi/etc/ld.so.conf
Add the library link /usr/local/lib to file ld.so.conf, once you have done upgrade the library:
#/sbin/ldconfig
Note: If you did not find any error to this stage means you have successfully installed the Gammu sms Gateway.
Now tried to enter again into the folder where you extracted gammu.tar.gz and copy the available files in folder /docs/example/config/* here you will find 3 files by the name of gammurc, mysql.sql, smsdrc and gammurc.
Copy the gammurc and smsdrc into the /etc directory
#cp gammurc smsdrc /etc/
Further search edited file like this:
[gammu]
port = /dev/ttyS0 #if you are using COM2 then substitute it with ttyS1
#model = 6110 #model of mobile phone was ignored by you, because it doesn’t need often to mention the phone model.
connection = fbus #With Nokia mobile phone connection should be fbus if you used the Siemens mobile phone then substitute the fbus with at19200
#synchronizetime = yes
#logfile = gammulog
#logformat = textall
#use locking = yes
#gammuloc = locfile
#startinfo = yes
#gammucoding = utf8
#rsslevel = teststable
#usephonedb = yes

If you are still confused, inside the gammurc file it has the guidance available. If you are lazy to edit the file, then you can get the file from www.posmetropadang.com/gammu/gammurc
Now confirm if the data cable and your mobile phone are connected to port COM1 to your computer, if everything is just fine, run the following command.
#gammu –identify
I hope you could see output as being supervised here:
Manufacturer : Nokia
Model : 3310 (NHM-5)
Firmware : 06.33 F (28-11-03)
Hardware : 1012
IMEI : 350835608671298
Original IMEI : 350835608671298
Manufactured : 0802
Product code : 0505201
Simlock 1 : MCC+MNC 00101, opened, user , counter 0
Simlock 2 : GID1 0000, opened, factory, counter 0
Simlock 3 : GID2 0000, opened, factory, counter 0
Simlock 4 : MSIN 0000000001, opened, factory, counter 0
MSID : 830d50880846870ebedd126096
MCU checksum : 9C79
DSP ROM : 6
If you got the connection info like above gammu means Gammu detected your mobile phone and now you can continue to the next step.
Now let’s configure that how all the phone’s SMS’s will be kept by MySQL database to put forward on the webpage using php scripts.
OK further bro… our work has almost finished, possibly have some coffee or cigarettes that could disrupted previously hehe…??
Now try to open the file smsdrc that you copied earlier to directory /etc
#vi /etc/smsdrc
[smsd]
PIN = 1234
logfile = smsdlog
commtimeout = 1
sendtimeout = 10
Search and edit the part that you configured in the mysql database:
# ————————- SETTINGS FOR –smsd MYSQL —————————
user = root
password = password_mysql_user
pc = localhost
database = Database_name
Note: The above lines are to make connection with mysql database.
Now enter to the directory /docs/example/config/ and get the file ‘mysql.Sql’, that is a table structure. Now put this file to the database that we are creating in the MySQL database for SMS gateway.
For sms database
#mysqladmin –u root –p create sms
To create tables for gammu grab the file ‘mysql.sql’
#mysql –u root –p <>
Or it can be easier for you if you make Gammu tables through phpadmin.
http://localhost/phpmyadmin
Once you are finished, you can start the smsd deamon:
#gammu –smsd MYSQL/etc/smsdrc
The Log filename Is “smsdlog”
Press Ctrl+C to stopped the program …
After the issuing above command if output is like above means your SMS gateway is done successfully and you can use it according to your requirements. And all the available sms in your mobile phone will be entered inside the mysql database.
For your further stage is to putting forward your SMS’s to the web which is using php scripts, The required php script can be downloaded from
http://www.syednetworks.com/gammu-sms-gateway.zip
You must edit the SMS database info in the sms.php file.
If all goes well, now you can open the SMS’s through your favorite browser:

http://localhost/sms.php
Now what must be done by you??
The smsd service deamon must be running to grab the SMS’s from the phone and you and you could see on the web.
Create a Gammu startup script.sh and place it in the directory /usr/local/Bin/#cd/usr/local/bin/
#vi gammu.sh
File contents are as follows:
#! /bin/sh
export LANG=da
DK
/usr/local/bin/gam you –smsd MYSQL/etc/smsdrc
After edited that file open /etc/inittab
#vi /etc/inittab
And add the below line in the inittab
GA:345:respawn:/usr/local/bin/gammu.sh
Wow… was long enough also, hmmm hopefully did not have the problem ya… now finished your coffee, until you finished developed the SMS Gateway by using Gammu.
If you are having comments and questions, do not hesitate, just feel free to ask.

sourcecode:http://www.syednetworks.com

0 comments:

Posting Komentar