Sms transport provider can be used for sending sms messages thru a mobile phone that is connected to the computer via a COM port (USB, BlueTooth,...).
This provider uses the SMSLib library (http://smslib.sourceforge.net/) to connect to the mobile phone. Before the transport provider can be used this library has to be installed, more information seehttp://smslib.sourceforge.net/howto_java_installation.shtml.
In some cases it is necessary to clear the inbox of the mobile phone in order for the receiver to work properly.
Sms connector properties
| Property |
Description |
Default |
Required |
| pollingFrequency |
The delay in milliseconds that will be used during two subsequent polls on the mobile phone by the sms connector. |
60000 msec |
No |
| gsmCom |
COM port on which the mobile phone is connected to the computer. |
COM40 |
No |
| gsmBaudrate |
Baudrate used to communicate with the mobile phone. |
57600 |
No |
| gsmManufacturer |
Mobile phone manufacturer |
Nokia |
No |
| gsmModel |
Mobile phone model. |
|
No |
| deleteReadMessages |
Indicates if sms are removed from the mobile phone after it is received by the sms connector. |
false |
No |
| reconnect |
Indicates if the connector should connect/disconnect before/after every polling, receiving and sending of an sms. |
false |
No |
Below is a sample configuration:
<connectorname="smsConnector"className="org.mule.providers.sms.SmsConnector">
<properties>
<propertyname="pollingFrequency"value="120000"/>
<propertyname="gsmCom"value="COM40"/>
<propertyname="gsmBaudrate"value="57600"/>
<propertyname="gsmManufacturer"value="Nokia"/>
<propertyname="gsmModel"value="Nokia6230i"/>
<propertyname="deleteReadMessages"value="true"/>
<propertyname="reconnect"value="false"/>
</properties>
</connector>
For the moment it's best to use the connector with the property "reconnect" set to false, in this case the connector connects on startup to the mobile phone. In this configuration it is only possible to use or the receiver or the sender. If both receiver and sender should be used the "reconnect" property should be set to true, in this case the connector makes a new connection on receipt/dispatch of a message and disconnects immediately after receipt/dispath.
Sms Endpoints
The information necessary to send the sms is retreived from the mule message (see below) or from the address of the endpoint:
sms://+32496250169
This telephone number is the receipients telephone number. When the SmsProperties.SMS_SENDER property on the mule message is set the phone number in the endpoint address will be ignored.
Reveiving/Polling sms messages
New messages are read from the mobile phone on a regular basis:
<mule-descriptorname="smsPoller"implementation="org.mule.components.simple.BridgeComponent">
<inbound-router>
<endpointaddress="sms://+32496250169"/>
</inbound-router>
<outbound-router>
<routerclassName="org.mule.routing.outbound.OutboundPassThroughRouter">
<endpointaddress="stream://System.out"/>
</router>
</outbound-router>
</mule-descriptor>
When a message is received the following properties are available on the Mule message by calling the message.getProperty("propertyName") method:
| SMSProperties.SMS_DATE |
Date of the incomming sms. |
| SMSProperties.SMS_ENCODING |
Encoding of the incomming sms. |
| SMSProperties.SMS_ID |
ID of the incomming sms on the mobile phone. |
| SMSProperties.SMS_SENDER |
The phone number of sender of the incomming sms. |
Sending sms messages
<mule-descriptorname="smsSender"implementation="org.mule.components.simple.BridgeComponent">
<inbound-router>
<endpointaddress="stream://System.in"/>
</inbound-router>
<outbound-router>
<routerclassName="org.mule.routing.outbound.OutboundPassThroughRouter">
<endpointaddress="sms://+32496250169"/>
</router>
</outbound-router>
</mule-descriptor>
The following properties can be set on the outgoing sms message:
| SMSProperties.SMS_STATUSREPORT |
Indicates if a status report is received after sending the sms. |
| SMSProperties.SMS_RECEIVER |
The phone number of the receipient of the sms message, if this propertie is set the phone number in the endpoint address is ignored. |
| SMS_RECEIVER.SMS_FLASH |
Indicaties if the sms message should be send as a flash message, in this case the message appears directly on the screen of the mobile of the receiver. |