MobicentsSMPPRA < Communications < TWiki

TWiki . Communications . MobicentsSMPPRA

Introduction

The Short Message Peer to Peer (SMPP) protocol is an open, industry standard protocol designed to provide a flexible data communications interface for transfer of short message data between a Message Center, such as a Short Message Service Centre (SMSC), GSM Unstructured Supplementary Services Data (USSD) Server or other type of Message Centerand a SMS application system, such as a WAP Proxy Server, EMail Gateway or other Messaging Gateway.

Using the SMPP protocol, an SMS application system called the �External Short Message Entity� (ESME) may initiate an application layer connection with an SMSC over a TCP/IP network connection and may then send short messages and receive short messages to and from the SMSC respectively. The ESME may also query, cancel or replace short messages using SMPP. SMPP supports a full featured set of two-way messaging functions such as:

SMPP Resource Adaptor

The SMPP Resource adaptor adopts SMSC to the requirements of the SLEE and built on top of the implementation of the SMPP. The source code for the core SMPP stack implementation can be found at http://smppapi.sourceforge.net. The source code of the RA implementation located https://mobicents.dev.java.net/source/browse/mobicents/ra/smppra/. The SMPP RA defines the follwing resource adaptor concepts.

SMPP Resource Adaptor Type

Resource adaptor type identifier

The resource adaptor type name is "SMPPResourceAdaptor". The resource adaptor type vendor is "net.java". The resource adaptor type version is "3.4".

Activity objects

The activity objects for SMPP resource adaptor are net.java.slee.resource.smpp.ClientTransaction, net.java.slee.resource.smpp.ServerTransaction and net.java.slee.resource.smpp.Dialog The transaction objects belong to transaction which handles the requests and responses, Dialog object belongs to session established between mobile station and ESME.

Events

The following table lists the events emitted by a SMPP resource.
Events Activity object
  Client Transaction ServerTransaction? Dialog
net.java.slee.resource.smpp.DELIVER_SM   X  
net.java.slee.resource.smpp.DELIVER_SM_RESP X    
net.java.slee.resource.smpp.SUBMIT_SM   X  
net.java.slee.resource.smpp.SUBMIT_SM_RESP X    
net.java.slee.resource.smpp.DATA_SM   X  
net.java.slee.resource.smpp.DATA_SM_RESP X    
net.java.slee.resource.smpp.QUERY_SM   X  
net.java.slee.resource.smpp.SQUERY_SM_RESP X    
net.java.slee.resource.smpp.CANCEL_SM   X  
net.java.slee.resource.smpp.CANCEL_SM_RESP X    
net.java.slee.resource.smpp.REPLACE_SM   X  
net.java.slee.resource.smpp.REPLACE_SM_RESP X    
net.java.slee.resource.smpp.MESSAGE     X
net.java.slee.resource.smpp.DELIVERY_REPORT     X

Event types

The event type is a message name with package prefix net.java.slee.resource.smpp, the event type vendor is net.java and version is 1.1

Event classes

The event class for these events are

Activity Context Interface Factory Interface

The Activity Context Interface Factory Interface looks :

import javax.slee.ActivityContextInterface;
import javax.slee.FactoryException;
import javax.slee.UnrecognizedActivityException;

public interface RadiusActivityContextInterfaceFactory {
    public ActivityContextInterface getActivityContextInterface(ClientTransaction tx)
        throws NullPointerException, UnrecognizedActivityException, FactoryException;
    
    public ActivityContextInterface getActivityContextInterface(ServerTransaction tx)
        throws NullPointerException, UnrecognizedActivityException, FactoryException;

    public ActivityContextInterface getActivityContextInterface(Dialog dialog)
        throws NullPointerException, UnrecognizedActivityException, FactoryException;

}

Resource adaptor object

Resource adaptor object is net.java.slee.resource.smpp.Provider

Configuration

The SMPP RA is compliant with JSLEE 1.1 specifcation style provisioning. The RA's configuration properties are as follows:

The SLEE administartor can override default settings of the resource adaptor entity at the deployment time. The one way is consisted in specifying the URL pointed to properties file as an argument to the CLI's method createResourceAdaptorEntity().

Example

The real-time communication is signficant attribute of the modern life. Initially, instant messaging applications began to appear in the 1970s on multi-user operating systems such as UNIX, to facilitate communication with other users logged in to the same machine, then on the local network, and subsequently across the Internet. Currently, there are a lot of communication islands in the Internet such as Skype or Google Talk wich are already widely used for text messaging. From other hand, the mobile phones also very used by peoples and short message service may be adopted for the Google Talk to allow to reache user using mobile network. So we can extend GoogleTalk?-Bot example application in such a way as to forward messages received from GoogleTalk? user to mobile subsciber and, inversely, forward messages received from mobile subscriber to GoogleTalk? user.

We will work in a "client" mode. It is not a matter for this example application but it just means that GoogleTalk? users will see mobile domain as virtual user, and this user should be registered in the contact list. Same is for the mobile subscriber, there is a predefined mobile number (short or full) wich will serves as gateway to the GoogleTalk? domain. And in both cases, the additional, native for other side, address should be specified in the message body to allow recognize the recipient of the message. So the follwing message format may be adopted for the gateway:

addressString Message_text

where addressString is native for the domain user address: The mobile number in E164 format for messages addressed to mobile user and gmail address for messages addressed to GoogleTalk? user.

Source code

The full source code can be found at https://mobicents.dev.java.net/source/browse/mobicents-examples/smpp-example

Accesing resource adaptor from Sbb

Sbb explicitly lookup resource adaptor object using resource-adaptor-entity-binding element in the SBB's deployment descriptor.
public void setSbbContext(SbbContext sbbContext) {
        this.sbbContext = sbbContext;
        try {
            logger.info("Called setSbbContext PtinAudioConf!!!");
            Context myEnv = (Context) new InitialContext().lookup("java:comp/env");
            xmppProvider = (XmppResourceAdaptorSbbInterface) 
                    myEnv.lookup("slee/resources/xmpp/2.0/xmppinterface");
            smppProvider = (SmppProvider) 
                    myEnv.lookup("slee/resources/smpp/3.4/smppinterface");            
            smppAcif = (ActivityContextInterfaceFactory) 
                    myEnv.lookup("slee/resources/smpp/3.4/factoryprovider");
        } catch (NamingException ne) {
            logger.warn("Could not set SBB context:" + ne.getMessage());
        }
}

Handling server transactions

Each time message received from SMSC, the resource adaptor emits DELIVER_SM message. The RequestEvent event object may be used to get direct access to the activity object ServerTransaction. The event handler method respond to the SMSC using transaction's respond(int) method.

    public void onSmsMessage(RequestEvent event, ActivityContextInterface aci) {
            logger.info("Sending message to " + address);
            ....
            event.getTransaction().respond(Transaction.OK);
    }

Handling client transactions

The SmppProvider object should be used to prepare outgoing message and a client transaction. Here we assume that 0020 specifies the number of ESME as RA entity is configured. The ActivityContextInterfaceFactory used to allow to this Sbb handle events related to the client transaction.

    public void onGoogleMessage(Message message, ActivityContextInterface aci) {
        Dialog dialog = smppProvider.getDialog(address, "0020");
        
        ShortMessage sms = dialog.createMessage();
        sms.setText(txt);
        
        ClientTransaction tx = dialog.createSubmitSmTransaction();
        ActivityContextInterface ac = smppAcif.getActivityContextInterface(tx);
        ac.attach(sbbContext.getSbbLocalObject());
        tx.send(sms);
}

Howto install, setup and run

Now use the "Mobile landscape" thml page, shipped with SMPPSim, to send a message (like from mobile device). Put 0020 to the destination_address field and type your message in the short_message field. The message format specified above should be used. For example: some_user@gmail.com hi. The message "hi" will be delivered, you can then answer typing in the GoogleTalk? the mobile address of the recipient and message body.

Related resources

Waht's next.

Improve implementation quality. Currently, the SMPPA operates in a client mode. This means that it can't be used to implement logic on the server (SMSC) side. But the core SMPP API can be extended with this feature.

-- Main.ivelin - 06 Jul 2006

----- Revision r14 - 09 Jan 2009 - 17:33:15 - Main.flibuste