PageRenderTime 50ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/components/camel-smpp/src/main/docs/smpp-component.adoc

https://gitlab.com/matticala/apache-camel
AsciiDoc | 630 lines | 493 code | 137 blank | 0 comment | 0 complexity | 55fdf88d7056b126e45af6f625c03476 MD5 | raw file
  1. [[smpp-component]]
  2. == SMPP Component
  3. *Available as of Camel version 2.2*
  4. This component provides access to an SMSC (Short Message Service Center)
  5. over the http://smsforum.net/SMPP_v3_4_Issue1_2.zip[SMPP] protocol to
  6. send and receive SMS. The http://jsmpp.org[JSMPP] library is used for
  7. the protocol implementation.
  8. The Camel component currently operates as an
  9. http://en.wikipedia.org/wiki/ESME[ESME] (External Short Messaging
  10. Entity) and not as an SMSC itself.
  11. Starting with*Camel 2.9* you are also able to execute ReplaceSm,
  12. QuerySm, SubmitMulti, CancelSm and DataSm.
  13. Maven users will need to add the following dependency to their `pom.xml`
  14. for this component:
  15. [source,xml]
  16. ------------------------------------------------------------
  17. <dependency>
  18. <groupId>org.apache.camel</groupId>
  19. <artifactId>camel-smpp</artifactId>
  20. <version>x.x.x</version>
  21. <!-- use the same version as your Camel core version -->
  22. </dependency>
  23. ------------------------------------------------------------
  24. ### SMS limitations
  25. SMS is neither reliable or secure.  Users who require reliable and
  26. secure delivery may want to consider using the XMPP or SIP components
  27. instead, combined with a smartphone app supporting the chosen protocol.
  28. * Reliability: although the SMPP standard offers a range of feedback
  29. mechanisms to indicate errors, non-delivery and confirmation of delivery
  30. it is not uncommon for mobile networks to hide or simulate these
  31. responses.  For example, some networks automatically send a delivery
  32. confirmation for every message even if the destination number is invalid
  33. or not switched on.  Some networks silently drop messages if they think
  34. they are spam.  Spam detection rules in the network may be very crude,
  35. sometimes more than 100 messages per day from a single sender may be
  36. considered spam.
  37. * Security: there is basic encryption for the last hop from the radio
  38. tower down to the recipient handset.  SMS messages are not encrypted or
  39. authenticated in any other part of the network.  Some operators allow
  40. staff in retail outlets or call centres to browse through the SMS
  41. message histories of their customers.  Message sender identity can be
  42. easily forged.  Regulators and even the mobile telephone industry itself
  43. has cautioned against the use of SMS in two-factor authentication
  44. schemes and other purposes where security is important.
  45. While the Camel component makes it as easy as possible to send messages
  46. to the SMS network, it can not offer an easy solution to these problems.
  47. ### Data coding, alphabet and international character sets
  48. Data coding and alphabet can be specified on a per-message basis. 
  49. Default values can be specified for the endpoint.  It is important to
  50. understand the relationship between these options and the way the
  51. component acts when more than one value is set.
  52. Data coding is an 8 bit field in the SMPP wire format.
  53. Alphabet corresponds to bits 0-3 of the data coding field.  For some
  54. types of message, where a message class is used (by setting bit 5 of the
  55. data coding field), the lower two bits of the data coding field are not
  56. interpreted as alphabet and only bits 2 and 3 impact the alphabet.
  57. Furthermore, current version of the JSMPP library only seems to support
  58. bits 2 and 3, assuming that bits 0 and 1 are used for message class. 
  59. This is why the Alphabet class in JSMPP doesn't support the value 3
  60. (binary 0011) which indicates ISO-8859-1.
  61. Although JSMPP provides a representation of the message class parameter,
  62. the Camel component doesn't currently provide a way to set it other than
  63. manually setting the corresponding bits in the data coding field.
  64. When setting the data coding field in the outgoing message, the Camel
  65. component considers the following values and uses the first one it can
  66. find:
  67. * the data coding specified in a header
  68. * the alphabet specified in a header
  69. * the data coding specified in the endpoint configuration (URI
  70. parameter)
  71. Older versions of Camel had bugs in support for international character
  72. sets.  This feature only worked when a single encoding was used for all
  73. messages and was troublesome when users wanted to change it on a
  74. per-message basis.  Users who require this to work should ensure their
  75. version of Camel includes the fix for 
  76. JIRA Issues Macro: com.atlassian.sal.api.net.ResponseStatusException:
  77. Unexpected response received. Status code: 404
  78. .
  79. In addition to trying to send the data coding value to the SMSC, the
  80. Camel component also tries to analyze the message body, convert it to a
  81. Java String (Unicode) and convert that to a byte array in the
  82. corresponding alphabet  When deciding which alphabet to use in the byte
  83. array, the Camel SMPP component does not consider the data coding value
  84. (header or configuration), it only considers the specified alphabet
  85. (from either the header or endpoint parameter).
  86. If some characters in the String can't be represented in the chosen
  87. alphabet, they may be replaced by the question mark ( ? ) symbol.  Users
  88. of the API may want to consider checking if their message body can be
  89. converted to ISO-8859-1 before passing it to the component and if not,
  90. setting the alphabet header to request UCS-2 encoding.  If the alphabet
  91. and data coding options are not specified at all then the component may
  92. try to detect the required encoding and set the data coding for you.
  93. The list of alphabet codes are specified in the SMPP specification v3.4,
  94. section 5.2.19.  One notable limitation of the SMPP specification is
  95. that there is no alphabet code for explicitly requesting use of the GSM
  96. 3.38 (7 bit) character set.  Choosing the value 0 for the alphabet
  97. selects the SMSC _default_ alphabet, this usually means GSM 3.38 but it
  98. is not guaranteed.  The SMPP gateway Nexmo
  99. https://help.nexmo.com/hc/en-us/articles/204015813-How-to-change-the-character-encoding-in-SMPP-[actually
  100. allows the default to be mapped to any other character set with a
  101. control panel option]. It is suggested that users check with their SMSC
  102. operator to confirm exactly which character set is being used as the
  103. default.
  104. ### Message splitting and throttling
  105. After transforming a message body from a String to a byte array, the
  106. Camel component is also responsible for splitting the message into parts
  107. (within the 140 byte SMS size limit) before passing it to JSMPP.  This
  108. is completed automatically.
  109. If the GSM 3.38 alphabet is used, the component will pack up to 160
  110. characters into the 140 byte message body.  If an 8 bit character set is
  111. used (e.g. ISO-8859-1 for western Europe) then 140 characters will be
  112. allowed within the 140 byte message body.  If 16 bit UCS-2 encoding is
  113. used then just 70 characters fit into each 140 byte message.
  114. Some SMSC providers implement throttling rules.  Each part of a message
  115. that has been split may be counted separately by the provider's
  116. throttling mechanism.  The Camel Throttler component can be useful for
  117. throttling messages in the SMPP route before handing them to the SMSC.
  118. ### URI format
  119. [source,java]
  120. --------------------------------------------
  121. smpp://[username@]hostname[:port][?options]
  122. smpps://[username@]hostname[:port][?options]
  123. --------------------------------------------
  124. If no *username* is provided, then Camel will provide the default value
  125. `smppclient`. +
  126. If no *port* number is provided, then Camel will provide the default
  127. value `2775`. +
  128. *Camel 2.3:* If the protocol name is "smpps", camel-smpp with try to
  129. use SSLSocket to init a connection to the server.
  130. You can append query options to the URI in the following format,
  131. `?option=value&option=value&...`
  132. ### URI Options
  133. // component options: START
  134. The SMPP component supports 2 options which are listed below.
  135. [width="100%",cols="2,5,^1,2",options="header"]
  136. |===
  137. | Name | Description | Default | Type
  138. | *configuration* (advanced) | To use the shared SmppConfiguration as configuration. | | SmppConfiguration
  139. | *resolveProperty Placeholders* (advanced) | Whether the component should resolve property placeholders on itself when starting. Only properties which are of String type can use property placeholders. | true | boolean
  140. |===
  141. // component options: END
  142. // endpoint options: START
  143. The SMPP endpoint is configured using URI syntax:
  144. ----
  145. smpp:host:port
  146. ----
  147. with the following path and query parameters:
  148. ==== Path Parameters (2 parameters):
  149. [width="100%",cols="2,5,^1,2",options="header"]
  150. |===
  151. | Name | Description | Default | Type
  152. | *host* | Hostname for the SMSC server to use. | localhost | String
  153. | *port* | Port number for the SMSC server to use. | 2775 | Integer
  154. |===
  155. ==== Query Parameters (38 parameters):
  156. [width="100%",cols="2,5,^1,2",options="header"]
  157. |===
  158. | Name | Description | Default | Type
  159. | *initialReconnectDelay* (common) | Defines the initial delay in milliseconds after the consumer/producer tries to reconnect to the SMSC, after the connection was lost. | 5000 | long
  160. | *maxReconnect* (common) | Defines the maximum number of attempts to reconnect to the SMSC, if SMSC returns a negative bind response | 2147483647 | int
  161. | *reconnectDelay* (common) | Defines the interval in milliseconds between the reconnect attempts, if the connection to the SMSC was lost and the previous was not succeed. | 5000 | long
  162. | *splittingPolicy* (common) | You can specify a policy for handling long messages: ALLOW - the default, long messages are split to 140 bytes per message TRUNCATE - long messages are split and only the first fragment will be sent to the SMSC. Some carriers drop subsequent fragments so this reduces load on the SMPP connection sending parts of a message that will never be delivered. REJECT - if a message would need to be split, it is rejected with an SMPP NegativeResponseException and the reason code signifying the message is too long. | ALLOW | SmppSplittingPolicy
  163. | *systemType* (common) | This parameter is used to categorize the type of ESME (External Short Message Entity) that is binding to the SMSC (max. 13 characters). | cp | String
  164. | *addressRange* (consumer) | You can specify the address range for the SmppConsumer as defined in section 5.2.7 of the SMPP 3.4 specification. The SmppConsumer will receive messages only from SMSC's which target an address (MSISDN or IP address) within this range. | | String
  165. | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean
  166. | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | | ExceptionHandler
  167. | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. | | ExchangePattern
  168. | *destAddr* (producer) | Defines the destination SME address. For mobile terminated messages, this is the directory number of the recipient MS. Only for SubmitSm, SubmitMulti, CancelSm and DataSm. | 1717 | String
  169. | *destAddrNpi* (producer) | Defines the type of number (TON) to be used in the SME destination address parameters. Only for SubmitSm, SubmitMulti, CancelSm and DataSm. The following NPI values are defined: 0: Unknown 1: ISDN (E163/E164) 2: Data (X.121) 3: Telex (F.69) 6: Land Mobile (E.212) 8: National 9: Private 10: ERMES 13: Internet (IP) 18: WAP Client Id (to be defined by WAP Forum) | | byte
  170. | *destAddrTon* (producer) | Defines the type of number (TON) to be used in the SME destination address parameters. Only for SubmitSm, SubmitMulti, CancelSm and DataSm. The following TON values are defined: 0: Unknown 1: International 2: National 3: Network Specific 4: Subscriber Number 5: Alphanumeric 6: Abbreviated | | byte
  171. | *lazySessionCreation* (producer) | Sessions can be lazily created to avoid exceptions, if the SMSC is not available when the Camel producer is started. Camel will check the in message headers 'CamelSmppSystemId' and 'CamelSmppPassword' of the first exchange. If they are present, Camel will use these data to connect to the SMSC. | false | boolean
  172. | *numberingPlanIndicator* (producer) | Defines the numeric plan indicator (NPI) to be used in the SME. The following NPI values are defined: 0: Unknown 1: ISDN (E163/E164) 2: Data (X.121) 3: Telex (F.69) 6: Land Mobile (E.212) 8: National 9: Private 10: ERMES 13: Internet (IP) 18: WAP Client Id (to be defined by WAP Forum) | | byte
  173. | *priorityFlag* (producer) | Allows the originating SME to assign a priority level to the short message. Only for SubmitSm and SubmitMulti. Four Priority Levels are supported: 0: Level 0 (lowest) priority 1: Level 1 priority 2: Level 2 priority 3: Level 3 (highest) priority | | byte
  174. | *protocolId* (producer) | The protocol id | | byte
  175. | *registeredDelivery* (producer) | Is used to request an SMSC delivery receipt and/or SME originated acknowledgements. The following values are defined: 0: No SMSC delivery receipt requested. 1: SMSC delivery receipt requested where final delivery outcome is success or failure. 2: SMSC delivery receipt requested where the final delivery outcome is delivery failure. | | byte
  176. | *replaceIfPresentFlag* (producer) | 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. The following replace if present flag values are defined: 0: Don't replace 1: Replace | | byte
  177. | *serviceType* (producer) | The service type parameter can be used to indicate the SMS Application service associated with the message. The following generic service_types are defined: CMT: Cellular Messaging CPT: Cellular Paging VMN: Voice Mail Notification VMA: Voice Mail Alerting WAP: Wireless Application Protocol USSD: Unstructured Supplementary Services Data | CMT | String
  178. | *sourceAddr* (producer) | Defines the address of SME (Short Message Entity) which originated this message. | 1616 | String
  179. | *sourceAddrNpi* (producer) | Defines the numeric plan indicator (NPI) to be used in the SME originator address parameters. The following NPI values are defined: 0: Unknown 1: ISDN (E163/E164) 2: Data (X.121) 3: Telex (F.69) 6: Land Mobile (E.212) 8: National 9: Private 10: ERMES 13: Internet (IP) 18: WAP Client Id (to be defined by WAP Forum) | | byte
  180. | *sourceAddrTon* (producer) | Defines the type of number (TON) to be used in the SME originator address parameters. The following TON values are defined: 0: Unknown 1: International 2: National 3: Network Specific 4: Subscriber Number 5: Alphanumeric 6: Abbreviated | | byte
  181. | *typeOfNumber* (producer) | Defines the type of number (TON) to be used in the SME. The following TON values are defined: 0: Unknown 1: International 2: National 3: Network Specific 4: Subscriber Number 5: Alphanumeric 6: Abbreviated | | byte
  182. | *enquireLinkTimer* (advanced) | Defines the interval in milliseconds between the confidence checks. The confidence check is used to test the communication path between an ESME and an SMSC. | 5000 | Integer
  183. | *sessionStateListener* (advanced) | You can refer to a org.jsmpp.session.SessionStateListener in the Registry to receive callbacks when the session state changed. | | SessionStateListener
  184. | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
  185. | *transactionTimer* (advanced) | Defines the maximum period of inactivity allowed after a transaction, after which an SMPP entity may assume that the session is no longer active. This timer may be active on either communicating SMPP entity (i.e. SMSC or ESME). | 10000 | Integer
  186. | *alphabet* (codec) | Defines encoding of data according the SMPP 3.4 specification, section 5.2.19. 0: SMSC Default Alphabet 4: 8 bit Alphabet 8: UCS2 Alphabet | | byte
  187. | *dataCoding* (codec) | Defines the data coding according the SMPP 3.4 specification, section 5.2.19. Example data encodings are: 0: SMSC Default Alphabet 3: Latin 1 (ISO-8859-1) 4: Octet unspecified (8-bit binary) 8: UCS2 (ISO/IEC-10646) 13: Extended Kanji JIS(X 0212-1990) | | byte
  188. | *encoding* (codec) | Defines the encoding scheme of the short message user data. Only for SubmitSm, ReplaceSm and SubmitMulti. | ISO-8859-1 | String
  189. | *httpProxyHost* (proxy) | If you need to tunnel SMPP through a HTTP proxy, set this attribute to the hostname or ip address of your HTTP proxy. | | String
  190. | *httpProxyPassword* (proxy) | If your HTTP proxy requires basic authentication, set this attribute to the password required for your HTTP proxy. | | String
  191. | *httpProxyPort* (proxy) | If you need to tunnel SMPP through a HTTP proxy, set this attribute to the port of your HTTP proxy. | 3128 | Integer
  192. | *httpProxyUsername* (proxy) | If your HTTP proxy requires basic authentication, set this attribute to the username required for your HTTP proxy. | | String
  193. | *proxyHeaders* (proxy) | These headers will be passed to the proxy server while establishing the connection. | | Map
  194. | *password* (security) | The password for connecting to SMSC server. | | String
  195. | *systemId* (security) | The system id (username) for connecting to SMSC server. | smppclient | String
  196. | *usingSSL* (security) | Whether using SSL with the smpps protocol | false | boolean
  197. |===
  198. // endpoint options: END
  199. You can have as many of these options as you like.
  200. [source,java]
  201. ------------------------------------------------------------------------------------------------------------------
  202. smpp://smppclient@localhost:2775?password=password&enquireLinkTimer=3000&transactionTimer=5000&systemType=consumer
  203. ------------------------------------------------------------------------------------------------------------------
  204. ### Producer Message Headers
  205. The following message headers can be used to affect the behavior of the
  206. SMPP producer
  207. [width="100%",cols="10%,10%,80%",options="header",]
  208. |=======================================================================
  209. |Header |Type |Description
  210. |`CamelSmppDestAddr` |`List`/`String` |*only for SubmitSm, SubmitMulti, CancelSm and DataSm* Defines the
  211. destination SME address(es). For mobile terminated messages, this is the
  212. directory number of the recipient MS. Is must be a `List<String>` for
  213. SubmitMulti and a `String` otherwise.
  214. |`CamelSmppDestAddrTon` |`Byte` |*only for SubmitSm, SubmitMulti, CancelSm and DataSm* Defines the type
  215. of number (TON) to be used in the SME destination address parameters.
  216. Use the `sourceAddrTon` URI option values defined above.
  217. |`CamelSmppDestAddrNpi` |`Byte` |*only for SubmitSm, SubmitMulti, CancelSm and DataSm* Defines the
  218. numeric plan indicator (NPI) to be used in the SME destination address
  219. parameters. Use the URI option `sourceAddrNpi` values defined above.
  220. |`CamelSmppSourceAddr` |`String` |Defines the address of SME (Short Message Entity) which originated this
  221. message.
  222. |`CamelSmppSourceAddrTon` |`Byte` |Defines the type of number (TON) to be used in the SME originator
  223. address parameters. Use the `sourceAddrTon` URI option values defined
  224. above.
  225. |`CamelSmppSourceAddrNpi` |`Byte` |Defines the numeric plan indicator (NPI) to be used in the SME
  226. originator address parameters. Use the URI option `sourceAddrNpi` values
  227. defined above.
  228. |`CamelSmppServiceType` |`String` |The service type parameter can be used to indicate the SMS Application
  229. service associated with the message. Use the URI option `serviceType`
  230. settings above.
  231. |`CamelSmppRegisteredDelivery` |`Byte` |*only for SubmitSm, ReplaceSm, SubmitMulti and DataSm* Is used to
  232. request an SMSC delivery receipt and/or SME originated acknowledgements.
  233. Use the URI option `registeredDelivery` settings above.
  234. |`CamelSmppPriorityFlag` |`Byte` |*only for SubmitSm and SubmitMulti* Allows the originating SME to assign
  235. a priority level to the short message. Use the URI option `priorityFlag`
  236. settings above.
  237. |`CamelSmppScheduleDeliveryTime` |`Date` |*only for SubmitSm, SubmitMulti and ReplaceSm* This parameter specifies
  238. the scheduled time at which the message delivery should be first
  239. attempted. It defines either the absolute date and time or relative time
  240. from the current SMSC time at which delivery of this message will be
  241. attempted by the SMSC. It can be specified in either absolute time
  242. format or relative time format. The encoding of a time format is
  243. specified in chapter 7.1.1. in the smpp specification v3.4.
  244. |`CamelSmppValidityPeriod` |`String`/`Date` |*only for SubmitSm, SubmitMulti and ReplaceSm* The validity period
  245. parameter indicates the SMSC expiration time, after which the message
  246. should be discarded if not delivered to the destination. If it's
  247. provided as `Date`, it's interpreted as absolute time. *Camel 2.9.1
  248. onwards:* It can be defined in absolute time format or relative time
  249. format if you provide it as `String` as specified in chapter 7.1.1 in
  250. the smpp specification v3.4.
  251. |`CamelSmppReplaceIfPresentFlag` |`Byte` |*only for SubmitSm and SubmitMulti* The replace if present flag
  252. parameter is used to request the SMSC to replace a previously submitted
  253. message, that is still pending delivery. The SMSC will replace an
  254. existing message provided that the source address, destination address
  255. and service type match the same fields in the new message. The following
  256. values are defined: `0`, Don't replace and `1`, Replace
  257. |`CamelSmppAlphabet` / `CamelSmppDataCoding` |`Byte` |*Camel 2.5* *For SubmitSm, SubmitMulti and ReplaceSm* (Prior to *Camel
  258. 2.9* use `CamelSmppDataCoding` instead of `CamelSmppAlphabet`.) The data
  259. coding according to the SMPP 3.4 specification, section 5.2.19. Use the
  260. URI option `alphabet` settings above.
  261. |`CamelSmppOptionalParameters` |`Map<String, String>` |*Deprecated and will be removed in Camel 2.13.0/3.0.0* +
  262. *Camel 2.10.5 and 2.11.1 onwards and only for SubmitSm, SubmitMulti and
  263. DataSm* The optional parameters send back by the SMSC.
  264. |`CamelSmppOptionalParameter` |`Map<Short, Object>` |*Camel 2.10.7 and 2.11.2 onwards and only for SubmitSm, SubmitMulti and
  265. DataSm* The optional parameter which are send to the SMSC. The value is
  266. converted in the following way: `String` -> `org.jsmpp.bean.OptionalParameter.COctetString`,
  267. `byte[]` -> `org.jsmpp.bean.OptionalParameter.OctetString`,
  268. `Byte` -> `org.jsmpp.bean.OptionalParameter.Byte`,
  269. `Integer` -> `org.jsmpp.bean.OptionalParameter.Int`,
  270. `Short` -> `org.jsmpp.bean.OptionalParameter.Short`,
  271. `null` -> `org.jsmpp.bean.OptionalParameter.Null`
  272. |CamelSmppEncoding |String |*Camel 2.14.1 and Camel 2.15.0 onwards and**only for SubmitSm,
  273. SubmitMulti and DataSm*.  Specifies the encoding (character set name) of
  274. the bytes in the message body.  If the message body is a string then
  275. this is not relevant because Java Strings are always Unicode.  If the
  276. body is a byte array then this header can be used to indicate that it is
  277. ISO-8859-1 or some other value.  Default value is specified by the
  278. endpoint configuration parameter _encoding_
  279. |CamelSmppSplittingPolicy |String |*Camel 2.14.1 and Camel 2.15.0 onwards and**only for SubmitSm,
  280. SubmitMulti and DataSm*.  Specifies the policy for message splitting for
  281. this exchange.  Possible values are described in the endpoint
  282. configuration parameter _splittingPolicy_
  283. |=======================================================================
  284. The following message headers are used by the SMPP producer to set the
  285. response from the SMSC in the message header
  286. [width="100%",cols="10%,10%,80%",options="header",]
  287. |=======================================================================
  288. |Header |Type |Description
  289. |`CamelSmppId` |`List<String>`/`String` |The id to identify the submitted short message(s) for later use. *From
  290. Camel 2.9.0*: In case of a ReplaceSm, QuerySm, CancelSm and DataSm this
  291. header vaule is a `String`. In case of a SubmitSm or SubmitMultiSm this
  292. header vaule is a `List<String>`.
  293. |`CamelSmppSentMessageCount` |`Integer` |*From Camel 2.9 onwards only for SubmitSm and SubmitMultiSm* The total
  294. number of messages which has been sent.
  295. |`CamelSmppError` |`Map<String, List<Map<String, Object>>>` |*From Camel 2.9 onwards only for SubmitMultiSm* The errors which
  296. occurred by sending the short message(s) the form `Map<String, List<Map<String, Object>>>` (messageID : (destAddr :
  297. address, error : errorCode)).
  298. |`CamelSmppOptionalParameters` |`Map<String, String>` |*Deprecated and will be removed in Camel 2.13.0/3.0.0*
  299. *From Camel 2.11.1 onwards only for DataSm* The optional parameters
  300. which are returned from the SMSC by sending the message.
  301. |`CamelSmppOptionalParameter` |`Map<Short, Object>` |*From Camel 2.10.7, 2.11.2 onwards only for DataSm* The optional
  302. parameter which are returned from the SMSC by sending the message. The
  303. key is the `Short` code for the optional parameter. The value is
  304. converted in the following way:
  305. `org.jsmpp.bean.OptionalParameter.COctetString` -> `String`,
  306. `org.jsmpp.bean.OptionalParameter.OctetString` -> `byte[]`,
  307. `org.jsmpp.bean.OptionalParameter.Byte` -> `Byte`,
  308. `org.jsmpp.bean.OptionalParameter.Int` -> `Integer`,
  309. `org.jsmpp.bean.OptionalParameter.Short` -> `Short`,
  310. `org.jsmpp.bean.OptionalParameter.Null` -> `null`
  311. |=======================================================================
  312. ### Consumer Message Headers
  313. The following message headers are used by the SMPP consumer to set the
  314. request data from the SMSC in the message header
  315. [width="100%",cols="10%,10%,80%",options="header",]
  316. |=======================================================================
  317. |Header |Type |Description
  318. |`CamelSmppSequenceNumber` |`Integer` |*only for AlertNotification, DeliverSm and DataSm* A sequence number
  319. allows a response PDU to be correlated with a request PDU. The
  320. associated SMPP response PDU must preserve this field.
  321. |`CamelSmppCommandId` |`Integer` |*only for AlertNotification, DeliverSm and DataSm* The command id field
  322. identifies the particular SMPP PDU. For the complete list of defined
  323. values see chapter 5.1.2.1 in the smpp specification v3.4.
  324. |`CamelSmppSourceAddr` |`String` |*only for AlertNotification, DeliverSm and DataSm* Defines the address
  325. of SME (Short Message Entity) which originated this message.
  326. |`CamelSmppSourceAddrNpi` |`Byte` |*only for AlertNotification and DataSm* Defines the numeric plan
  327. indicator (NPI) to be used in the SME originator address parameters. Use
  328. the URI option `sourceAddrNpi` values defined above.
  329. |`CamelSmppSourceAddrTon` |`Byte` |*only for AlertNotification and DataSm* Defines the type of number (TON)
  330. to be used in the SME originator address parameters. Use the
  331. `sourceAddrTon` URI option values defined above.
  332. |`CamelSmppEsmeAddr` |`String` |*only for AlertNotification* Defines the destination ESME address. For
  333. mobile terminated messages, this is the directory number of the
  334. recipient MS.
  335. |`CamelSmppEsmeAddrNpi` |`Byte` |*only for AlertNotification* Defines the numeric plan indicator (NPI) to
  336. be used in the ESME originator address parameters. Use the URI option
  337. `sourceAddrNpi` values defined above.
  338. |`CamelSmppEsmeAddrTon` |`Byte` |*only for AlertNotification* Defines the type of number (TON) to be used
  339. in the ESME originator address parameters. Use the `sourceAddrTon` URI
  340. option values defined above.
  341. |`CamelSmppId` |`String` |*only for smsc DeliveryReceipt and DataSm* The message ID allocated to
  342. the message by the SMSC when originally submitted.
  343. |`CamelSmppDelivered` |`Integer` |*only for smsc DeliveryReceipt* Number of short messages delivered. This
  344. is only relevant where the original message was submitted to a
  345. distribution list.The value is padded with leading zeros if necessary.
  346. |`CamelSmppDoneDate` |`Date` |*only for smsc DeliveryReceipt* The time and date at which the short
  347. message reached it's final state. The format is as follows: YYMMDDhhmm.
  348. |`CamelSmppStatus` |`DeliveryReceiptState` |*only for smsc DeliveryReceipt:* The final status of the message. The
  349. following values are defined: `DELIVRD`: Message is delivered to destination,
  350. `EXPIRED`: Message validity period has expired,
  351. `DELETED`: Message has been deleted,
  352. `UNDELIV`: Message is undeliverable,
  353. `ACCEPTD`: Message is in accepted state (i.e. has been manually read on
  354. behalf of the subscriber by customer service),
  355. `UNKNOWN`: Message is in invalid state,
  356. `REJECTD`: Message is in a rejected state
  357. |`CamelSmppCommandStatus` |`Integer` |*only for DataSm* The Command status of the message.
  358. |`CamelSmppError` |`String` |*only for smsc DeliveryReceipt* Where appropriate this may hold a
  359. Network specific error code or an SMSC error code for the attempted
  360. delivery of the message. These errors are Network or SMSC specific and
  361. are not included here.
  362. |`CamelSmppSubmitDate` |`Date` |*only for smsc DeliveryReceipt* The time and date at which the short
  363. message was submitted. In the case of a message which has been replaced,
  364. this is the date that the original message was replaced. The format is
  365. as follows: YYMMDDhhmm.
  366. |`CamelSmppSubmitted` |`Integer` |*only for smsc DeliveryReceipt* Number of short messages originally
  367. submitted. This is only relevant when the original message was submitted
  368. to a distribution list.The value is padded with leading zeros if
  369. necessary.
  370. |`CamelSmppDestAddr` |`String` |*only for DeliverSm and DataSm:* Defines the destination SME address.
  371. For mobile terminated messages, this is the directory number of the
  372. recipient MS.
  373. |`CamelSmppScheduleDeliveryTime` |`String` |*only for DeliverSm:* This parameter specifies the scheduled time at
  374. which the message delivery should be first attempted. It defines either
  375. the absolute date and time or relative time from the current SMSC time
  376. at which delivery of this message will be attempted by the SMSC. It can
  377. be specified in either absolute time format or relative time format. The
  378. encoding of a time format is specified in Section 7.1.1. in the smpp
  379. specification v3.4.
  380. |`CamelSmppValidityPeriod` |`String` |*only for DeliverSm* The validity period parameter indicates the SMSC
  381. expiration time, after which the message should be discarded if not
  382. delivered to the destination. It can be defined in absolute time format
  383. or relative time format. The encoding of absolute and relative time
  384. format is specified in Section 7.1.1 in the smpp specification v3.4.
  385. |`CamelSmppServiceType` |`String` |*only for DeliverSm and DataSm* The service type parameter indicates the
  386. SMS Application service associated with the message.
  387. |`CamelSmppRegisteredDelivery` |`Byte` |*only for DataSm* Is used to request an delivery receipt and/or SME
  388. originated acknowledgements. Same values as in Producer header list
  389. above.
  390. |`CamelSmppDestAddrNpi` |`Byte` |*only for DataSm* Defines the numeric plan indicator (NPI) in the
  391. destination address parameters. Use the URI option `sourceAddrNpi`
  392. values defined above.
  393. |`CamelSmppDestAddrTon` |`Byte` |*only for DataSm* Defines the type of number (TON) in the destination
  394. address parameters. Use the `sourceAddrTon` URI option values defined
  395. above.
  396. |`CamelSmppMessageType` |`String` |*Camel 2.6 onwards*: Identifies the type of an incoming message:
  397. `AlertNotification`: an SMSC alert notification,
  398. `DataSm`: an SMSC data short message,
  399. `DeliveryReceipt`: an SMSC delivery receipt,
  400. `DeliverSm`: an SMSC deliver short message
  401. |`CamelSmppOptionalParameters` |`Map<String, Object>` |*Deprecated and will be removed in Camel 2.13.0/3.0.0*
  402. *Camel 2.10.5 onwards and only for DeliverSm* The optional parameters
  403. send back by the SMSC.
  404. |`CamelSmppOptionalParameter` |`Map<Short, Object>` |*Camel 2.10.7, 2.11.2 onwards and only for DeliverSm* The optional
  405. parameters send back by the SMSC. The key is the `Short` code for the
  406. optional parameter. The value is converted in the following way:
  407. `org.jsmpp.bean.OptionalParameter.COctetString` -> `String`,
  408. `org.jsmpp.bean.OptionalParameter.OctetString` -> `byte[]`,
  409. `org.jsmpp.bean.OptionalParameter.Byte` -> `Byte`,
  410. `org.jsmpp.bean.OptionalParameter.Int` -> `Integer`,
  411. `org.jsmpp.bean.OptionalParameter.Short` -> `Short`,
  412. `org.jsmpp.bean.OptionalParameter.Null` -> `null`
  413. |=======================================================================
  414. TIP: *JSMPP library*
  415. See the documentation of the http://jsmpp.org[JSMPP Library] for more
  416. details about the underlying library.
  417. ### Exception handling
  418. This component supports the general Camel exception handling
  419. capabilities
  420. When an error occurs sending a message with SubmitSm (the default
  421. action), the org.apache.camel.component.smpp.SmppException is thrown
  422. with a nested exception, org.jsmpp.extra.NegativeResponseException. 
  423. Call NegativeResponseException.getCommandStatus() to obtain the exact
  424. SMPP negative response code, the values are explained in the SMPP
  425. specification 3.4, section 5.1.3. +
  426. *Camel 2.8 onwards*: When the SMPP consumer receives a `DeliverSm` or
  427. `DataSm` short message and the processing of these messages fails, you
  428. can also throw a `ProcessRequestException` instead of handle the
  429. failure. In this case, this exception is forwarded to the underlying
  430. http://jsmpp.org[JSMPP library] which will return the included error
  431. code to the SMSC. This feature is useful to e.g. instruct the SMSC to
  432. resend the short message at a later time. This could be done with the
  433. following lines of code:
  434. [source,java]
  435. --------------------------------------------------------------------------------------------------------------------------
  436. from("smpp://smppclient@localhost:2775?password=password&enquireLinkTimer=3000&transactionTimer=5000&systemType=consumer")
  437. .doTry()
  438. .to("bean:dao?method=updateSmsState")
  439. .doCatch(Exception.class)
  440. .throwException(new ProcessRequestException("update of sms state failed", 100))
  441. .end();
  442. --------------------------------------------------------------------------------------------------------------------------
  443. Please refer to the http://smsforum.net/SMPP_v3_4_Issue1_2.zip[SMPP
  444. specification] for the complete list of error codes and their meanings.
  445. ### Samples
  446. A route which sends an SMS using the Java DSL:
  447. [source,java]
  448. ------------------------------------------------------------------------------------------
  449. from("direct:start")
  450. .to("smpp://smppclient@localhost:2775?
  451. password=password&enquireLinkTimer=3000&transactionTimer=5000&systemType=producer");
  452. ------------------------------------------------------------------------------------------
  453. A route which sends an SMS using the Spring XML DSL:
  454. [source,xml]
  455. -----------------------------------------------------------------------------------------------------------
  456. <route>
  457. <from uri="direct:start"/>
  458. <to uri="smpp://smppclient@localhost:2775?
  459. password=password&amp;enquireLinkTimer=3000&amp;transactionTimer=5000&amp;systemType=producer"/>
  460. </route>
  461. -----------------------------------------------------------------------------------------------------------
  462. A route which receives an SMS using the Java DSL:
  463. [source,java]
  464. --------------------------------------------------------------------------------------------------------------------------
  465. from("smpp://smppclient@localhost:2775?password=password&enquireLinkTimer=3000&transactionTimer=5000&systemType=consumer")
  466. .to("bean:foo");
  467. --------------------------------------------------------------------------------------------------------------------------
  468. A route which receives an SMS using the Spring XML DSL:
  469. [source,xml]
  470. ----------------------------------------------------------------------------------------------------------------
  471. <route>
  472. <from uri="smpp://smppclient@localhost:2775?
  473. password=password&amp;enquireLinkTimer=3000&amp;transactionTimer=5000&amp;systemType=consumer"/>
  474. <to uri="bean:foo"/>
  475. </route>
  476. ----------------------------------------------------------------------------------------------------------------
  477. TIP: *SMSC simulator*
  478. If you need an SMSC simulator for your test, you can use the simulator
  479. provided by
  480. http://opensmpp.logica.com/CommonPart/Download/download2.html#simulator[Logica].
  481. ### Debug logging
  482. This component has log level *DEBUG*, which can be helpful in debugging
  483. problems. If you use log4j, you can add the following line to your
  484. configuration:
  485. [source,java]
  486. --------------------------------------------------
  487. log4j.logger.org.apache.camel.component.smpp=DEBUG
  488. --------------------------------------------------
  489. ### See Also
  490. * Configuring Camel
  491. * Component
  492. * Endpoint
  493. * Getting Started