Rails Kitchen

It's a place to write on stuff I learned recently.

Kannel Installation and Configuration as SMS Gateway Server

| Comments

Kannel is an open source WAP gateway and  SMS gateway for GSM networks.  The main use for Kannel is to link HTTP based services to various SMS centers using obscure protocols.Kannel is mainly being developed on Linux systems, and should be fairly easy to port to other Unix-like systems. However, kannel don’t yet support other platforms.

Kannel Installation and Configuration as SMS gateway Server
Installation
1 Before installing kannel you will need to install libxml. Download the source and follow the next steps for installation.We can download it from following link. ftp://gd.tuwien.ac.at/pub/libxml/
2 Unzip it into some directory
3 Cd into directory where libxml is unzipped and then type the following commands
4 Type ./configure
5 Type make
6 Type make install
   now you have libxml
7 Download latest version of Kannel http://www.kannel.org/download.shtml and Unzip it into some directory  or use svn co https://svn.kannel.org/gateway/trunk  to download latest version of gateway
8 cd into directory where Kannel is unzipped and then type the following commands
9 Type  ./configure –prefix=/usr/local/kannel-1.5.0 –enable-start-stop-daemon –with-mysql
10 Type make
11 Type make install

 Now kannel is ready

Next step is to add configuration

Kannel consists of three programs, usually run as  daemons:  bearerbox, wapbox, and smsbox. They implement the connection to the phone (SMS or UDP), the WAP protocol stack, and the SMS based services, respectively.

We will need only  bearerbox and smsbox as we are going to setup it as SMS gateway server. Bearerbox is the main queue and smsbox handles the smscs.

Create a file named kannel.conf and add following configuration

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#---------------------------------------------
# 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 = 
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 relying.
# Example complete configuration
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 = ""
Now start SMS box and bearer box using
1
2
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
To see running process use
1
sudo ps -ef | grep kannel
To stop the kannel service
1
/etc/init.d/kannel stop
To see kannel logs
1
tail -f /var/log/kannel/kannel.log
Now you can send sms using send sms url
1
http://kannel.machine.ip:13010/cgi-bin/sendsms?username=tester&password=foobar&from=SENDERID&to=9999999999&text=test sms &smsc=PROMO-SERVICE-MESSAGE
If you are keen to learn more about this , Refer Here
For Sample kannel configuration, check Here

Comments

Anthony
Thanks for this. The send SMS from kannel is not any troublesome. Would you do a guide on receiving SMSs? I have tried everything and but still I cannot received SMS from the same e220 modem that works fine sending from kannel. Thanks again, you guide so far has been very usefull
Sreekanth G S
Start bearerbox first. Smsbox needs to connect to an already running bearerbox instance.

Comments