davsclaus opened a new pull request, #3224:
URL: https://github.com/apache/camel-kamelets/pull/3224
Part of #3170: `smpp-sink` can choose which delivery receipts to ask for,
the type and numbering plan of the sender and recipient numbers, and the coding
of the text, so that text in any language arrives intact. Both SMPP Kamelets
can set how often they check the connection.
### The problem
- The sink always asked for a delivery receipt, and there was no way to turn
that off.
- It sent every number with type of number (TON) and numbering plan (NPI)
`0`, unknown. An SMSC may need `5` to send from a name, or `1`/`1` for an
international number.
- It encoded the text with `encoding` (ISO-8859-1), so Cyrillic, Greek or
emoji arrived as `?`.
- Both Kamelets checked the connection once a minute. In a test, the sink
did not notice that the SMSC had stopped answering for 40 s.
### The options
| Option | Kamelet | Template mapping | What it does |
|---|---|---|---|
| `registeredDelivery` | sink | `registeredDelivery:
"{{?registeredDelivery}}"` | `1` asks for a receipt whether the SMS was
delivered or not, `2` only when it failed, and `0` asks for none. The component
default is `1`. |
| `sourceAddrTon`, `sourceAddrNpi` | sink | `sourceAddrTon:
"{{?sourceAddrTon}}"`, `sourceAddrNpi: "{{?sourceAddrNpi}}"` | TON and NPI of
`sourceAddr` |
| `destAddrTon`, `destAddrNpi` | sink | `destAddrTon: "{{?destAddrTon}}"`,
`destAddrNpi: "{{?destAddrNpi}}"` | TON and NPI of the recipient |
| `dataCoding` | sink | `dataCoding: "{{?dataCoding}}"` | The `data_coding`
the SMS is marked with, 0 to 127 |
| `alphabet` | sink | `alphabet: "{{?alphabet}}"` | How the body becomes
bytes: `0` uses `encoding`, `4` sends a byte body as it is, and `8` encodes as
UCS-2 |
| `enquireLinkTimer` | sink and source | `enquireLinkTimer:
"{{?enquireLinkTimer}}"` | Interval of the `enquire_link` check, in ms. The
component default is 60000. |
- **Defaults:** all the options are optional and deliberately have no
`default`, as in #3174. When they are unset, the optional placeholders drop
them, and the endpoint URIs are byte-identical to `main`'s.
- **Already there:** `systemType`, `sourceAddr` and `destAddr` were already
options of the sink, and `systemType` of the source. `systemType: cp` reaches
the bind PDU of both.
- **The enums follow jSMPP, not the component documentation:**
- TON is `0`–`6`.
- NPI is `0, 1, 3, 4, 6, 8, 9, 10, 14, 18`, the values jSMPP's
`NumberingPlanIndicator` accepts. camel-smpp documents
`0,1,2,3,6,8,9,10,13,18`. With `2`, every message fails with `No enum const
NumberingPlanIndicator with value 2`, and `14` (internet) works.
- **Integers:** the TON, NPI, `registeredDelivery`, `dataCoding` and
`alphabet` options are integers. `dataCoding` is limited to 0–127, because the
option is a Java `byte`: `dataCoding: 200` stops the integration from starting.
- **`alphabet` and `dataCoding` go together:** `alphabet` changes the bytes,
and `dataCoding` the mark. With only one of them set to `8`, the phone gets
garbage (see the table below). The descriptions and the partial page say to set
both.
- **Source side:** the source only gets `enquireLinkTimer`. camel-smpp binds
the receiver with TON/NPI unknown, hard-coded, and `registeredDelivery`,
`dataCoding` and `alphabet` are producer options.
- **Descriptions:**
- The sink's "Good to know" says that it asks for receipts and that text
is sent as `?` beyond `encoding`.
- The source's "Good to know" says when receipts come, and that a
receipt's `CamelSmppId` is the ID `smpp-sink` got and `CamelSmppStatus` its
final state.
- The sink said one SMS is 140 bytes. It is now "160 characters, or 70
with `alphabet` `8`", checked: 160/161 Latin characters give 1/2 SMS, and 70/71
Cyrillic characters with UCS-2 give 1/2.
- **Partial pages:** the sink page has tables for `registeredDelivery` and
for common TON/NPI settings, a section on text in any language, and the
connection options. The source page has a section on delivery receipts. Each
has an example, and both examples were run.
### Not added
- `lazySessionCreation` is left for a later PR.
### Verification
Tested with Camel JBang 4.24.0-SNAPSHOT against SMPPSim (`jookies/smppsim`).
The simulator logs each PDU decoded and as a hex dump.
- Settings: 6 connections, every SMS delivered after about 2 s.
- It sends a delivery receipt as a `deliver_sm` to a bound receiver, here
`smpp-source`. `smpp-sink` binds as a transmitter.
- With `LOOPBACK=TRUE`, each SMS also comes back to `smpp-source`, to check
the text end to end.
| Case | Result |
|---|---|
| Options unset, source and sink, `main` and this branch | `camel get
endpoint` shows identical URIs |
| Unset | `submit_sm` has `registered_delivery_flag=1`. About 2 s later,
`smpp-source` gets `DeliveryReceipt` with `CamelSmppId` = the sink's ID and
`CamelSmppStatus=DELIVRD` |
| `registeredDelivery: 1` | Same as unset |
| `registeredDelivery: 0` | `registered_delivery_flag=0`, no receipt |
| `registeredDelivery: 2`, SMS delivered | `registered_delivery_flag=2`, no
receipt |
| SMSC set to fail every SMS, `registeredDelivery: 1` | Receipt with
`stat:UNDELIV`, `CamelSmppStatus=UNDELIV` |
| The same with `registeredDelivery: 2` | `registered_delivery_flag=2` in
the PDU. SMPPSim sends no receipt, because it only looks at bit 0 of the flag,
so the failure-only receipt could not be shown with it |
| `sourceAddr: MyShop`, `sourceAddrTon: 5`, `sourceAddrNpi: 0`,
`destAddrTon: 1`, `destAddrNpi: 1` | `source_addr_ton=5, source_addr_npi=0,
source_addr=MyShop, dest_addr_ton=1, dest_addr_npi=1` |
| `sourceAddrTon: 4`, `sourceAddrNpi: 14`, `destAddrTon: 6`, `destAddrNpi:
18` | `source_addr_ton=4, source_addr_npi=14, dest_addr_ton=6,
dest_addr_npi=18` |
| `destAddrNpi: 2` (listed by camel-smpp, not in our enum) | Every message
fails: `No enum const NumberingPlanIndicator with value 2` |
| Body `Привет мир café`, options unset (loopback) | `data_coding=0`, sent
as `?????? ??? café`; the source gets `?????? ??? café` |
| `alphabet: 8`, `dataCoding: 8` | `data_coding=8`, 30 bytes of UTF-16BE;
the source gets `Привет мир café` |
| `dataCoding: 8` only | `data_coding=8` but ISO-8859-1 bytes; the source
gets garbage |
| `alphabet: 8` only | `data_coding=0` with UTF-16 bytes; the source gets
garbage |
| `alphabet: 4`, text body | Same bytes as unset (text still uses
`encoding`) |
| `alphabet: 4`, `dataCoding: 4`, byte body (UTF-8 `café 😀`) |
`data_coding=4`, the bytes `636166C3A920F09F9880` sent as they are |
| Byte body, options unset | Converted to text and encoded as ISO-8859-1:
`café ?` |
| `dataCoding: 3` | `data_coding=3`, `café` intact |
| `dataCoding: 200` | Integration does not start: `For input string: "200"`
(byte) |
| 70 / 71 Cyrillic characters, `alphabet: 8` | 1 / 2 SMS |
| 160 / 161 Latin characters, unset | 1 / 2 SMS |
| `enquireLinkTimer` unset, 75 s | One `enquire_link` per session, 63 s
after the bind |
| `enquireLinkTimer: 2000` (source), `3000` (sink) | `ENQUIRE_LINK` from the
receiver every 2 s and from the transmitter every 3 s |
| `enquireLinkTimer: 2000` (source), sink unset, SMSC paused for 40 s
(`docker pause`) | Source: `Response timeout on enquire_link` and `Lost
connection` 11 s after the pause, then `Reconnected` once unpaused. The sink
logged nothing |
| `systemType: cp`, source and sink | `system_type=cp` in both bind PDUs |
| Sink partial example (`timer-source`, name sender, UCS-2, receipts) |
`submit_sm` with `source_addr_ton=5`, `MyShop`, `dest_addr_ton=1/npi=1`,
`data_coding=8`, `registered_delivery_flag=1`, UTF-16BE text |
| Source partial example | Logs `SMS 2 ended as DELIVRD` |
One SMPPSim quirk: for a UCS-2 SMS, its receipt copies the raw UTF-16 bytes
into the `Text:` field of a `data_coding=0` receipt, and jSMPP cannot parse
that (`InvalidDeliveryReceiptException`). The receipts of plain-text SMS are
parsed fine. This is how the simulator builds the receipt, not the Kamelet.
`./mvnw clean verify -DskipTests` and then `./mvnw clean verify` passed from
the root. Before building, the library copies of the two Kamelets were
refreshed with `./mvnw -pl library/camel-kamelets
resources:copy-resources@copy-resource-one`. The build regenerated
`kamelets-index.json`.
_Claude Code on behalf of Claus Ibsen_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]