Kannel With PlaySMS HowTO

Get Latest Updates

apt-get update

apt-get upgrade

Install Required Packages

 

apt-get -y -force-yes install axel

apt-get -y –force-yes install python-software-properties

 

apt-get install nano wget cvs subversion curl git-core unzip autoconf automake1.9 libtool flex debhelper pkg-config libpam0g-dev intltool automake checkinstall docbook docbook-xsl build-essential libpcre3 libpcre3-dev libc6-dev g++ gcc autotools-dev bison libncurses5-dev m4 tex-common texi2html texinfo texlive-base texlive-base-bin texlive-common texlive-doc-base texlive-latex-base libxml2-dev

 

apt-get install kannel kannel-dev kannel-extras kannel-sqlbox libnet-smpp-perl

 

apt-get install -y apache2 mysql-server php5 php5-cli php5-cgi php-pear php-db phpmyadmin libapache2-mod-php5 gcc sendmail

Configuration Section

Replace the conf file at /etc/kannel/kannel.conf with the following

==============================================================================

#

# Sample configuration file for Kannel bearerbox on Debian.

# See the documentation for explanations of fields.

#

# HTTP administration is disabled by default. Make sure you set the

# password if you enable it.

################### ADDED BY RAYMOND #################################

#CORE

group = core

admin-port = 13000

smsbox-port = 13001

admin-password = pwd

status-password = pwd

log-file = “/var/log/kannel/kannel.log”

log-level = 1

access-log = “/var/log/kannel/access.log”

store-location = “/var/log/kannel/kannel.store”

# SMSC Fake

#group = smsc

#smsc = fake

#host = localhost

#port = 13013

#SMSC modem gsm

group = smsc

smsc = at

host = 127.0.0.1

port = 13013

smsc-id = huawei

modemtype = huawei

device = /dev/ttyUSB0

speed = 9600

sms-center = +923455000010

my-number = +923474495042

group = modems

id = huawei

name = huawei

detect-string = huawei

init-string = “AT+CNMI=2,1,0,0,0;+CMEE=1″

# SMSBOX SETUP

group = smsbox

bearerbox-host = localhost

sendsms-port = 13013

sendsms-chars = “0123456789+”

global-sender = +923455000010

log-level = 1

log-file = “/var/log/kannel/smsbox.log”

access-log = “/var/log/kannel/access.log”

# SEND-SMS USERS

group = sendsms-user

username = playsms

password = aaaaa

# SMS SERVICE ‘Default’

# there should be default always

group = sms-service

keyword = default

accept-x-kannel-headers = true

max-messages = 100

assume-plain-text = true

catch-all = true

#exec = /usr/local/bin/kannel_incoming %t %q %a

get-url = “http://sms.nextbridge.org/~playsms/plugin/gateway/kannel/geturl.php?t=%t&q=%q&a=%a”

==============================================================================

Playsms installation & Configuration.

Create playSMS web root, spool and log and set ownership to user www-data or web server user

# mkdir -p /var/www/playsms

# mkdir -p /var/spool/playsms

# mkdir -p /var/log/playsms

# chown -R www-data /var/www/playsms

# chown -R www-data /var/spool/playsms

# chown -R www-data /var/log/playsms

 

Download playsms source code

#Wget http://sourceforge.net/projects/playsms/files/latest/download?source=files

 

Extract playSMS package somewhere (Usually in /usr/local/src)

# tar -zxvf playsms-x.x.x.tar.gz -C /usr/local/src

 

Copy files and directories inside ‘web’ directory to playSMS web root and set ownership again to “user www-data or apache web server user”

# cd /usr/local/src/playsms-x.x.x/web

# cp -rR * /var/www/playsms

# chown -R www-data /var/www/playsms

 

Setup database (import database)

# mysqladmin -u root -p create playsms

# mysql -u root -p playsms < /usr/local/src/playsms-x.x.x/db/playsms.sql

 

Copy config-dist.php to config.php and edit config.php

# cd /var/www/playsms

# cp config-dist.php config.php

# mcedit config.php or

# vi config.php

Note: please read and fill all required fields with cautious

Enter bin directory, copy playsms, playsmsd, playsmsd.php, playsmsd_start to directory default

# cd /usr/local/src/playsms-x.x.x/bin

# cp playsmsd playsmsd.php playsmsd_start /usr/local/bin/

# cp playsms /etc/default/

Note: please note the different between playsms and playsmsd

Look for rc.local on /etc and its subdirectories (usualy /etc, /etc/init.d or

/etc/rc.d/init.d) Edit rc.local and put:

/usr/local/bin/playsmsd_start

NOTE: on the bottom of the file (before exit if theres exit command). This way

playsmsd_start will start automatically on boot.

Browse http://localhost/playsms/ and login using default administrator user

username: admin

password: admin

Now Load smsbox as it was installed by default with kannel

Create script to “start & stop smsbox” at:

This script will take input from below mentioned scritp after this script

Touch /etc/init.d/smsbox

Chmod  o+x /etc/init.d/smsbox

 

Edit:

vi /etc/init.d/smsbox

 

 

Paste:

=====================================================================================

#!/bin/bash

BASH_SCRIPT=/usr/sbin/smsbox-nxb

RETVAL=0

case “$1″ in

start)

$BASH_SCRIPT

RETVAL=$?

;;

stop)

killall -9 smsbox

RETVAL=$?

;;

restart)

killall -9 smsbox

$BASH_SCRIPT

RETVAL=$?

;;

*)

echo “Usage: smsbox {start|stop|restart}”

exit 1

;;

esac

exit $RETVAL

=====================================================================================

 

Create Deamon for smsbox at:

touch /usr/sbin/smsbox-nxb

chmod o+x /usr/sbin/smsbox-nxb

 

Edit:

vi /usr/sbin/smsbox-nxb

 

Paste:

=====================================================================================

#!/bin/bash

/usr/sbin/smsbox /etc/kannel/kannel.conf > /dev/null 2>&1 &

=====================================================================================

Now check your services:

/etc/init.d/smsbox stop

/etc/init.d/smsbox start

Advertisements