- Published on
- • 3 min read
Kannel Installation and Configuration as SMS Gateway Server
- Authors

- Name
- Shaiju Edakulangara
- @eshaiju
Kannel is an open-source WAP gateway and SMS gateway for GSM networks. Its primary purpose is to link HTTP-based services to various SMS centres using specialised protocols. Kannel is primarily developed for Linux systems and can be ported to other Unix-like systems relatively easily. However, it doesn't yet support other platforms.
Installation
Prerequisites
Before installing Kannel, you'll need to install libxml. Download the source from ftp://gd.tuwien.ac.at/pub/libxml/ and follow these steps:
- Extract the archive to a directory
- Navigate to the extracted directory
- Run the following commands:
./configure
make
make install
Installing Kannel
Download the latest version of Kannel from http://www.kannel.org/download.shtml
Alternatively, use SVN to get the latest version:
svn co https://svn.kannel.org/gateway/trunkExtract the archive and navigate to the directory
Run the installation commands:
./configure --prefix=/usr/local/kannel-1.5.0 --enable-start-stop-daemon --with-mysql
make
make install
Kannel is now installed and ready for configuration.
Configuration
Kannel consists of three programmes, typically run as daemons: bearerbox, wapbox, and smsbox. These implement the connection to the phone (SMS or UDP), the WAP protocol stack, and SMS-based services, respectively.
For an SMS gateway server, we only need bearerbox and smsbox. Bearerbox manages the main queue, whilst smsbox handles the SMSCs.
Create a file named kannel.conf with the following configuration:
#---------------------------------------------
# CORE
#
# There is only one core group and it sets all basic settings of the bearerbox (and system).
group = core
admin-port = 13000
admin-password = passwd##
smsbox-port = 13010
log-file = "/var/log/kannel/kannel.log"
# Log level is DEBUG
log-level = 0
access-log = "/var/log/kannel/access.log"
store-type = spool
# Let no SMS be lost as far as possible
store-location = "/var/spool/kannel"
# Acceptable retries for temporary failures in sending SMS
sms-resend-retry = 3
#---------------------------------------------
# SMSBOX SETUP
#
# Smsbox(es) do higher-level SMS handling after they have been received from SMS centers by bearerbox, or before they are given to bearerbox for delivery
group = smsbox
bearerbox-host = localhost
sendsms-port = 13020
log-file = "/var/log/kannel/smsbox.log"
# Log level is DEBUG
log-level = 0
access-log = "/var/log/kannel/access.log"
#---------------------------------------------
# SEND-SMS USERS
# These users are used when Kannel smsbox sendsms interface is used to send PUSH sms messages
group = sendsms-user
username = tester
password = foobar
concatenation = true
max-messages = 4
#---------------------------------------------
# SMSC CONNECTIONS
# SMSC connections are created in bearerbox and they handle SMSC
# protocol and message relaying.
group = smsc
smsc = smpp
smsc-id = PROMO-SERVICE-MESSAGE
allowed-smsc-id = PROMO-SERVICE-MESSAGE
host = X.X.X.X
port = XXXX
transceiver-mode = true
smsc-username = promouser
smsc-password = promopasswd
source-addr-ton = 0
source-addr-npi = 1
dest-addr-ton = 0
dest-addr-npi = 1
system-type = ""
address-range = ""
Starting Kannel
Start the SMS box and bearer box using:
sudo /usr/local/kannel-1.5.0/sbin/bearerbox /home/shaiju/kannel/kannel.conf
sudo /usr/local/kannel-1.5.0/sbin/smsbox /home/shaiju/kannel/kannel.conf
Note: Start bearerbox first, as smsbox needs to connect to an already running bearerbox instance.
Managing Kannel
To view running processes:
sudo ps -ef | grep kannel
To stop the Kannel service:
/etc/init.d/kannel stop
To view Kannel logs:
tail -f /var/log/kannel/kannel.log
Sending SMS
You can now send SMS messages using the sendsms URL:
http://kannel.machine.ip:13010/cgi-bin/sendsms?username=tester&password=foobar&from=SENDERID&to=9999999999&text=test sms &smsc=PROMO-SERVICE-MESSAGE
Further Reading
For more detailed information, refer to the Kannel User Guide.
For sample configurations, check the official configuration examples.