installing Kannel in Centos 7

How to installing Kannel in Centos 7

1.Install some of the dependencies of Kannel:

yum update

yum groupinstall “Development tools” -y

yum install libxml2-devel

https://uat.pfconcept.com/pub/media/logo_lib/471491600071184Untitled.png

2. Download and extract FreeSWITCH source:

cd /usr/local/src/

wget http://www.kannel.org/download/1.4.4/gateway-1.4.4.tar.gz

tar -zxvf gateway-1.4.4.tar.gz

3.Patching need for centos 7

 https://redmine.kannel.org/issues/778 (patch)

 wget  https://redmine.kannel.org/attachments/327/gateway-1.4.5.patch.gz

 cd /usr/local/src/

 tar xf gateway-1.4.5.tar.bz2

 cd gateway-1.4.5

 gunzip -c ../gateway-1.4.5.patch.gz | patch -p1

4.compile and install

  cd /usr/local/src/gateway-1.4.5

  ./configure

  make

  make install

 5.Now we need to create a path for our config file

  mkdir -p /etc/kannel/smscs

  mkdir -p /etc/kannel/logs

  mkdir  -p /etc/kannel/run

6.kannel conf file

  vi /etc/kannel/kannel.conf

#

# THIS IS A SAMPLE CONFIGURATION FOR SMS KANNEL

#

# This basic version is used for system testing. It expects ‘fakesmsc’ to

# send messages which are replied with simple fixed text message.

# It is run like this:

#

#  1% gw/bearerbox gw/smskannel.conf

#  2% gw/smsbox gw/smskannel.conf

#  3% test/fakesmsc -i 0.1 -m 100 “123 345 text nop”

#

# ..all 3 commands in separate shells (or screen sessions)

# Note that you can run them in different machines but have to

# add certain command line argument and configuration variables then

#

#

# For any modifications to this file, see Kannel User Guide

# If that does not help, see Kannel web page (http://www.kannel.org) and

# various online help and mailing list archives

#

# Notes on those who base their configuration on this:

#  1) check security issues! (allowed IPs, passwords and ports)

#  2) groups cannot have empty rows inside them!

#  3) read the user guide

#

# Kalle Marjola for Kannel project 2001, 2004

#———————————————

# 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 = 13000

smsbox-port = 13001

wapbox-port = 13002

admin-password = bar

#status-password = foo

#admin-deny-ip = “”

#admin-allow-ip = “”

log-file = “/etc/kannel/logs/kannel.log”

log-level = 0

wdp-interface-name = “192.xx.xx.xx”

box-deny-ip = “*.*.*.*”

box-allow-ip = “127.0.0.1”

#unified-prefix = “+358,00358,0;+,00”

access-log = “/etc/kannel/logs/access.log”

#store-file = “kannel.store”

#ssl-server-cert-file = “cert.pem”

#ssl-server-key-file = “key.pem”

#ssl-certkey-file = “mycertandprivkeyfile.pem”

#———————————————

# SMSC CONNECTIONS

#

# SMSC connections are created in bearerbox and they handle SMSC specific

# protocol and message relying. You need these to actually receive and send

# messages to handset, but can use GSM modems as virtual SMSCs

# This is a fake smsc connection, _only_ used to test the system and services.

# It really cannot relay messages to actual handsets!

#group = smsc

#smsc = fake

#smsc-id = FAKE

#port = 10000

#connect-allow-ip = 127.0.0.1

###################################SAMPLE SMSC##################################                                                                                                             ##############

group = smsc

smsc = smpp

smsc-id = SATYANTC

#allowed-smsc-id =

host =  10.xx.xx.xx(ip of sms gate)

port = 5016

#receive-port =

transceiver-mode = 1

#system-type = 0

system-type = “SCP”

smsc-username = username from smsgate

smsc-password = password from smsgateway

source-addr-ton = 0

source-addr-npi = 0

dest-addr-ton = 0

dest-addr-npi = 0

enquire-link-interval = 30

#allowed-prefix = 0

#denied-prefix = 0

max-pending-submits = 3

throughput = 100

#msg-id-type = STRINGS

source-addr-autodetect = yes

alt-dcs = 0

#alt-charset = “GSM”

alt-charset = ISO-8859-1

# WAPBOX SETUP

group = wapbox

bearerbox-host = localhost

access-log = “/etc/kannel/logs/wap-access.log”

log-file = “/etc/kannel/logs/wapbox.log”

log-level = 0

################################################################################                                                                                                             ##############

#———————————————

# 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 = 127.0.0.1

sendsms-port = 13013

global-sender = “xxxx”(sms number)

sendsms-chars = “0123456789 +-“

log-file = “/etc/kannel/logs/smsbox.log”

log-level = 0

access-log = “/etc/kannel/logs/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

#user-deny-ip = “”

#user-allow-ip = “”

#———————————————

# SERVICES

#

# These are ‘responses’ to sms PULL messages, i.e. messages arriving from

# handsets. The response is based on message content. Only one sms-service is

# applied, using the first one to match.

group = sms-service

keyword = nop

text = “You asked nothing and I did it!”

# There should be always a ‘default’ service. This service is used when no

# other ‘sms-service’ is applied.

group = sms-service

keyword = default

text = “No service specified”

  7. kannel service init file

  vi /etc/init.d/kannel

#!/bin/sh

# Start/stop the Kannel boxes: One bearer box and one WAP box.

# This is the default init.d script for Kannel.  Its configuration is

# appropriate for a small site running Kannel on one machine.

# Make sure that the Kannel binaries can be found in $BOXPATH or somewhere

# else along $PATH.  run_kannel_box has to be in $BOXPATH.

BOXPATH=/etc/kannel/sbin

PIDFILES=/etc/kannel/run

CONFDIR=/etc/kannel

CONF=$CONFDIR/kannel.conf

USER=kannel

VERSION=””

#VERSION=”-0.12.4″

RB=$BOXPATH/run_kannel_box$VERSION

BB=$BOXPATH/bearerbox$VERSION

WB=$BOXPATH/wapbox$VERSION

SB=$BOXPATH/smsbox$VERSION

SSD=$BOXPATH/start-stop-daemon$VERSION

PATH=$BOXPATH:$PATH

# On Debian, the most likely reason for the bearerbox not being available

# is that the package is in the “removed” or “unconfigured” state, and the

# init.d script is still around because it’s a conffile.  This is normal,

# so don’t generate any output.

#test -x $BOXPATH/$BB || exit 0

case “$1” in

  start)

    echo -n “Starting WAP gateway: bearerbox”

    $SSD –start –quiet –pidfile $PIDFILES/kannel_bearerbox.pid –exec $RB — –pidfile $PIDFILES/kannel_bearerbox.pid $BB — $CONF

    echo -n ” wapbox”

    $SSD –start –quiet –pidfile $PIDFILES/kannel_wapbox.pid –exec $RB — –pidfile $PIDFILES/kannel_wapbox.pid $WB — $CONF

    echo -n ” smsbox”

    $SSD –start –quiet –pidfile $PIDFILES/kannel_smsbox.pid –exec $RB — –pidfile $PIDFILES/kannel_smsbox.pid $SB — $CONF

    echo “.”

    ;;

  stop)

    echo -n “Stopping WAP gateway: wapbox”

    $SSD –stop –quiet –pidfile $PIDFILES/kannel_wapbox.pid –exec $RB

    echo -n ” smsbox”

    $SSD –stop –quiet –pidfile $PIDFILES/kannel_smsbox.pid –exec $RB

    echo -n ” bearerbox”

    $SSD –stop –quiet –pidfile $PIDFILES/kannel_bearerbox.pid –exec $RB

    echo “.”

    ;;

  status)

    CORE_CONF=$(grep -r ‘group[[:space:]]*=[[:space:]]*core’ $CONFDIR | cut -d: -f1)

    ADMIN_PORT=$(grep ‘^admin-port’ $CORE_CONF | sed “s/.*=[[:space:]]*//”)

    ADMIN_PASS=$(grep ‘^admin-password’ $CORE_CONF | sed “s/.*=[[:space:]]*//”)

    STATUS_URL=”http://127.0.0.1:${ADMIN_PORT}/status.txt?password=${ADMIN_PASS}”

    lynx -source $STATUS_URL

    ;;

  reload)

    # We don’t have support for this yet.

    exit 1

    ;;

  restart|force-reload)

    $0 stop

    sleep 1

    $0 start

    ;;

  *)

    echo “Usage: $0 {start|stop|status|reload|restart|force-reload}”

    exit 1

esac

exit 0

#######

  chmod a+x /etc/init.d/kannel

  8.start kannel serice

  service kannel start

  ps aux |grep kannel

  netstat -pln |grep box

 9. Log and testing

 tail -f /etc/kannel/logs/access.log

 tail -f /etc/kannel/logs/kannel.log

10.Testing msg

 curl ‘http://localhost:13013/cgi-bin/sendsms?username=tester&password=foobar&to=+97798510xxxxx&text=testMsgFromNewServer’

 also send sms to this number 30303 with nop text  there will be autoreply from the reponse.

Leave a Reply

Your email address will not be published. Required fields are marked *