This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Sending SMS Message


[Overview] [Operation details] [Sample configuration]


Overview

The following operation allow you to work with SMPP connector. To find more details on how to use it, click on the operation name. For a proxy service that illustrates how to work with the SMPP connector, see Sample configuration.

 

Operation

Description

SendSMS

Use to send SMS Message

Operation details

This section provide more details on operation of SMPP connector.

Sending SMS Message

This operation used to send SMS to the SMSC.

init
<SMPP.sendSMS>
<serviceType>{$ctx:serviceType}</serviceType>
<sourceAddressTon>{$ctx:sourceAddressTon}</sourceAddressTon>
<sourceAddressNpi>{$ctx:sourceAddressNpi}</sourceAddressNpi>
<sourceAddress>{$ctx:sourceAddress}</sourceAddress>
<distinationAddressTon>{$ctx:distinationAddressTon}</distinationAddressTon>
<distinationAddressNpi>{$ctx:distinationAddressNpi}</distinationAddressNpi>
<distinationAddress>{$ctx:distinationAddress}</distinationAddress>
<alphabet>{$ctx:alphabet}</alphabet>
<message>{$ctx:message}</message>
<smscDeliveryReceipt>{$ctx:smscDeliveryReceipt}</smscDeliveryReceipt>
<messageClass>{$ctx:messageClass}</messageClass>
<isCompressed>{$ctx:isCompressed}</isCompressed>
<esmclass>{$ctx:esmclass}</esmclass>
<protocolid>{$ctx:protocolid}</protocolid>
<priorityflag>{$ctx:priorityflag}</priorityflag>
<replaceIfPresentFlag>{$ctx:replaceIfPresentFlag}</replaceIfPresentFlag>
<submitDefaultMsgId>{$ctx:submitDefaultMsgId}</submitDefaultMsgId>
<validityPeriod>{$ctx:validityPeriod}</validityPeriod>
</SMPP.sendSMS>

Properties  

  • serviceType [Optional] : Indicates SMS application service.    

          The following generic service_types are defined:

 

"" (NULL)Default
"CMT"Cellular Messaging
"CPT"Cellular Paging
"VMN"Voice Mail Notification
"VMA"Voice Mail Alerting
"WAP"Wireless Application Protocol
"USSD"Unstructured Supplementary Services Data

 

  • sourceAddressTon [Optional] : Type of number for source address.
  • sourceAddressNpi [Optional] : Numbering plan indicator for source address.
  • sourceAddress : Source address of the SMS message. 
  • destinationAddressTon [Optional] : type of number for destination. 
  • destinationAddressNpi [Optional] : numbering plan indicator for destination. 
  • distinationAddress : Destination address of the SMS message. 
Source address TON, Destination address TON

 

TONVALUE
Unknown0
International1
National2
Network Specific3
Subscriber Number4
Alphanumeric5
Abbreviated6
All other values reserved

 

Source address NPI, Destination address NPI

 

NPIVALUE
Unknown0
ISDN (E163/E164)1
Data (X.121)2
Telex (F.69)3
Land Mobile (E.212)4
National8
Private9
ERMES16
Internet (IP)20
WAP Client Id (to be defined by WAP Forum)24
  • message : Content of the SMS message.                  
  • esmClass [Optional] : The esmClass parameter is used to indicate special message attributes associated with the short Message(message mode and type).

 

Bits  7 6 5 4 3 2 1 0

Meaning


x x x x x x 0 0

x x x x x x 0 1

x x x x x x 1 0

x x x x x x 1 1

Messaging Mode (bits 1-0)

Default SMSC Mode (e.g. Store and Forward)

Datagram mode

Forward (i.e. Transaction) mode

Store and Forward mode

(use to select Store and Forward mode if Default SMSC Mode is non Store and Forward)


x x 0 0 0 0 x x

x x 0 0 1 0 x x

x x 0 1 0 0 x x

Message Type (bits 5-2)

Default message Type (i.e. normal message)

Short Message contains ESME Delivery Acknowledgement

Short Message contains ESME Manual/User Acknowledgement


0 0 x x x x x x

0 1 x x x x x x

1 0 x x x x x x

1 1 x x x x x x

GSM Network Specific Features (bits 7-6)

No specific features selected

UDHI Indicator (only relevant for MT short messages)

Set Reply Path (only relevant for GSM network)

Set UDHI and Reply Path (only relevant for GSM network)

  • protocolId [Optional] : protocol identifier (network specific).

GSM - Set according to GSM 03.40 [ GSM 03.40]

ANSI-136 (TDMA)

For mobile terminated messages, this field is not used and is therefore ignored by the SMSC.

For ANSI-136 mobile originated messages, the SMSC should set this value to NULL.

IS-95 (CDMA)

For mobile terminated messages, this field is not used and is therefore ignored by the SMSC.

For IS-95 mobile originated messages, the SMSC should set this value to NULL.

  • priorityFlag [Optional] : sets the priority of the message.

 

Priority Level

GSM

ANSI-136

IS-95

0

Non-priority

Bulk

Normal

1

Priority

Normal

Interactive

2

Priority

Urgent

Urgent

3

Priority

Very Urgent

Emergency

All other values reserved

Priority 

There are two type of priority. 

  1. Delivery priority - Message delivery will attempt even if mobile temporarily absent.
    Eg : Temporarily out of reach or another sort message being delivered at the same time.
  2. Content priority - No free message memory capacity.
      Eg : user doesn’t delete any received message and maximum storage space has been reached. 

Non-priority

Delivery will attempt if the mobile has not been identified as temporarily absent.

  • scheduleDeliveryTime [Optional] :This parameter specifies the scheduled time at which the message delivery should be first attempted. set to NULL for immediate delivery .
  • validityPeriod [Optional] : The validity_period parameter indicates the SMSC expiration time, after which the message should be discarded if not delivered to the destination. It can be defined in absolute time format or relative time format.
  • registeredDelivery [Optional] : indicator to signify if an SMSC delivery receipt or acknowledgment is required - Value other than 0 represent delivery report request. 
  •  replaceIfPresentFlag [Optional] : The replace_if_present_flag parameter is used to request the SMSC to replace a previously submitted message, that is still pending delivery. The SMSC will replace an existing message provided that the source address, destination address and service_type match the same fields in the new message.

 

ValueDescription

0

Don't replace (default)

1

Replace

2-255

reserved

  • alphabet [Optional] : Alphabet is used in the data encoding of SMS message. Following alphabets are supported.
    1. ALPHA_DEFAULT

    2. ALPHA_8_BIT

    3. ALPHA_UCS2

    4. ALPHA_RESERVED

  • isCompressed [Optional] : It allows SMS message compression.
  • messageClass [Optional] :

 

      Value

                Message Class

CLASS0

Flash messages. Display only not store into the phone

CLASS1

ME specific - the SMS is stored in the mobile phone memory

CLASS2

SIM specific - the SMS is stored on the SIM

CLASS3

TE specific - this means the SMS is sent to a computer attached to the receiving mobile phone

Data encoding - defines the encoding scheme of the SMS message. You can find general data coding scheme from here for different combination of alphabet, message class, isCompressed values.

  • submitDefaultMsgId [Optional] : Indicates short message to send from a predefined list of messages stored on SMSC.

 

valueDescription

0

reserved

1-254

Allowed values

255

reserved


Sample request  
In the response you can get the messageId with the delivery report for the submitted message.

init
{
  "host": "127.0.0.1",
  "port": 2775,
  "systemId": "DAMIEN",
  "password": "neimad",
  "systemType": "UNKNOWN",
  "addressTon": "UNKNOWN",
  "addressNpi": "UNKNOWN",
  "serviceType": "CMT",
  "sourceAddressTon": "NETWORK_SPECIFIC",
  "sourceAddressNpi": "INTERNET",
  "sourceAddress": "16116",
  "distinationAddressTon": "SUBSCRIBER_NUMBER",
  "distinationAddressNpi": "LAND_MOBILE",
  "distinationAddress": "628176504657",
  "messageClass":"CLASS1",
  "alphabet": "ALPHA_DEFAULT",
  "isCompressed":"true",
  "esmclass": "0",
  "protocolid": "0",
  "priorityflag":"1",
  "replaceIfPresentFlag": "0",
  "submitDefaultMsgId": "1",
  "validityPeriod": “020610233429000R”,
  "message": "hi hru",
  "smscDeliveryReceipt": "SUCCESS_FAILURE",
  "enquireLinkTimer": "50000",
  "transactionTimer": "100"
}

Sample configuration

Following is the proxy service that illustrates how to connect with the SMPP connector.

init
<proxy xmlns="http://ws.apache.org/ns/synapse"
      name="SMPP"
      transports="http,https,local"
      statistics="disable"
      trace="disable"
      startOnLoad="true">
   <target>
       <inSequence>
           <property name="OUT_ONLY" value="true"/>
           <property name="host" expression="json-eval($.host)"/>
           <property name="port" expression="json-eval($.port)"/>
           <property name="systemId" expression="json-eval($.systemId)"/>
           <property name="password" expression="json-eval($.password)"/>
           <property name="systemType" expression="json-eval($.systemType)"/>
           <property name="addressTon" expression="json-eval($.addressTon)"/>
           <property name="addressNpi" expression="json-eval($.addressNpi)"/>
           <property name="serviceType" expression="json-eval($.serviceType)"/>
           <property name="sourceAddressTon" expression="json-eval($.sourceAddressTon)"/>
           <property name="sourceAddressNpi" expression="json-eval($.sourceAddressNpi)"/>
           <property name="sourceAddress" expression="json-eval($.sourceAddress)"/>
           <property name="distinationAddressTon" expression="json-eval($.distinationAddressTon)"/>
           <property name="distinationAddressNpi" expression="json-eval($.distinationAddressNpi)"/>
           <property name="distinationAddress" expression="json-eval($.distinationAddress)"/>
           <property name="alphabet" expression="json-eval($.alphabet)"/>
           <property name="message" expression="json-eval($.message)"/>
           <property name="smscDeliveryReceipt" expression="json-eval($.smscDeliveryReceipt)"/>
           <property name="messageClass" expression="json-eval($.messageClass)"/>
           <property name="isCompressed" expression="json-eval($.isCompressed)"/>
           <property name="esmclass" expression="json-eval($.esmclass)"/>
           <property name="protocolid" expression="json-eval($.protocolid)"/>
           <property name="priorityflag" expression="json-eval($.priorityflag)"/>
           <property name="replaceIfPresentFlag" expression="json-eval($.replaceIfPresentFlag)"/>
           <property name="submitDefaultMsgId" expression="json-eval($.submitDefaultMsgId)"/>
           <property name="validityPeriod" expression="json-eval($.validityPeriod)"/>
           <property name="enquireLinkTimer" expression="json-eval($.enquireLinkTimer)"/>
           <property name="transactionTimer" expression="json-eval($.transactionTimer)"/>
           <SMPP.init>
               <host>{$ctx:host}</host>
               <port>{$ctx:port}</port>
               <systemId>{$ctx:systemId}</systemId>
               <password>{$ctx:password}</password>
               <enquireLinkTimer>{$ctx:enquireLinkTimer}</enquireLinkTimer>
               <transactionTimer>{$ctx:transactionTimer}</transactionTimer>
               <systemType>{$ctx:systemType}</systemType>
               <addressTon>{$ctx:addressTon}</addressTon>
               <addressNpi>{$ctx:addressNpi}</addressNpi>
           </SMPP.init>
           <SMPP.sendSMS>
               <serviceType>{$ctx:serviceType}</serviceType>
               <sourceAddressTon>{$ctx:sourceAddressTon}</sourceAddressTon>
               <sourceAddressNpi>{$ctx:sourceAddressNpi}</sourceAddressNpi>
               <sourceAddress>{$ctx:sourceAddress}</sourceAddress>
               <distinationAddressTon>{$ctx:distinationAddressTon}</distinationAddressTon>
               <distinationAddressNpi>{$ctx:distinationAddressNpi}</distinationAddressNpi>
               <distinationAddress>{$ctx:distinationAddress}</distinationAddress>
               <alphabet>{$ctx:alphabet}</alphabet>
               <message>{$ctx:message}</message>
               <smscDeliveryReceipt>{$ctx:smscDeliveryReceipt}</smscDeliveryReceipt>
               <messageClass>{$ctx:messageClass}</messageClass>
               <isCompressed>{$ctx:isCompressed}</isCompressed>
               <esmclass>{$ctx:esmclass}</esmclass>
               <protocolid>{$ctx:protocolid}</protocolid>
               <priorityflag>{$ctx:priorityflag}</priorityflag>
               <replaceIfPresentFlag>{$ctx:replaceIfPresentFlag}</replaceIfPresentFlag>
               <submitDefaultMsgId>{$ctx:submitDefaultMsgId}</submitDefaultMsgId>
               <validityPeriod>{$ctx:validityPeriod}</validityPeriod>
           </SMPP.sendSMS>
           <respond/>
       </inSequence>
   </target>
   <description/>
</proxy>