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:
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:
mvn install
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:
<dependency> <groupId>your.group.id</groupId> <artifactId>your.artifact.id</artifactId> <version>your-version</version> </dependency>
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.
<smpp:consumer service="test:service" endpoint="endpoint" host="smpp.example.com" port="2700" systemId="user" password="passwd"/>
Consumer Endpoint Attributes
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.
<smpp:provider service="test:service" endpoint="endpoint" host="smpp.example.com" port="2700" systemId="user" password="passwd"/>
Provider Endpoint Attributes
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:
<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.
<?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>