Kannel Installation and Configuration as SMS gateway Server
Installation
- Download latest version of Kannel http://www.kannel.org/download.shtml
- Unzip it into some directory
- Before installation of Kannel we have to install a dependency libxml2. To install libxml2 we can download it from the following link. ftp://gd.tuwien.ac.at/pub/libxml/
- After extracting the package cd into the directory where it is extracted.
- Type ./configure
- make
- make install
- to check whether the installation is successful or not type this command: make tests
- After installation of libxml2 now we will be able to install the Kannel. Now repeat the above steps which we repeated for the libxml2 installation
- cd into directory where Kannel is unzipped and then type the following commands
- ./configure
- make
- make install
- Now Kannel is installed and ready for the configuration
Configuration
- Kannel has three parts bearerbox, smsbox and wapbox. We will need only two bearerbox and smsbox as we are going to setup it as SMS gateway server. Bearerbox is the main queue and smsbox handles the smscs.
- Now we need configuration of each beaerbox and smsbox to run the Kannel according to device attached. Configuration of bearerbox and smsbox is written into a configuration file sometimes but not necessarily named as ‘smskannel.conf’.
- How to find the ‘smskannel.conf’? Open the terminal and type this command > locate smskannel.conf. Now you the open the ‘smskannel.conf’ by the path returned by the command.
- After opening the ‘smskannel.conf’ you will see different types of groups there. E.g. Core group, smsc group, modem group and smsc service groups. You can refer Kannel installation guide for further information.
- By default bearerbox and smsbox installation files lies in /usr/local/sbin
- Now copy the ‘smskannel.conf’ into /usr/local/sbin
- Modem which will be used with Kannel should support ‘AT+CNMI’ command otherwise modem will not work with Kannel.
- We can check if our modem is detected or not by this command > ls /dev . If modem is being detected then we will see ttyACM0 / ttyUSB0 in result.
- To check whether’ AT+CNMI’ command is supported on the modem or not we have to test it through serial port. In Linux we can open our device through serial port using ‘minicom’.
If get error in return then you cannot use that modem with Kannel and if you get out put something like above then you can use that modem with Kannel.
- Now run the bearerbox by this command
- bearerbox smskannel.conf
- Now run smsbox by this command opening a new terminal and going into directory
- smsbox smskannel.conf
- smskannel.conf for Motorola Razer V3 is given below
*******************************smskannel.conf starts here********************************
# CORE
#
# There is only one core group and it sets all basic settings
# of the bearerbox (and system). You should take extra notes on
# configuration variables like ‘store-file’ (or ‘store-dir’),
# ‘admin-allow-ip’ and ‘access.log’
group = core
admin-port = 13003
smsbox-port = 13004
admin-password = bar
#status-password = foo
#admin-deny-ip = “”
#admin-allow-ip = “”
log-file = “/usr/local/Log/kannel.log”
box-deny-ip = “*.*.*.*”
box-allow-ip = “127.0.0.1”
access-log = “/usr/local/Log/access.log”
#———————————————
#—————–Modem Group————
group = modems
id = motorola
name = “ATI 144”
detect-string = “Motorola”
init-string = “AT0”
init-string= “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0”
init-string = “AT+CNMI=3,2,0,0,0”
init-string = “AT+CMEE=2;+CNMI=3,1,0,0,0”
reset-string = “ATZ”
speed=115200
need-sleep = true
keepalive-cmd = “AT+CBC;+CSQ”
enable-mms = true
message-storage=”SM”
#——————————————-
# SMSC CONNECTIONS
#this is for Motorola Razer V3i
group = smsc
smsc = at
smsc-id = Motorola Razer V3i
modemtype = motorola
device=/dev/ttyACM0
my-number = 00923348648921
sms-center= 00923330005150
connect-allow-ip = 127.0.0.1
log-level = 0
#———————————————
# SMSBOX SETUP
group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
global-sender = 13013
#sendsms-chars = “0123456789 +-”
#log-file = “/tmp/smsbox.log”
#log-level = 0
#access-log = “/tmp/access.log”
#———————————————
# SEND-SMS USERS
#
# These users are used when Kannel smsbox sendsms interface is used to
# send PUSH sms messages, i.e. calling URL like
# http://kannel.machine:13013/cgi-bin/sendsms?username=tester&password=foobar…
group = sendsms-user
username = tester
password = foobar
max-messages=3
#user-deny-ip = “”
#user-allow-ip = “”
#———————————————
# SERVICES
group = sms-service
keyword = nop
text=”Working nop key word searched”
# There should be always a ‘default’ service. This service is used when no
# other ‘sms-service’ is applied.
#group = sms-service
#keyword = sub
#get-url=”http://10.3.20.241:8080/_PakAgriTech/subscribe.jsp?#sender=%p&text=%a”
group = sms-service
keyword = rgs
get-url=”http://10.3.20.241:8080/_PakAgriTech/register.jsp?sender=%p&text=%a”
group = sms-service
keyword = default
catch-all = yes
max-messages=3
#text=”Mahtab Rasheed”
get-url=”http://10.3.20.241:8080/_PakAgriTech/defaultRecv.jsp?sender=%p&text=%a”
*******************************smskannel.conf ends here*********************************
I m new to kannel. I have installed the kannel but doesnot have SMPP server access. Can you tell me about free smpp access servers so that i can integrate it with kannel. and please, also help me in integrating that with Kannel.
Nice post.
Can you suggest mobile phones to use with kannel sms gateway. Low cost, reliable phones available in the Pakistan market would be preffered.
Motorolla Razor V3 can be used with kannel. I have also used Motorolla V3 with my project. It is very cheap. You will get it in Pkr Rs-700-1000.
Thanks. That was quick.
Anyother phone that works well.
You can use any mobile which you can connect with computer with data cable other than Nokia mobile phones. GSM modem in Nokia mobile phones can send SMS but receiving SMS in locked. You can try some china mobile/Q-mobile. There are also cheap GSM modems (USB Dongle) available in Lahore (Hafeez Center). You can also purchase that
It also depends upon your need. If you want to send thousands of SMS’s/Second then you have to you a better GSM modem. But if your usage is small scale then you can use the GSM Modem of mobile phones.
great post. Just wanted to ask:
you have used ufone sms-center. Will they charge us per sms, or it is free to send sms through this system?
Nice Mehtab! Keep it up! 🙂
In your experience this piece of software can be used to connect it with a carrier?? I would like to send thousands of sms.
Yes Yes … but you have to use GSM Modem along with software to connect with carrier. You can send thousand of sms it has the capability to handle bulk number of SMS’s
Is it for free to send the sms or you need to pay the GSM mobile company for sending sms
do we need to start kannel service?
Yes Yes
how to attach GSM modem
I have explained in the above post… If you have specific query drop an email at mahtabrasheed195@gmail.com I will try to help you.
Dear Mehtab,
This is an excellent post. I was able to configure Kannel on Ubuntu 14.0 TLS. It will be a great favour, if you can describe the procedure to auto start the BearerBox, SQLBox and SMBox services on Ubuntu Box restart. I shall be thankful to you.
Best regards.
Attaullah
After install libxml2-2.9.2 when i make tests then this Error will be come
File “python/libxml2.py”, line 1343, in parseFile
if ret is None:raise parserError(‘xmlParseFile() failed’)
libxml2.parserError: xmlParseFile() failed
make: *** [RelaxNGPythonTests] Error 1
Dear Mahtab,
This is a very useful documentation. I followed all steps, everything works alright, but at a moment of time I get the following error message:
ERROR: AT2[A]: CMS ERROR: +CMS ERROR: 500
ERROR: AT2[A]: CMS ERROR: Unknown error. -> maybe Sim storage is full? I’ll have a look at it. (500)
DEBUG: sms_router: gwlist_len = 1
DEBUG: sms_router: handling message (0x7f2934000fc0 vs 0x7f2934000fc0)
DEBUG: re-queing SMS not-yet-to-be resent
Could you provide few hints about this error?
Thank you,
Valentin
do we need to make available any softwares before going to install kannel and libxml???
Please do let me know…
Thanks in advance…!