Thursday, 18 October 2012

Installing and Configuring Kannel OpenSMPPBox


Similar to SMSBoxOpenSMPPBox is a type of box that runs on top of an existing Kannel installation.  However this is a special type of box that will listen to incoming SMPP Connections to allow messages to be sent to and from SMPP Clients allowing you to act as an SMPP Provider.

In this post I will provide basic configuration for installing the additional OpenSMPPBox on top of an existing Kannel Installation. You can find how to install Kannel in my previous post, you must however install this on top of the latest version of kannel, found here.

The user guide for Kannel can be found at http://www.kannel.com/userguide.shtml and the user guide for OpenSMPPBox can be found at http://www.scribd.com/doc/89943592/Opensmpp-Userguide .

1. With Kannel 1.5.0 Installed and working, download the OpenSMPPBox source code, available from multiple sources:

https://redmine.kannel.org/projects/smppbox/repository
or 
https://github.com/pruiz/kannel-opensmppbox

The easiest step is to download the zip file from the above github url:

wget https://github.com/pruiz/kannel-opensmppbox/zipball/master

2. Extract the archive 


unzip master 

3. Change to the directory to compile


cd pruiz-kannel-opensmppbox-b6712e2/

Use the following steps to install:


./configure --prefix=/usr/local/kannel --with-kannel-dir=/usr/local/kannel  (specify Kannel base install directory)

NOTE: [ If you receive error like:


/root/pruiz-kannel-opensmppbox-b6712e2/gw/box-dlr.c:178: undefined reference to `dbpool_destroy'
collect2: ld returned 1 exit status
make[2]: *** [opensmppbox] Error 1

you will need to change to the source directory for your base Kannel installation and re-compile with database support 

./configure --with-mysql or --with-pgsql 
make
make install


Then continue in the OpenSMPPBox directory:

cd pruiz-kannel-opensmppbox-b6712e2/


./configure --prefix=/usr/local/kannel --with-kannel-dir=/usr/local/kannel  (specify Kannel base install directory)
make
make install

You'll notice a new file created in usr/local/kannel/sbin/opensmppbox 

4. Change to the kannel directory

cd /usr/local/kannel

Create a new opensmppbox.conf file with the following content, this is basic without database support. Full parameter list can be found in the user guide. :


group = core
dlr-storage = internal

group = opensmppbox
opensmppbox-id = SMPP
opensmppbox-port = 2775
bearerbox-host = 127.0.0.1
bearerbox-port = 13001
our-system-id = SMPP
smpp-logins = /usr/local/kannel/smpplogins.txt
use-systemid-as-smsboxid = true
route-to-smsc = smsc1 (the smsc you want to send to in kannel.conf, could be your own http smsc)
log-file = /usr/local/kannel/logs/smppbox.log

4. Create an smpplogin.txt file in the specified path above. This will define who can connect over SMPP, refer to the guide for more details. A sample line could look like:

testname testpassword smsc1 *.*.*.* 

This can contain an endless list of entires.

5. Ensure kannel base installation is running. Now run OpenSMPPBox using the following commands:

/usr/local/kannel/sbin/opensmppbox  opensmppbox.conf 

If OpenSMPPBox is running correctly and ready to accept connections the log file will show the following:


 INFO: Waiting for SMPP connections on port 2775.

You box is now ready to accept connections on port 2755 from users defined in smpplogin.txt file.

For further reference and exploration, the user guide for Kannel can be found at http://www.kannel.com/userguide.shtml and the user guide for OpenSMPPBox can be found at http://www.scribd.com/doc/89943592/Opensmpp-Userguide .

5 comments:

  1. I am tring to install kannel-opensmppbox I download package from
    github.com/pruiz/kannel-opensmppbox
    I am using Centos 6.3 64 bit during make of opensmppbox I am facing following error, please help me


    I am tring to install kannel-opensmppbox I download package from
    https://github.com/pruiz/kannel-opensmppbox
    I am using Centos 6.3 64 bit during make of opensmppbox I am facing following error, please help me


    opensmppbox.c:81:26: error: gw/meta_data.h: No such file or directory
    opensmppbox.c: In function 'send_pdu':
    opensmppbox.c:623: warning: passing argument 1 of 'smpp_pdu_pack' from incompatible pointer type
    /etc/kannel/include/kannel/gw/smsc/smpp_pdu.h:230: note: expected 'struct SMPP_PDU *' but argument is of type 'struct Octstr *'
    opensmppbox.c:623: error: too many arguments to function 'smpp_pdu_pack'
    opensmppbox.c: In function 'read_pdu':
    opensmppbox.c:680: error: too many arguments to function 'smpp_pdu_unpack'
    opensmppbox.c: In function 'msg_to_pdu':
    opensmppbox.c:823: error: too many arguments to function 'dlr_find'
    opensmppbox.c:912: error: 'struct deliver_sm' has no member named 'tlv'
    opensmppbox.c:913: error: 'struct deliver_sm' has no member named 'tlv'
    opensmppbox.c:913: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:925: error: 'struct deliver_sm' has no member named 'tlv'
    opensmppbox.c:926: error: 'struct deliver_sm' has no member named 'tlv'
    opensmppbox.c:926: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:1016: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:1066: error: 'struct deliver_sm' has no member named 'tlv'
    opensmppbox.c:1067: error: 'struct deliver_sm' has no member named 'tlv'
    opensmppbox.c:1067: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:1078: error: 'struct deliver_sm' has no member named 'tlv'
    opensmppbox.c:1079: error: 'struct deliver_sm' has no member named 'tlv'
    opensmppbox.c:1079: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c: In function 'pdu_to_msg':
    opensmppbox.c:1264: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:1265: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:1266: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:1266: error: 'struct submit_sm' has no member named 'tlv'
    opensmppbox.c: In function 'data_sm_to_msg':
    opensmppbox.c:1430: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:1431: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:1432: error: 'struct sms' has no member named 'meta_data'
    opensmppbox.c:1432: error: 'struct data_sm' has no member named 'tlv'
    opensmppbox.c: In function 'run_smppbox':
    opensmppbox.c:2099: warning: cast from pointer to integer of different size
    opensmppbox.c: In function 'wait_for_connections':
    opensmppbox.c:2156: warning: cast to pointer from integer of different size
    opensmppbox.c: In function 'smppboxc_run':
    opensmppbox.c:2171: warning: cast from pointer to integer of different size
    make[2]: *** [opensmppbox.o] Error 1
    make[2]: Leaving directory `/root/pruiz-kannel-opensmppbox-c3fc444/gw'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/root/pruiz-kannel-opensmppbox-c3fc444'
    make: *** [all] Error 2
    [root@smpp pruiz-kannel-opensmppbox-c3fc444]#

    ReplyDelete
    Replies
    1. I need help too! Got same errror!

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Hi.
    I'm trying to implement SMPP server as you explained above....

    running make is giving me errors.. here is the cmd line trace.

    root@ubuntu:/home/rajeev/pruiz-kannel-opensmppbox-c3fc444# make
    make all-recursive
    make[1]: Entering directory `/home/rajeev/pruiz-kannel-opensmppbox-c3fc444'
    Making all in gw
    make[2]: Entering directory `/home/rajeev/pruiz-kannel-opensmppbox-c3fc444/gw'
    if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../gw -I../gw -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I/usr/local/include/kannel -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/include/openssl -I/usr/include/mysql -I/usr/include/mysql -MT opensmppbox.o -MD -MP -MF ".deps/opensmppbox.Tpo" -c -o opensmppbox.o opensmppbox.c; \
    then mv -f ".deps/opensmppbox.Tpo" ".deps/opensmppbox.Po"; else rm -f ".deps/opensmppbox.Tpo"; exit 1; fi
    opensmppbox.c: In function ‘run_smppbox’:
    opensmppbox.c:2553:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    opensmppbox.c: In function ‘wait_for_connections’:
    opensmppbox.c:2615:10: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    opensmppbox.c: In function ‘smppboxc_run’:
    opensmppbox.c:2630:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    opensmppbox.c: In function ‘check_login’:
    opensmppbox.c:387:8: warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
    /bin/bash ../libtool --tag=CC --mode=link gcc -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I/usr/local/include/kannel -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/include/openssl -I/usr/include/mysql -I/usr/include/mysql -rdynamic -o opensmppbox box-dlr.o opensmppbox.o -lmysqlclient_r -L/usr/local/lib/kannel -lgw -lwap -lgwlib -lmysqlclient_r -lssl -lrt -lresolv -lnsl -lm -lpthread -L/usr/lib/x86_64-linux-gnu -lxml2 -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu -lcrypto -lssl -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r -lpthread -lz -lm -lrt -ldl -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r -lpthread -lz -lm -lrt -ldl
    mkdir .libs
    gcc -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -I/usr/local/include/kannel -g -O2 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_LARGE_FILES= -I/usr/include/libxml2 -I/usr/include/openssl -I/usr/include/mysql -I/usr/include/mysql -rdynamic -o opensmppbox box-dlr.o opensmppbox.o -L/usr/local/lib/kannel -lgw -lwap -lgwlib -lresolv -lnsl -L/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/libxml2.so -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu -lcrypto -lssl -lmysqlclient_r -lpthread -lz -lm -lrt -ldl
    box-dlr.o: In function `dlr_mem_add_with_id':
    /home/rajeev/pruiz-kannel-opensmppbox-c3fc444/gw/box-dlr.c:1154: undefined reference to `dlr_add'
    collect2: ld returned 1 exit status
    make[2]: *** [opensmppbox] Error 1
    make[2]: Leaving directory `/home/rajeev/pruiz-kannel-opensmppbox-c3fc444/gw'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/rajeev/pruiz-kannel-opensmppbox-c3fc444'
    make: *** [all] Error 2

    It'll be great if you can help me figure out this

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete