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):
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.
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: Kannel, SMPP, Architecture, Smsbox, Bearerbox, SMS Glucophage
Would you like to share your thoughts?
4 Comments