Kalkun - How to setup SMS Gateway at home

This is very easy task as you only need small Linux server and GSM terminal or any phone supported by Gammu.

First step

Install your favourite Linux distribution, Gammu and Gammu SMS daemon (gammu-smsd) with all dependencies (using packages or source).

Second step

Connect GSM terminal. I used Netkom MC55i GSM terminal and Serial to USB converter.

You can see below that that I will use /dev/ttyUSB1 device.

$ dmesg
[235112.037113] usb 2-1.2: new full-speed USB device number 23 using ehci_hcd
[235112.130533] pl2303 2-1.2:1.0: pl2303 converter detected
[235112.132486] usb 2-1.2: pl2303 converter now attached to ttyUSB1

Edit /etc/gammurc file:

device = /dev/ttyUSB1
connection = at

Check GSM terminal:

$ gammu --identify
UrzÄ…dzenie          : /dev/ttyUSB1
Manufacturer         : Siemens
Model                : unknown (MC55i)
Firmware             : REVISION 01.003
IMEI                 : 927041032653788
SIM IMSI             : 160071362584927

Third step

Install web server with php support, MySQL database server and Kalkun.

Kalkun installation instructions can be found at github.com/back2arie/Kalkun/wiki.

Final /etc/gammu-smsdrc configuration file should look like this:

device = /dev/ttyUSB1
connection = at

runonreceive = /var/www/kalkun/scripts/daemon.sh
logfile = /var/log/gammu.log
commtimeout = 10
sendtimeout = 20
deliveryreport = log
phoneid = mdsms
transmitformat = auto

# Storage - MySQL
service = SQL
driver = native_mysql
database = kalkun
user = kalkun
password = kalkun_password
pc = localhost

# Storage - Files
# service = FILES
# inboxpath = /home/milosz/sms/inbox/
# outboxpath = /home/milosz/sms/outbox/
# sentsmspath = /home/milosz/sms/sent/
# errorsmspath = /home/milosz/sms/error/
# inboxformat = standard

To start Gammu SMS daemon execute command:

$ gammu-smsd

You can send SMS using console command (if you want to check configuration):

$ gammu-smsd-inject TEXT 555333555 -text "Test message"

Example log output from Gammu SMS daemon :

Thu 2012/07/05 23:44:38 gammu-smsd[19711]: Connected to Database: kalkun on localhost
Thu 2012/07/05 23:44:38 gammu-smsd[19711]: Connected to Database native_mysql: kalkun on localhost
Thu 2012/07/05 23:44:38 gammu-smsd[19711]: Created POSIX RW shared memory at 0x7f781c13b000
Thu 2012/07/05 23:44:38 gammu-smsd[19711]: Starting phone communication...
Thu 2012/07/05 23:45:07 gammu-smsd[19711]: Inserting phone info
Thu 2012/07/05 23:45:40 gammu-smsd[19711]: Read 2 messages
Thu 2012/07/05 23:45:40 gammu-smsd[19721]: Starting run on receive: /var/www/kalkun/scripts/daemon.sh 1
Thu 2012/07/05 23:45:40 gammu-smsd[19711]: Process finished successfully
Thu 2012/07/05 23:45:40 gammu-smsd[19711]: Delivery report: Delivered to +48555666555
Thu 2012/07/05 23:45:40 gammu-smsd[19726]: Starting run on receive: /var/www/kalkun/scripts/daemon.sh
Thu 2012/07/05 23:45:40 gammu-smsd[19711]: Process finished successfully

About Milosz Galazka

Milosz is a Linux Foundation Certified Engineer working for a successful Polish company as a system administrator and a long time supporter of Free Software Foundation and Debian operating system. He is also open for new opportunities and challenges.