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.
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:
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.










Hi i wanted to know where i can get the Cable m bus for the communication using Gammu
Well, you should put space between “MYSQL” and “/etc/smsdrc” as mentioned below:
-bash-3.00# gammu --smsd MYSQL /etc/smsdrcLog filename is “smsdlog”
Press Ctrl+C to stop the program …
I suggest you should try
gammu --identifyto check if your phone is identified by gammu or not.Some usefull gammu commands:
# gammu --monitor 1This command will output information about free and occupied space for SMS, number of calendar entries available, your phone’s battery status, GSM network signal strength, SIM card space utilisation (divided in different categories), additional GSM network status, etc. If you change it to gammu –monitor you can get Gammu to monitor the status continuously, until you hit Ctrl-C on your keyboard.# gammu --backup /home/tony/n7110bkp.datBackup your phone’s data to a file called n7110bkp.dat stored in /home/tony. Unless you append the -yes argument you will get prompted with questions about whether to save data in Unicode format, and which information to backup (SMS, address book entries, calendar notes, logos, ringtones, etc.). The input is case-sensitive. Note: I follow the 8.3 filename convention so I can transfer the backup file to any filesystem without any issues.# gammu --restoreInformation about your backed up data will be displayed for you, along with date and time of backup. At the same time, you get prompted about whether and what to restore from a previously backed up file.# gammu --getwapsettings start# stop#On my Nokia 7110i phone, I can use the Internet through a dial-up fax modem and reach WAP pages. This command retrieve the WAP settings stored in your phone. Passwords are passed in cleartext form, so paranoid people should think twice before using this command. However, it’s extremely useful and practical.# gammu --nokiagetadcBattery information for Nokia phones.# gammu --nokiaselftestsCheck the general health and status of a Nokia phone. Very useful for testing the status of a purchased used phone. It might be able to help you determine if you should send the phone to a repair shop.# gammu --reset SOFTReboot your phone’s firmware.# gammu --reset HARDReboot your phone completely, and be prepared to enter a PIN code unless there isn’t one configured.Thanks for making a tutorial. I would like ask how if it is possible to automatically start the SMS daemon of Gammu on startup of my Windows PC. If yes, what are the steps? Thanks!
Jayvee, did you install gammu on windows?
As for as startup concerned simplay create a batch (file.bat) with the put gammu SMS daemon command in it. Then go >> Start >> All programs >> right click on “Startup” here and then open it. Now you can copy your batch file here in startup.
Let me know if it was an answer for your question regarding Gammu SMS daemon on startup.
Thank you very much for your response.Yup, I installed GAMMU on Windows. It was really a big help!
I would like to ask if establishing a remote database connection on a MySQL server deployed using localhost in Gammu (Windows) is possible. If yes, how can i establish such connection?. Thanks!
Just set the host parameter in the gammu configuration file “smsdrc” file to the IP address of the other server. You’ll also need to open the MySQL port (3306) on the other server if it’s closed. Also you would need allow remote user in the MySQL database for remote connection. i hope this helps.
If you need MySQL remote connection allowing command in MySQL please post your details at in “mobile phones” section.
Thank you for always being ready to help others. You’re so great. I will try to contact the webhosting provider of our client and ask the IP address of the server, to open MySQL port 3306 and allow a user to connect remotely. Thanks again!
Thanks for tutorial. I have questions. How make auto sending SMS to our target number, and the content we grab from MySQL database. It’s like service sms on demand, who someone try to request our data from their phone and automatically our database send it. Thanks before
Heya!!
I have connection with my mobile phone with gammu –identify. I get mysql running with my control center and i have a database called “message” with all the tables shown in mysql.sql file from the docs of gammu. But when i have to execute the command
#gammu –smsd MYSQL/etc/smsdrc
i get this error
Unknown service type (“MYSQL”)
Harry, for doing that you will have to create a program using your preferred language, and put some sql queries which will grab the data from the database and will auto send the message against the target number the one you specified.
query example:
select ID,SenderNumber,TextDecoded from inbox where Processed = ? order by IDyou can use Java Mail API for sending SMS to the target number
thanks for your tutorial,
can you give me tutorial about sms autorespond with gammu, i have conection use sony ericsson k608i
Hi,
i have been desperately trying to make gammu work, if i do gammu –identify it does gives the info, but when i try to send sms with #gammu –sendsms TEXT is show error…… Waiting for network answer error 500, could someone pls help me.
Thanks
pls ready the above command as
#gammu –sendsms TEXT CELLNO
Actual Messg
^d
I think I have found the answer. After viewing gammu with textall optionI found that my Nokia 6670 always return my operator SMSC
number as xxxxxxxx while (normally) my S45 return it as +xxxxxxxx.
Since there is no ‘+’ in the number, gammu will set the number format as
GNT_UNKNOWN and then sendsms will always fail with +CMS ERROR: 500 as the
result.
Hope this info will be useful to others
Thanks
It was a contribution for me you save my life.
thanks
It was a gr8 contribution for me, you saved my life
hi this was a big help for my current project.. thanks having gammu! and this turial too.
gammu is run in localhost.. how about database in other computer..???
Randy, ofcourse for that you will have to create sms database on the remote server as following:
If gammu sms database is on Local machine:
#mysqladmin –u root –p create sms
If the gammu sms database is on remote machine: –u root –p create sms
#mysqladmin -h
And for database connection you would need to call database from remote server using it’s IP address on port 3306.
Hope this helps
I would like to ask you for more help on the runonrecieve command in the smsdrc file..
Is there any documentation on this?
I use SE K618i, Ubuntu Linux and LAMPP. Ihave configure gammurc and smsdrc. It works. Gammu has detect my SE K618i. When I use command :
gammu –smsd MYSQL /etc/smsdrc
there is no error found. But my MYSQL table inbox always empty.
Please help me.. thx b4
thnx for the tutorial.. really helpful… do you know how to make a function for send to many using php script…
Great Tutorial,
) ???
but I have the same trouble of Fedlandy (22). I’m using nokia 6680, could you help me
(us
Thanks in advance for your reply
DDF
hi.
My Phone model is Sony Ericsson W580i model…
i am using Gammu 1.28.0……
1)how to install Windows vista…
2)how to configure the Gammu…..
3)how to compile and Recived SMS to be store on Database…
Great Tutorial it’s really interesting
I managed to get gammu work from my Ubuntu command line and then went to install MYSQL and install the PHP script you provided but as I fill in the destination number and message I get the following error..
Error opening device, you don’t have permissions.
Warning: Cannot modify header information – headers already sent in /var/www/send-sms.php on line 36
Any suggestion from where I can set the permissions to access the device?
Thanks
hello frend..
when I’m using Daemon gammu.
this syntax could be:
gammu-smsd -c smsdrc
I can not use the command to send sms gammu because this modem port occupied by the devil jaja…
eg when using these commands:
gammu –identify o enviar sms ej: echo “hola” | gammu sendsms TEXT 156461053
I get this error:Error opening device. Unknown, busy or no permissions.
This means you can receive sms but can not send
The obvious question would be mine. How to use two command at a time?
This is all thanks ..
greetings!
I was reading the examples of intergammu
and I have some doubts before practice
excuse me by my spelling errors i know speak spanish, little english
maybe we could discuss an interesting topic….
when I’m using Daemon gammu.
this syntax could be:
gammu-smsd -c smsdrc
I can’t get to use the command to send sms gammu because this modem port is occupied by the daemon jaja…
eg when using these commands:
gammu –identify or send sms eg: echo “hello test” | gammu sendsms TEXT number
I get this error:Error opening device. Unknown, busy or no permissions.
This means, i can receive sms but can not send.
The obvious question would be mine. How to use two command at a time?
how to send and receive sms linked at mysql whithout daemon perhaps?
¿Can I send and receive sms without a database attached to a deamon??
my mail is: depechemode585@yahoo.com.ar
This is all thanks ..
greetings!
“And for database connection you would need to call database from remote server using it’s IP address on port 3306.”
Hi,my database is other computer (ip. 192.168.1.3) but gammu and the modem in other computer (ip. 192.168.1.2).
May I know what should I write down in “smsdrc” config file for item “pc = localhost”?
Thanks a lot for Your Answer..
i install my gsm modem sucessful,but when i run gammu –smsd MYSQL /etc/smsdrc ,return error message:
Error: SMS daemon is now in separate binary, please use gammu-smsd instead of gammu smsd!
SMS daemon is now in separate binary…..
You are most likely using newer version of gammu. Tru to use older version
mysql smsd works fine for me
but problem is runonreceive
not executing the script
checked permissions and stuff
script itself is just a wget
salam.i’m a beginner.i want to install gammu,but after i dload,it’s quite confusing..may i know how to install gammu on window 7?tq for all the info though…
Hi there… I’m trying to get this to work using a Siemens SX66 that I have. I am running ubuntu, current as of this writing. I installed LAMP stack and that is functioning properly. I installed gammu via apt-get, and it seems to ave installed correctly. But I have a few questions that I have not been able to answer after searching what seems like the only available info on the net for this…
1. Will this phone work? The Siemens SX-66 is an older HTC phone, pocket PC.
2. It is connected via USB, so after running lsusb I get this: Bus 003 Device 002: ID 0bb4:0a05 High Tech Computer Corp. PocketPC Sync
So what do I take from this to modify my gammu config file with?
I think once I confirm whether or not I can use this device, and then if so, get it properly connected via the gammu config file, I can get going then.
Thank you in advance for any replies.
-Tachi
brother … i can run gammu daemon at start computer. i use ubuntu … Thx
still learning
Ace dstarlight
Hi,
I wore se k610i.when run gammu –identify,there are only 5 lines.when starting gammu daemons,response:’unknown service (‘mysql’)…
Please help me..
this is such a nice tutorial,i have configured gammu on my ubuntu server and able to send sms from outbox table,but when i connect my phone sony erricson w610i/w610c with ubuntu then all inbox messages goes unknown and i m not able to store messages to inbox table in mysql.
i want a python script that will read incoming sms and display it on screen
or post it to a localhost site.
please help me.
Hi. Thank you for making this tutorial!
It helps a lot!
I'm just wondering, is it possible to use gammu with vb.net?
i have a problem when type gammu –smsd MYSQL /etc/smsdrc error : Error: SMS daemon is now in separate binary, please use gammu-smsd instead of gammu smsd!
Some body help me! thanks
I am using gammu with java in ubuntu for an autoreplying system.
The incoming process is properly.
for executing the gammu-smsd-inject i am using,
Process p = Runtime.getRuntime().execute("<gammu-smsd-inject-command>");
but the sms is not injected in the outbox and the sentitems table..!!
Please help,
what could be the solution out of this..?
i am hvaing the same problem as above …..when i type in the command
"gammu –smsd MYSQL /etc/smsdrc"
it show the error : Error: SMS daemon is now in separate binary, please use gammu-smsd instead of gammu smsd!
probably this may be problem due to the new version of gammu. So, can you please tell me how to set up the sms gateway on the latest version of gammu(1.27)
great tuto…. thank you!
@ Sidharth
Try this:
Create a new database in mysql.
Open your smsdrc file and set to the following:
[smsd]
service = mysql
PIN = 1234
logfile = smsdlog
commtimeout = 1
sendtimeout = 10
user = root
password =
pc = localhost
database = [insert name of your database here]
——————————
Save it in \Gammu\bin. After that, try running this command on cmd
gammu -smsd -c smsdrc
Note: This command will automatically transfer all your SMS to the database, so don’t be surprised if your inbox becomes empty. lol
hi! very informative tutorial. I am wondering if you could help me. It seems that gammu is not executing my runonreceive script.
Tue 2011/02/22 09:26:50 gammu-smsd[1978]: Starting run on receive: “/path/script.sh” 31
Tue 2011/02/22 09:26:50 gammu-smsd[1556]: Process exited, status=0
Is it possible to use databases other than MYSQL for eg DB2(IBM) ?
pls help…
Yes, it is possible to use other databases. You can use SQL, PSQL, or DBI. Please refer to http://wammu.eu/ for more details.:D
im trying to send long sms, sms is inserted successfully in outbox and outbox_mulipart tables. But gammu failed to send sms. when i check log file, i found following…. please save my life.
Wed 2011/05/25 01:53:50 gammu-smsd[8412]: SMS sent on device: “com44:” status=-1, reference=-1
Wed 2011/05/25 01:53:50 gammu-smsd[8412]: Error getting send status of message: Unknown error. (UNKNOWN[27])
Wed 2011/05/25 01:53:50 gammu-smsd[8412]: Execute SQL: INSERT INTO sentitems (CreatorID,ID,SequencePosition,Status,SendingDateTime, SMSCNumber, TPMR, SenderID,Text,DestinationNumber,Coding,UDH,Class,TextDecoded,InsertIntoDB,RelativeValidity) VALUES (‘Gammu 1.29.0′, ’2′, 1, ‘SendingError’, NOW(), ‘+923330005150′, -1, ‘Nomads-3′, ’002200610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061006100610061′, ’03214656163′, ‘Default_No_Compression’, ’050003BB0201′, -1, ‘\”aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa’, ’2011-05-25 01:53:02′, 255)
sorry am hardly trying to ready and understand Gammu, on my way i saw some script wrote by you i don’t know when but i think you are a right person to whom i can get the answer of this question…..If i developed my website and launched with added functionality of sending and receiving message by using Gammu, so the modem used for connection it will be needed all the time at the pc used for development? SORRY AM THE BEGINNER…I KNOW NOTHING ABOUT GAMMU.plz i need your help!!!
Hello
I am student in Africa and I have a project to give to the school about the instant dissemination of several messages (500) using the interconnected Gammu-maaw gateway to mysql. MySQL is the database which are recorded the names and contacts of the students.
I have there idea of the script to write to instantly send the same message to all the number of students registered in the mysql database. the messages will be sent through a modem GSM (mobile phone).
Help me if you can.
Thank you in advance.
Fred, You can do this through a perl or shell script easily, what you need to do is fetch the each number from the database table with 2 or 3 second wait. You can get store these students numbers in a table’s coulmn and grab them with query and send them through script. You didn’t mention what phone or modem you will be using?
thanks,
I have a serious problem during the sending of the sms command line. I have a samsung galaxy GT-I9000 S1.
I used the command: echo “message”. gammu – sendsms TEXT 7702XXXXX
What to do?