Search This Blog

Saturday, 22 March 2014

How to : Send SMS using Kannel SMS gateway - configuration , start-up , status check and shutdown procedures

In our previous article , a brief overview of Kannel Gateway architecture and its installation process was given. In this section - we will discuss on basic sample configurations which should be sufficient to connect to a mobile operator SMS center for sending and receiving messages.

Below is a sample configuration file in which parameters are extracted from the default kannel.conf provided in kannel gateway.1.4.3 release to support SMS gateway features. Copy the contents highlighted in blue to a text file under /kannel/cfg/. For example /kannel/cfg/sms1.conf ( Refer our previous article on the installation notes)

group = core
# The below two ports are used for kannel gateway administration.
# The port values should be unique when multiple conf files are created.
admin-port = 10000
smsbox-port = 10001
admin-password = shareolite
log-file = "/kannel/log/bearerbox.log"
# Default log level - enables low level logs also
log-level = 0
box-allow-ip = ""
access-log = "/kannel/test-access.log"

#This is the main group where SMS center details will be configured
group = smsc
smsc = smpp
smsc-id = http
#SMS center TCP port - which mobile operator provides.
port = 4776
#SMS center Host IP - which mobile operator provides
host =
# Mode which indicates whether Transmit & Receive is enabled or only Trasmit
transceiver-mode = 1
system-type = kannel
#SMS center account details - username and password shared by mobile operator
smsc-username = shareo
smsc-password = lite
# Type of Number - Alphanumeric , Numeric etc . Refer manual for details
source-addr-ton = 0
source-addr-npi = 0
dest-addr-ton = 0
dest-addr-npi = 0
keepalive = 600

# This is sendsms process configuration . For kannel gateway management.

# This is used by smsbox process. 
group = smsbox
bearerbox-host = localhost
# This port should be unique when multiple conf files are used.
# This port is used in the HTTP URL application which application calls.
sendsms-port = 10200
global-sender = 6666
log-file = "/kannel/log/smsbox.log"
log-level = 0
access-log = "/kannel/log/access.log"

# This is used for incoming messages from SMS center
group = sms-service
accepted-smsc = http
keyword = default
# When a message is received from SMS center this URL is called. Refer manual for wildcards details.

  • How to start kannel gateway process 

Now that you have installed Kannel gateway under /kannel directory and done with copying the above configuration file , we can start Kannel gateway process by executing below commands in a console

[root@shareolite ~]$ /kannel/bin/bearerbox   /kannel/cfg/sms1.conf &
[root@shareolite ~]$ /kannel/bin/smsbox   /kannel/cfg/sms1.conf &

Check the status of connection and SMPP messages exchanged in kannel logs generated under /kannel/log folder as defined in above configuration.

  • How to check the SMS center connection status

Kannel provides a utility to check the online connection status with SMS center . Execute the below command

[root@shareolite ~]$ GET "http://localhost:10000/status?password=shareolite"

where ,
 10000 -> kannel bearer box admin port
 shareolite -> is the management password defined under admin-password

Sample output as below : 

Kannel bearerbox version `1.4.3'.
Hostname , IP
Libxml version 2.6.26.
Using native malloc.

Status: running, uptime 3d 23h 35m 28s
WDP: received 0 (0 queued), sent 0 (0 queued)

SMS: received 0 (0 queued), sent 3 (0 queued), store size -1
SMS: inbound (0.00,0.00,0.00) msg/sec, outbound (0.17,0.13,0.09) msg/sec

DLR: 0 queued, using internal storage
Box connections:
    smsbox:(none), IP (0 queued), (on-line 3d 23h 35m 26s)

SMSC connections:

    kannel    SMPP: (online 344128s, rcvd 0, sent 3, failed 0, queued 0 msgs)

  • How to stop Kannel gateway process
This can be done in two ways. 

First method is a straight forward method of checking the status of bearerbox and smsbox process , get the process IDs and stop using kill command.

[root@shareolite ~]$ ps -ef|grep box
shareolite      987     1  0 Mar18 ?        00:00:21 /kannel/bin/bearerbox /kannel/cfg/sms1.conf
shareolite      992     1  0 Mar18 ?        00:00:19 /kannel/bin/smsbox /kannel/cfg/sms1.conf

[root@shareolite ~]$ kill -9 987 992

Second method is to use the kannel gateway shutdown command which can be invoked as below

[root@shareolite ~]$ GET "http://localhost:10000/shutdown?password=shareolite"

where ,
 10000 -> kannel bearer box admin port
 shareolite -> is the management password defined under admin-password

Now the main part ,

  • How to send SMS from a application 

To send SMS , kannel gateway smsbox URL has to be used . A sample URL is provided below

[root@shareolite ~]$ GET ""

where ,
10200 is the send sms port defined in configuration file.
user=shareolite&pass=blog - are referred from the sendms-user group configurations
text= is the message content to be sent
to= is the destination mobile number
from= the sender identifier which will be displayed on subscriber handset

Hope this article is helpful to some Kannel gateway beginners and SMPP enthusiasts.


  1. Really so informative post for sms gateway service users as like me. I am a business man using sms gateway for promote my business by a sms service provider site as This information will helpful for me. Thanks for share it.

  2. What a great resource! Thanks so much for creating this!
    Send Bulk SMS Software

  3. The service solves this problem for you. You can connect a mass mailing in instant messengers Viber and Whatsapp and even in Skype. The service is also integrated with the API.

  4. This comment has been removed by the author.