ServiceMix SMPP
The ServiceMix SMPP component provides support for receiving and sending SMS using the SMPP protocol via the enterprise service bus. It uses the jSMPP library.
Maven Archetype
You can use Maven servicemix-smpp-service-unit archetype to create a SMPP service unit:
Code Block |
---|
mvn archetype:create \
-DarchetypeGroupId=org.apache.servicemix.tooling \
-DarchetypeArtifactId=servicemix-smpp-service-unit \
-DarchetypeVersion=2010.01 \
-DgroupId=your.group.id \
-DartifactId=your.artifact.id \
-Dversion=your-version
|
Once you've customized the service unit, simply install the SU:
Info |
---|
Remember that to be deployable in ServiceMix, the ServiceUnit has to be embedded in a Service Assembly: only the Service Assembly zip file can be deployed in ServiceMix. To add your SU in a SA, you need to define it in the dependency sets: Code Block |
---|
<dependency>
<groupId>your.group.id</groupId>
<artifactId>your.artifact.id</artifactId>
<version>your-version</version>
</dependency>(servicemix-smmp 2010.02 or newer)
|
|
Endpoints Configuration
Consumer Endpoint
A SMPP Consumer endpoint connects to a SMPP server, waiting for incoming SMS message. When a SMS message comes, the endpoint converts it into a JBI message (using the marshaler) and send to the NMR.
Currently, the SMPP Consumer endpoint only supports the DELIVERY_SM protocol data unit, which will acknowledge positive even if the exchange fails.
Code Block |
---|
lang | xml |
---|
title | Consumer Endpoint |
---|
|
<smpp:consumer service="test:service"
endpoint="endpoint"
host="smpp.example.com"
port="2700"
systemId="user"
password="passwd"/>
|
Info |
---|
title | Consumer Endpoint Attributes |
---|
borderStyle | solidbgColor='lightblue' |
---|
|
Name | Type | Description | Default |
---|
service | QName | the service name of the endpoint | require to be spec'd | endpoint | string | the endpoint name of the endpoint | require to be spec'd | targetService | QName | the service name of the target endpoint | | targetEndpoint | string | the endpoint name of the target endpoint | | host | string | the SMPP server hostname/IP | require to be spec'd | port | int | the SMPP server port number | 2700 | systemId | string | the SMPP user system ID | require to be spec'd | password | string | the SMPP user password | require to be spec'd | marshaler | class | org.apache.servicemix.smpp.marshaler.SmppMarshalerSupport | DefaultSmppMarshaler |
|
Provider Endpoint
A SMPP Provider endpoint expects messages coming from the NMR, converts it into a SMS message (using the marshaler) and send to the SMPP server.
Currently, the SMPP Provider endpoint only supports the SUBMIT_SM protocol data unit. Positive or negative acknowledgements received from the SMSC will set the Exchange status to DONE or ERROR. For InOut Exchanges the OUT NormalizedMessage is a copy of IN message.
Code Block |
---|
lang | xml |
---|
title | Provider Endpoint |
---|
|
<smpp:provider service="test:service"
endpoint="endpoint"
host="smpp.example.com"
port="2700"
systemId="user"
password="passwd"/>
|
Info |
---|
title | Provider Endpoint Attributes |
---|
borderStyle | solidbgColor='lightblue' |
---|
|
Name | Type | Description | Default |
---|
service | QName | the service name of the endpoint | require to be spec'd | endpoint | string | the endpoint name of the endpoint | require to be spec'd | targetService | QName | the service name of the target endpoint | | targetEndpoint | string | the endpoint name of the target endpoint | | host | string | the SMPP server hostname/IP | require to be spec'd | port | int | the SMPP server port number | 2700 | systemId | string | the SMPP user system ID | require to be spec'd | password | string | the SMPP user password | require to be spec'd | marshaler | class | org.apache.servicemix.smpp.marshaler.SmppMarshalerSupport | DefaultSmppMarshaler |
|
Marshalers
By default, SMPP endpoints expect (and generate) the content of the message in XML format. The XML message looks like:
Code Block |
---|
|
<message>
<source>SOURCE_PHONE_NUMBER</source>
<destination>DESTINATION_PHONE_NUMBER</destination>
<text>MESSAGE_CONTENT</text>
<npi>NATIONAL_PREFIX_INDICATOR</npi>
<ton>TYPE_OF_NUMBER</ton>
</message>
|
If you want to manipulate different format, you need to define your own marshaler.
Code Block |
---|
lang | xml |
---|
title | SMPP marshaler example |
---|
|
<?xml version="1.0"?>
<beans xmlns:smpp="http://servicemix.apache.org/smpp/1.0"
xmlns:test="http://test">
<smpp:consumer service="test:smpp"
endpoint="endpoint"
host="smpp.example.com"
port="2700"
systemId="test"
password="test">
<property name="marshaler">
<bean class="org.apache.servicemix.smpp.marshaler.OtherSmppMarshaler"/>
</property>
</smpp:consumer>
</beans>
|
Optional Parameters (for servicemix-smpp 2010.02 or newer)
SMPP provides a set of Optional parameters that can be set on the supported protocol data units. The default SMPP marshaler will treat the optional parameters as Normalized message properties (will copy matching properties from the NormalizedMessage to the PDU and vice versa). Below is a small matrix the presentes the supported optional parameters and how they are mapped to NomralizedMessage properties.
Info |
---|
title | Optional Parameter Support |
---|
borderStyle | solidbgColor='lightblue' |
---|
|
Name | Type | Supported by PDUs | Description |
---|
DEST_ADDR_SUBUNIT | Byte | SUBMIT_SM, DATA_SM | The subcomponent in the destination device for which the user data is intended. | DEST_NETWORK_TYPE | Byte | DATA_SM | The correct network for the destination device. | DEST_BEARER_TYPE | Byte | DATA_SM | The correct bearer type for the delivering the user data to the destination. | DEST_TELEMATICS_ID | Short | DATA_SM | The telematics identifier associated with the destination. | SOURCE_ADDR_SUBUNIT | Byte | SUBMIT_SM, DATA_SM | The subcomponent in the destination device which created the user data. | SOURCE_NETWORK_TYPE | Byte | DATA_SM | The correct network associated with the originating device. | SOURCE_BEARER_TYPE | Byte | DATA_SM | The correct bearer type for the delivering the user data to the destination. | SOURCE_TELEMATICS_ID | Byte | DATA_SM | The telematics identifies associated with the source. | QOS_TIME_TO_LIVE | Integer | DATA_SM | Time to live as a relative time in seconds from submission. | PAYLOAD_TYPE | Byte | SUBMIT_SM, DELIVERY_SM, DATA_SM | Defines the type of payload (e.g. WDP, WCMP, etc.). | ADDITIONAL_STATUS_INFO_TEXT | String | DATA_SM_RESP | ASCII text giving a description of the meaning of he response | RECEIPTED_MESSAGE_ID | String | DELIVERY_SM | SMSC message ID of receipted message Should be present for SMSC Delivery Receipts and Intermediate Notifications. | MS_MSG_WAIT_FACILITIES | Byte | SUBMIT_SM | This parameter controls the indication and specifies the message type (of the message associated with the MWI) at the mobile station. | PRIVACY_INDICATOR | Byte | SUBMIT_SM, DELIVERY_SM, DATA_SM | Indicates the level of privacy associated with the message. | SOURCE_SUBADDRESS | String | SUBMIT_SM, DELIVERY_SM, DATA_SM | The subaddress of tmessage originator. | DEST_SUBADDRESS | String | SUBMIT_SM, DELIVERY_SM, DATA_SM | The subaddress of tmessage destination. | USER_MESSAGE_REFERENCE | Short | SUBMIT_SM, DELIVERY_SM, DATA_SM | ESME asginged message reference number. | USER_RESPONSE_CODE | Byte | SUBMIT_SM , DATA_SM | A user response code. | SOURCE_PORT | Short | SUBMIT_SM, DELIVERY_SM, DATA_SM | Indicates the application port number associated with the source address of the message. This parameter should be present for WAP applications. | DESTINATION_PORT | Short | SUBMIT_SM, DELIVERY_SM, DATA_SM | Indicates the application port number associated with the destination address of the message. This parameter should be present for WAP applications. | LANGUAGE_INDICATOR | Byte | SUBMIT_SM, DELIVERY_SM, DATA_SM | Indicates the language of an alphanumeric text message. | SAR_MSG_REF_NUM | Byte | SUBMIT_SM, DATA_SM | The reference number for a particular concatenated short message. | SAR_TOTAL_SEGMENTS | Byte | SUBMIT_SM, DATA_SM | Indicates the total number of short messages within the concatenated short message. | SAR_SEGMENT_SEQNUM | Byte | SUBMIT_SM, DATA_SM | Indicates the sequence number of a particular short message fragment within the concatenated short message. | SC_INTERFACE_VERSION | Byte | BIND (not applicable) | Smmp version supported by the SMSC (not applicable) | CALLBACK_NUM_PRES_IND | String | SUBMIT_SM, DATA_SM | Defines the callback number presentation and screening. | CALLBACK_NUM_ATAG | String | SUBMIT_SM, DATA_SM | Associates a displayable alphanumeric tag with the callback number. | NUMBER_OF_MESSAGES | Byte | SUBMIT_SM, DATA_SM | Indicates the number of messages stored in a mail box. | CALLBACK_NUM | String | SUBMIT_SM, DELIVERY_SM, DATA_SM | A callback number associated with the short message. Smpp supports multiple occurances of this parameter per message, but servicemix-smmp only supports once per message. | DPF_RESULT | String | DATA_SM_RESP | Indicates whether the Delivery Pending Flag was set. | SET_DPF | String | DATA_SM | Indicator for setting Delivery Pending Flag on delivery failure. | MS_AVAILABILITY_STATUS | Byte | QUERY_SM | The status of the mobile station. | NETWORK_ERROR_CODE | String | DELIVERY_SM, DATA_SM | Network Error Code. May be present for Intermediate Notifications and SMSC Delivery Receipts. | MESSAGE_PAYLOAD | String | SUBMIT_SM, DELIVERY_SM, DATA_SM | Contains the extended short message user data. Up to 64K octets can be transmitted. | DELIVERY_FAILURE_REASON | Byte | DATA_SM_RESP | Include to indicate reason for delivery failure. | MORE_MESSAGES_TO_SEND | Byte | SUBMIT_SM, DATA_SM | Indicates that there are more messages to follow for the destination SME. | MESSAGE_STATE | Byte | DELIVERY_SM | Message State. Should be present for SMSC Delivery Receipts and ntermediate Notifications. | USSD_SERVICE_OP | Byte | SUBMIT_SM | This parameter is used to identify the required USSD Service type when interfacing to a USSD system. | DISPLAY_TIME | Byte | SUBMIT_SM, DATA_SM | Provides the receiving MS with a display time associated with the message. | SMS_SIGNAL | Byte | SUBMIT_SM, DATA_SM | Indicates the alerting mechanism when the message is received by an MS. | MS_VALIDITY | Byte | SUBMIT_SM | Indicates validity information for this message to the recipient MS. | ALERT_ON_MESSAGE_DELIVERY | Null | SUBMIT_SM, DATA_SM | Request an MS alert signal be invoked on message delivery. | ITS_REPLY_TYPE | Byte | SUBMIT_SM, DELIVERY_SM, DATA_SM | The MS user’s reply method to an SMS delivery message received from the network is indicated and controlled by this parameter. | ITS_SESSION_INFO | Byte | SUBMIT_SM, DELIVERY_SM, DATA_SM | Session control information for Interactive Teleservice. |
|
Note: DATA_SM, QUERY_SM and and response PDUs are not currently supported.