This is My Blog

2008/12/05
|

HOWTO: Connect Kannel to an SMPP Server

Today I will be covering how to connect Kannel gateway to an SMPP Server.

Following on from my previous post, you should have a wapbox, smsbox and bearerbox binary now compiled on your machine. Just to put your minds at ease, I want to cover some basic architecture of Kannel, so you can understand how your messages flow through the system, and potentially give you an idea of where to start your troubleshooting.

What this diagram indicates is, the bearerbox is the binary with ‘the muscle’, it directs the flow of messaging traffic, and connects to all your upstream SMSC’s, GSM modems, etc.  These upstream SMSC type’s include, by default in Kannel, just to name a few, CIMD2, EMI, SMPP, AT modems, HTTP SMSCs and a few others. Seeing as Kannel is open source with a really flexible license, its easy to write your own custom SMSC’s, but that is way out of the scope of this document 🙂

So today, we will be focusing on getting the bearerbox, to connect to an SMPP server, seems simple enough!

Before you connect to something, you’ll need some basic details which your SMPP service operator will give you. This will include a system-id (username), password, hostname / ip address. This is what is required at minimum. Some operators will also give you things like default character set, system type and so forth. For todays demo I am going to connect to an SMPP server I have setup on my machine (should be fast! :P).

So my details for connection (yours to be provided by operator):

  • IP address : internal.smpp.ddj.co.za
  • System-id (username): donsmpp
  • Password: strngpas
  • Port: 9102

So, at this stage my ‘bearerbox’ configuration looks as follows:


group = core
admin-port = 13000
smsbox-port = 13001
admin-password = bar
log-file = "/tmp/kannel.log"
log-level = 0
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"

group=smsc
smsc=smpp
smsc-id=internal
interface-version=34
host=internal.smpp.ddj.co.za
port=9102
system-id=donsmpp
smsc-password=strngpas
system-type=default
transceiver-mode=1

group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
log-level = 0

Now you’re probably wondering where those other config settings came from, I’ll attempt to give you a really quick explanation.

  • group = core, all settings under this group, are related to the core bearerbox configuration, ie which ports to listen on, log level etc, as you can see I have put the log-level on 0 which will give me tons of debugging information which is pretty useful (not recommended for production servers though :))
  • group = smsbox, this group specifies on which port/ip address to allow inbound connections from smsbox/wapbox/sqlbox/smppbox (see architecture) and isn’t really covered in this post, maybe next time 🙂
  • So that just leaves our smsc group, which is to connect to our smpp server. I’ll quickly try to explain the non trivial configuration directives.
    • smsc-id – this is a name given to the smsc, which can be used later for routing etc
    • interface-version – This is to tell us what version of SMPP to speak to the server with, I have specified 34 which indicates version 3.4
    • system-type – This is required by Kannel, but its not always required by the server, I have just specified a ‘junk’ value to stop Kannel from complaining.
    • trancseiver-mode – This indicates that I want to bind as a transceiver to the server (as opposed to transmitter / receiver) what this will allow me to do is send AND receive messages over the same connection. This is a SMPP 3.4 specific option.

I’m sure you’re tired of reading now and just want to see ! So let’s start this sucker up. I will start it up from command line, some of you (using Ubuntu, CentOS etc) will start it via init scripts, ie, /etc/init.d/kannel start, I will start it up simply by executing /usr/local/sbin/bearerbox /opt/kannel/etc/my_bbox.conf – this will of course only start the bearerbox, not the smsbox/wapbox, etc. Here we go!


2008-12-05 09:26:08 [28431] [6] DEBUG: Thread 6 (gw/smsc/smsc_smpp.c:io_thread) maps to pid 28431.
2008-12-05 09:26:08 [28431] [6] DEBUG: SMPP[internal]: Sending PDU:
2008-12-05 09:26:08 [28431] [6] DEBUG: SMPP PDU 0x50dab0 dump:
2008-12-05 09:26:08 [28431] [6] DEBUG: type_name: bind_transceiver
2008-12-05 09:26:08 [28431] [6] DEBUG: command_id: 9 = 0x00000009
2008-12-05 09:26:08 [28431] [6] DEBUG: command_status: 0 = 0x00000000
2008-12-05 09:26:08 [28431] [6] DEBUG: sequence_number: 1 = 0x00000001
2008-12-05 09:26:08 [28431] [6] DEBUG: system_id: "donsmpp"
2008-12-05 09:26:08 [28431] [6] DEBUG: password: "strngpas"
2008-12-05 09:26:08 [28431] [6] DEBUG: system_type: "default"
2008-12-05 09:26:08 [28431] [6] DEBUG: interface_version: 52 = 0x00000034
2008-12-05 09:26:08 [28431] [6] DEBUG: addr_ton: 0 = 0x00000000
2008-12-05 09:26:08 [28431] [6] DEBUG: addr_npi: 0 = 0x00000000
2008-12-05 09:26:08 [28431] [6] DEBUG: address_range: NULL
2008-12-05 09:26:08 [28431] [6] DEBUG: SMPP PDU dump ends.
2008-12-05 09:26:08 [28431] [6] DEBUG: SMPP[internal]: Got PDU:
2008-12-05 09:26:08 [28431] [6] DEBUG: SMPP PDU 0x50dab0 dump:
2008-12-05 09:26:08 [28431] [6] DEBUG: type_name: bind_transceiver_resp
2008-12-05 09:26:08 [28431] [6] DEBUG: command_id: 2147483657 = 0x80000009
2008-12-05 09:26:08 [28431] [6] DEBUG: command_status: 0 = 0x00000000
2008-12-05 09:26:08 [28431] [6] DEBUG: sequence_number: 1 = 0x00000001
2008-12-05 09:26:08 [28431] [6] DEBUG: system_id: "DDJSMPP"
2008-12-05 09:26:08 [28431] [6] DEBUG: SMPP PDU dump ends.
2008-12-05 09:26:12 [28431] [6] DEBUG: SMPP[internal]: Sending unbind:
2008-12-05 09:26:12 [28431] [6] DEBUG: SMPP PDU 0x50dab0 dump:
2008-12-05 09:26:12 [28431] [6] DEBUG: type_name: unbind
2008-12-05 09:26:12 [28431] [6] DEBUG: command_id: 6 = 0x00000006
2008-12-05 09:26:12 [28431] [6] DEBUG: command_status: 0 = 0x00000000
2008-12-05 09:26:12 [28431] [6] DEBUG: sequence_number: 2 = 0x00000002
2008-12-05 09:26:12 [28431] [6] DEBUG: SMPP PDU dump ends.
2008-12-05 09:26:12 [28431] [6] DEBUG: SMPP[internal]: io_thread: break and shutting down
2008-12-05 09:26:12 [28431] [6] DEBUG: Thread 6 (gw/smsc/smsc_smpp.c:io_thread) terminates.

Success! Due to the log level, being on debug, we can see almost too much info, but great because our bind was successful! Our bearerbox is now bound to the SMPP server and ready to start sending messages. The great thing about Kannel is, its built in status page, so even if you don’t see this output, you can browse to the local web status page, http://<host>:<port>/status (or http://localhost:13000/status in my case) which will give you an output like this:

Kannel bearerbox version `cvs-20080824′.
Build `Sep 7 2008 12:04:32′, compiler `4.0.1 (Apple Inc. build 5465)’.
System Darwin, release 9.5.0, version Darwin Kernel Version 9.5.0: Wed Sep 3 11:29:43 PDT 2008; root:xnu-1228.7.58~1/RELEASE_I386, machine i386.
Hostname donald-jacksons-macbook-pro-6.local, IP 192.168.1.82.
Libxml version 2.6.16.
Using OpenSSL 0.9.7l 28 Sep 2006.
Compiled with MySQL 5.0.67, using MySQL 5.0.67.
Using native malloc.

Status: running, uptime 0d 0h 0m 55s

WDP: received 0 (0 queued), sent 0 (0 queued)

SMS: received 0 (0 queued), sent 0 (0 queued), store size -1

SMS: inbound 0.00 msg/sec, outbound 0.00 msg/sec

DLR: 0 queued, using internal storage

No boxes connected

SMSC connections:

    internal    SMPP:internal.smpp.ddj.co.za:9102/9102:donsmpp:default (online 55s, rcvd 0, sent 0, failed 0, queued 0 msgs)

As you can see by this status output, I have no smsbox’s connected and am just demonstrating the bearerbox part. I will probably do a part 3 tutorial which will cover configuring smsbox and sending a few messages.

If you have any questions for me I’ll be happy to answer, even via comments or email. I hope this helps some of you connect your Kannel instances!

Technorati Tags: , , , , , Glucophage


4 Comments

  1. Tim

    2008/12/29

    Wondering what you are using for your smpp server? We are using kannel right now and looking to buy the smppbox component add-on. Do you have any reccomendations

  2. hassan

    2009/01/19

    what do these two lines mean??

    2008-12-05 09:26:12 [28431] [6] DEBUG: SMPP[internal]: io_thread: break and shutting down
    2008-12-05 09:26:12 [28431] [6] DEBUG: Thread 6 (gw/smsc/smsc_smpp.c:io_thread) terminates.

  3. Eddy

    2009/04/03

    Hi,

    I really appreciated this post. I am planning a project where I will need a robust smpp component for Kannel. Any recommendation where to buy the SMPPBox?

    Would you be interested in evaluating what it would take to develop an "smppdaemon" for Kannel and open source the code there after.

    If interested in undertaking such project, please contact me back.

    Regards,

  4. tina

    2009/09/04

    Hi ,

    Your article was really helpful .Since standard kannel doesnt support SMPP ,could you help me know where i can get the SMPP server. From my understanding i have come to the conclusion that just by giving the parameters in smskannel.conf we cant get smpp support ,we need a server running . i need to test smpp on my pc for kannel gateway could you clear me with how to do it .


Would you like to share your thoughts?

Would you like to share your thoughts?

Leave a Reply