JBoss.orgCommunity Documentation
SMPP5 Resource Adaptor Type is defined by Mobicents team as part of effort to standardize RA Types.
An SMPP activity object represents a set of related events in an SMPP resource. This RA Type defines the following Activity objects:
The SmppTransaction represents the message
submitted/received and corresponding message
response received/submitted. The Activity begins
when ResourceAdaptor receives a SMS Request and
fires the corresponding event to SBB and ends as
soon as listening SBB sends back Response.If there
is no SBB listening for this event, the timeout
occurs and Activity is killed. Other way is Activity
is started as soon as SBB sends SMS message and ends
once RA receives the message response or timeout
occurs, which ever is first. Class name is
net.java.slee.resources.smpp.SmppTransaction
New
SmppTransaction
Activity objects are created by calling
SmppSession.sendRequest(SmppRequest request)
This method is called by application that wants to
send new SMS message.
SmppTransaction
Activity objects are created automatically when the
resource adaptor receives an incoming SMS message.
Events represent SMPP message or response to message and Timer
expiry. Each SMPP message and response is fired as different
event types. Events are fired on
SmppTransaction
activity. Following is the table that describes event-type
(name, vendor and version), event-class.
Spaces where introduced in
Name
and
Event Class
column values, to correctly render the table. Please remove
them when using copy/paste.
For proper render of this table prefixes, for entries on some columns are ommited. For prefix values, for each column, please see list below:
net.java.slee.resources.smpp.
net.java.slee.resources.smpp.pdu.
Version for all defined events is 5.0
Vendor for all defined events is net.java.
Table 2.1. Events fired by SMPP5
Name | Event Class | Comments |
---|---|---|
ALERT_ NOTIFICATION | AlertNotification | This message is sent by the SMSC to the ESME, when the SMSC has detected that a particular mobile subscriber has become available and a delivery pending flag had been set for that subscriber from a previous data_sm operation. |
GENERIC_NACK | GenericNack | This is a generic negative acknowledgement to an SMPP PDU submitted with an invalid message header. |
DELIVER_SM | DeliverSM | The deliver_sm is issued by the SMSC to send a message to an ESME. Using this command, the SMSC may route a short message to the ESME for delivery. |
DELIVERY_REPORT | DeliverSM | SMSC Delivery Receipt. A delivery receipt relating to a a message which had been previously submitted with the submit_sm operation and the ESME had requested a delivery receipt via the registered_delivery parameter. The delivery receipt data relating to the original short message will be included in the short_message field of the deliver_sm. |
DELIVER_SM _RESP | DeliverSMResp | The SMPP PDU response sent from an ESME that received DELIVER_SM message |
SUBMIT_SM | SubmitSM | This operation is used by an ESME to submit a short message to the SMSC for onward transmission to a specified short message entity (SME). |
SUBMIT_SM _RESP | SubmitSMResp | This is the response to the submit_sm PDU |
DATA_SM | DataSM | This command is used to transfer data between the SMSC and the ESME. It may be used by both the ESME and SMSC. This command is an alternative to the submit_sm and deliver_sm commands. It is introduced as a new command to be used by interactive applications such as those provided via a WAP framework. |
DATA_SM _RESP | DataSMResp | This is the response to the data_sm PDU |
SUBMIT_MULTI | SubmitMulti | The submit_multi operation may be used to submit an SMPP message for delivery to multiple recipients or to one or more Distribution Lists |
SUBMIT_MULTI _RESP | SubmitMultiResp | This is the response to the submit_multi PDU |
QUERY_SM | QuerySM | This command is issued by the ESME to query the status of a previously submitted short message. |
QUERY_SM _RESP | QuerySMResp | This is the response to the query_sm PDU |
CANCEL_SM | CancelSM | This command is issued by the ESME to cancel one or more previously submitted short messages that are still pending delivery. |
CANCEL_SM _RESP | CancelSMResp | This is the response to the cancel_sm PDU |
REPLACE_SM | ReplaceSM | This command is issued by the ESME to replace a previously submitted short message that is still pending delivery. |
REPLACE_SM _RESP | ReplaceSMResp | This is the response to the replace_sm PDU |
BROADCAST_SM | BroadcastSM | This operation is issued by the ESME to submit a message to the Message Centre for broadcast to a specified geographical area or set of geographical areas. |
BROADCAST_ SM_RESP | BroadcastSMResp | This is the response to the broadcast_sm PDU |
QUERY_BROAD CAST_SM | QueryBroadcastSM | This command is issued by the ESME to query the status of a previously submitted broadcast message |
QUERY_BROADCAST _SM_RESP | QueryBroadcastSMResp | This is the response to the query_broadcast_sm PDU |
CANCEL_BROAD CAST_SM | CancelBroadcastSM | This command is issued by the ESME to cancel a broadcast message which has been previously submitted to the Message Centre for broadcast via broadcast_sm and which is still pending delivery. |
CANCEL_BROAD CAST_SM_RESP | CancelBroadcastSMResp | This is the response to the cancel_broadcast_sm PDU |
SMPP_TIMEOUT_ RESPONSE_SENT | SmppError | This is issued when ESME receives SMPP PDU and doesn't send the corresponding response in configured time limit |
SMPP_TIMEOUT_ RESPONSE_RECEIVED | SmppError | This is issued when ESME has sent SMPP PDU but there is no corresponding response from SMSC in configured time limit |
The interface of the SMPP resource adaptor type specific Activity Context Interface Factory is defined as follows:
package net.java.slee.resources.smpp; public interface SmppTransactionACIFactory { javax.slee.ActivityContextInterface getActivityContextInterface(SmppTransaction txn); }
The SMPP Resource Adaptor SBB Interface facilitates SBBs to create new SMS message and send it. It also facilitates sending of SMS message response. The isAlive() is check for connection between RA and SMSC is still alive. It is defined as follows:
package net.java.slee.resources.smpp; import net.java.slee.resources.smpp.pdu.Address; import net.java.slee.resources.smpp.pdu.SmppRequest; import net.java.slee.resources.smpp.pdu.SmppResponse; public interface SmppSession { public String getSessionId(); public String getSMSCHost(); public int getSMSPort(); public SmppTransaction sendRequest(SmppRequest request) throws java.lang.IllegalStateException, java.lang.NullPointerException, java.io.IOException; public void sendResponse(SmppTransaction txn, SmppResponse response) throws java.lang.IllegalStateException, java.lang.NullPointerException, java.io.IOException; public boolean isAlive(); public SmppRequest createSmppRequest(long commandId); public Address createAddress(int addTon, int addNpi, String address); }
Sbb explicitly lookup resource adaptor object using resource-adaptor-entity-binding element in the SBB's deployment descriptor
SmppTransactionACIFactory smppAcif; SmppSession smppSession; public void setSbbContext(SbbContext sbbContext) { this.sbbContext = sbbContext; try { logger.info("Called setSbbContext PtinAudioConf!!!"); Context myEnv = (Context) new InitialContext().lookup("java:comp/env"); smppSession = (SmppSession) myEnv.lookup("slee/resources/smpp/5.0/smppSession"); smppAcif = (SmppTransactionACIFactory) myEnv.lookup("slee/resources/smpp/5.0/factoryprovider"); } catch (NamingException ne) { logger.warn("Could not set SBB context:" + ne.getMessage()); } }
Each time message received from SMSC, the resource adaptor emits DELIVER_SM message. The DeliverSM event object is used to create the corresponding response DeliverSMResp passing the command_status. The SmppTransaction can be retrieved from ActivityContextInterface object. The SmppSession retrieved from SmppTransaction is used to send back the response. Once the response is sent, the Activity dies.
public void onSmsMessage(DeliverSM event, ActivityContextInterface aci) { .... DeliverSMResp resp = event.createSmppResponseEvent(SmppTransaction.ESME_ROK); SmppTransaction txn = (SmppTransaction)aci.getActivity(); txn.getSmppSession().sendResponse(txn, response); }
The SmppSession object should be used to prepare outgoing message and a SmppTransaction.
public void onSomeEvent(SomeEvent event, ActivityContextInterface aci) { SubmitSM submitSm = (SubmitSM)smppSession.createSmppRequest(SmppRequest.SUBMIT_SM); Address esmeAddress = smppSession.createAddress(1, 0, "501"); Address destAddress = smppSession.createAddress(1, 0, "919960666666"); submitSm.setEsmeAddress(esmeAddress); submitSm.setEsmeAddress(destAddress); submitSm.setMessage("Hello World".getBytes()); SmppTransaction submitTxn = smppSession.sendRequest(submitSm); // attach to the new activity so we get the response ActivityContextInterface newaci = smppAcif.getActivityContextInterface(submitTxn); newaci.attach(getSbbLocalObject()); }