essiene / smpp34

An smpp34 library in Erlang. Built on top of smpp34pdu PDU parsing library
20 stars 11 forks source link

smpp34 is an SMPP 3.4 library in Erlang

It is designed to be used along with smpp34pdu library for SMPP 3.4 communications.

It uses smpp34pdu to handle wire-level packing and unpacking, and instead focuses on the task of actually setting up the communication infrastructure as defined by the protocol.

It is a re-write of an internal existing smpp library and is written to solve the problems encountered with said library.

It is currently feature complete and is currently undergoing mandatory maturing out in the wild, as it is being used to develop a real application with hundreds of thousands of transactions a day.

Building

smpp34 is built with rebar, the awesome erlang build tool.

There is a Makefile wrapping up its use, so it plays nice with other build environments.

First clone the sources from git hub:

$ git clone git://github.com/essiene/smpp34.git

Then build: $ cd smpp34 $ make

Installation

Deploy like any other erlang library

Usage/Examples

This library exposes two API sets.

- smpp34_esme - A synchronous client API
- gen_esme34 - An asynchronous client API/behaviour that fits into
               the Erlang/OTP supervision tree.

smpp34_esme

The following is an example of the smpp34_esme client api:

-module(smpp34_example). -export([start/0]).

% We need to include the smpp34pdu PDU record definitions -include_lib("smpp34pdu/include/smpp34pdu.hrl").

start() ->

% first start the smpp34 library application
smpp34:start().

% Then connect to an SMSC to obtain an ESME object
{ok, Esme} = smpp34_esme:connect("localhost", 10001),

% Bind as a transceiver
TrxPdu = #bind_transceiver{system_id="username", password="password"},
ok = smpp34_esme:send(Esme, TrxPdu),

% Retrieve our response
{ok, #pdu{}=RespPdu} = smpp34_esme:recv(Esme),

%close the connection
smpp34_esme:close(Esme).

gen_esme34

smpp34_esme as a synchronous client API, does not fit very well when building an ESME server akin to Kannel. It also does not fit into the Erlang/OTP supervision tree.

gen_esme34 is designed to fill these gaps. It works asynchronously, fits into the Erlang/OTP tree and is intended as a workhorse when building non trivial applications.

Documentation of the internals of gen_esme34 and its design decision is at docs/gen_esme34.txt

Two example ESMEs built with gen_esme34 are available in the source:

Status

Currently the entire concept is fully implemented from end to end. So I would classify this as alpha grade software.

What is left now is intense code review, agressive benchmarking and measurements and the invariably the optimizations and possible redesigns of key sections.

This stage will be driven by using it to build an SMPP 3.4 gateway/application server. I expect it to mature better while that effort is ongoing.