Showing posts with label Kannel SMS Gateway. Show all posts
Showing posts with label Kannel SMS Gateway. Show all posts

Sunday, December 16, 2012

Steps to install Kannel SMS Gateway with SQLBox


Kannel :
Kannel is a compact and very powerful open source WAP and SMS gateway,WAP is used for Push service indications and mobile Internet connectivity.
WAP :
Wireless Application Protocol is a technical standard for accessing information over a mobile wireless network. WAP means a protocol that are used to connect wireless GPRS OR GSM with web browser by sending encoded message to mobile. By this web browser get the information of mobile device and start sending messages or emails through network.
Steps to install kannel with sqlbox:
1. To install kannel we need to install this essencial requirements.
Warning : run command with sudo user
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install bison
sudo apt-get install libmysqld-dev

sudo apt-get install libxml2-dev
2. Download gateway stable release version 1.4.3.

http://www.kannel.org/downloads/1.4.3/gateway-1.4.3.tar.gz
3. Extract gateway folder in any directory of your system. 
$ tar xfvz gateway-1.4.3.tar.gz
4. Goto gateway folder.
$ cd gateway-1.4.3/
5. Configure
The below command makes the shell run the script named ‘ configure ‘ which exists in the current directory. The configure script basically consists of many lines which are used to check some details about the machine on which the software is going to be installed. This script checks for lots of dependencies on your system. wait for the completion of the process.

$ ./configure --with-mysql
6. make
make command used to perform all necessary re-compilations. You can use make with any programming language whose compiler can be

run with a shell command. make command is used when we want to run any project which needs compilation of files.

$ make
7. make install
The install section happens to be only a part where the executables and other required files created during the last step (i.e. make) are copied into the required final directories on your machine. E.g. the executable that the user runs may be copied to the /usr/local/bin so that all users are able to run the software. Similarly all the other files are also copied to the standard directories in Linux. Remember that when you ran make, all the executables were created in the temporary directory where you had unzipped your original tarball. So when you run make install, these executables are copied to the final directories.

$ make install

8. Download sqlbox by typing the below command line.

$ svn co https://svn.kannel.org/sqlbox/trunk sqlbox

9. Extract sqlbox folder in gateway folder which was downloaded before. Run below mentioned commands to install sqlbox.

$cd sqlbox
$ ./configure
$ make

$ make install

Kannel installation with sqlbox is completed.

Now we need to configure both kannel.conf file and sqlbox.conf.
1. Copy this below code and paste in your /etc/kannel/kannel.conf file and change the details according to your needs.
#CORE
group = core
admin-port = 13000
smsbox-port = 13001
admin-password = *****
status-password = *****
admin-allow-ip = "*.*.*.*"
wdp-interface-name = "*"
log-file = "/var/log/kannel/bearerbox.log"
#store-file = "/var/log/kannel/kannel.store"
log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "*.*.*.*"
dlr-storage=mysql

#SMSBOX SETUP
group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
bearerbox-port = 13001
sendsms-chars = "0123456789 +-"
global-sender = +91number
log-file = "/var/log/kannel/smsbox.log"
log-level = 0

# SEND-SMS USERS
group = sendsms-user
username = usernameToSendSms
password = passwordToSendSms
default-smsc = SMSC-ID
user-allow-ip ="*.*.*.*"

#mysql connection
group = mysql-connection
id = sqlbox-db
host = localhost
username = root
password = passwordOfMysql
database = dataBaseName
max-connections = 10

# DLR SETUP
#mysql connection
group = mysql-connection
id = mydlr
host = localhost
username = root
password = passwordOfMysql
database = dataBaseName
max-connections = 10

group = dlr-db
id = mydlr
table=dlr
field-smsc=smsc
field-timestamp=ts
field-destination=destination
field-source=source
field-service=service
field-url=url
field-mask=mask
field-status=status
field-boxc-id=boxc

# SMSC Fake
group = smsc
smsc = fake
port = 10000
connect-allow-ip = 127.0.0.1

# SMS SERVICE black-list
#group = sms-service
#keyword = black
#text = "You are not allowed to use this service, Go away!"
#catch-all = true

# SMSC SMPP
group = smsc
smsc-id = idForSmsc
smsc = smpp
host = **.**.**.**
port = portnumber
receive-port = 16400
smsc-username = username
smsc-password = password
system-type = type
system-id = id
address-range = ""

#SMS SERVICE GET-URL EXAMPLE
group = sms-service
keyword = default
send-sender = true
get-url = "http://localhost/receivesms?phone=%p&text=%a"

# SMS SERVICE Default
# there should be default always
#group = sms-service
#keyword = default
#text = "No service specified. "

Note: Remove # symbols if you need and change the value for that according to your requirement.

2. Copy the below code and paste in /etc/kannel/sqlbox.conf file and change the details according to your requirement.
SQL BOX CONFIG
group = sqlbox
id = sqlbox-db
smsbox-id = sqlbox
global-sender = ""
bearerbox-host = localhost
bearerbox-port = 13001
smsbox-port = 13002
smsbox-port-ssl = false
sql-log-table = sent_sms
sql-insert-table = send_sms
#log-file = "/var/log/kannel/kannel-sqlbox.log"
#log-level = 0
#ssl-client-certkey-file = ""
#ssl-server-cert-file = ""
#ssl-server-key-file = ""
#ssl-trusted-ca-file = ""

# Database connection examples. Please uncomment as needed
# Example MYSQL Connection
group = mysql-connection
id = sqlbox-db
host = localhost
username = root
password = passwordOfMysql
database = dataBase

# Example ORACLE Connection
#group = oracle-connection
#id = sqlbox-db
#username = myuser
#password = mypass
#tnsname = //localhost:1521/XE

# Example POSTGRESQL Connection
#group = pgsql-connection
#id = sqlbox-db
#id = sqlbox-db
#username = myuser
#password = mypass
#database = kannel
#host = localhost

# Example SDB Connection with some database URL examples
# *** Note: Uncomment only _one_ "url" line ***
#group = sdb-connection
#id = sqlbox-db
#url = mysql:host=localhost:db=kannel:uid=myuser:pwd=mypass
#url = sqlite:db=/path/to/kannel.db
#url = sqlite3:db=/path/to/kannel3.db

# Example SQLITE 2 Connection
#group = sqlite-connection
#id = sqlbox-db
#database = /path/to/kannel.db
#max-connections = 1

# Example SQLITE 3 Connection
#group = sqlite3-connection
#id = sqlbox-db
#database = /path/to/kannel.db
#max-connections = 1

Installation and Configuration is completed now. We should run the Bearerbox, Sqlbox and Smsbox to send a sms from the kannel using smpp account.

Note: Open 3 Termials for 3 boxes individually
Starting the Bearerbox: (type this command in terminal as super user)
bearerbox -v 0 /etc/kannel/kannel.conf
Starting the Sqlbox: (type this command in terminal as super user)
sqlbox -v 0 /etc/kannel/sqlbox.conf
Stargin the Smsbox:  (type this command in terminal as super user)
smsbox -v 0 /etc/kannel/kannel.conf
if boxes are running properly without any errors then you succefully installed kannel with sqlbox. if you got any errors you can post a comment here....
Sending first sms:
Open MySql or PhpMyAdmin and login with your details.
Then open the send_sms table and insert a record.
Note: No need to insert all the fields. Mandatory fields are 
1. Sender
2. Reciever
3. Text (Message)
4. SMSC_ID (which is used in kannel.conf file to identify the smsc_id)
5. Account (Username of smsc)
Then automatically the message goes to the particular number.
If you want to check the status of your messages open browser and type the url in the address bar
http://localhost:13000/status?password=status-password
(here status-password is the password which is given in the kannel.conf file)