The control plane decides and the gateway executes. YepMsg is always the HTTP client. It polls for accounts and carriers, asks for a decision per message, and reports receipts and records. Nothing on the message path requires the control plane to reach the gateway.
YepBoss implements these hooks. A system of your own can implement them too, and without a routing hook YepMsg routes statically to a default carrier.
The hooks
| Hook | When | Purpose |
|---|---|---|
| Provisioning (or account registry) | At start and at an interval | Accounts, and with provisioning also carriers and their settings |
| Routing | Once per message, synchronously | Which carrier, and whether to rewrite or refuse |
| Receipts | Per correlated carrier receipt, asynchronously | Tell the control plane a message's delivery state |
| Records | Per message, asynchronously | Billing records, delivered from a queue of their own |
| Screen | Once per message, before routing | Firewall verdict from YepShield, optional |
Request paths are configurable. All hooks use JSON over HTTP(S), with a bearer token configured per hook. TLS validation is on by default.
The routing hook
For each customer submit, and for each inbound message from a carrier, YepMsg sends the message as received: sender, receiver, body (readable and as exact bytes), coding, the submitting account, the time accepted, the receipt mask and a segment count. The gateway's message ID is stable across its own retries, so answer a retry the same way.
An answer can:
- name a carrier connection, and for inbound traffic the owning account;
- replace the sender or receiver used on the carrier leg;
- rewrite the body, in which case the gateway re-segments it;
- carry a decision ID and policy revision, which the gateway stamps on the message and its record;
- refuse the message with an SMPP status and a reason.
An empty answer blocks the message. Outbound, the gateway dead-ends it: the customer sees an acceptance, the message goes nowhere and any receipt follows the customer's mask. Inbound, it is dropped.
Rejects
A reject answers the customer with the status you choose, drops the gateway's copy, returns the quota and writes a record with the status. No receipt is sent. A reject wins over any carrier in the same answer and is never retried. Typical use:
| Reason | SMPP status |
|---|---|
| Account unknown, suspended or blocked by policy | ESME_RSUBMITFAIL |
| Sender not allowed | ESME_RINVSRCADR |
| Insufficient credit | ESME_RTHROTTLED |
| No rate for the destination | ESME_RINVDSTADR |
Failure behaviour
| Control plane | Gateway |
|---|---|
| Registry or provisioning unreachable | Keeps the last good list and retries with backoff. A cold start runs on the bootstrap configuration |
| Routing answers with a plan | Executes it |
| Routing answers 5xx, times out or fails to connect | Retries, then answers the customer ESME_RMSGQFUL so they resubmit |
| Routing answers 4xx | Refuses the message with a system error, logs it and does not retry |
| Receipts endpoint down | Retries and counts failures. The customer's receipt is never delayed |
| Records endpoint down | The records queue grows, and the CDR files keep being written |
Screening before routing
With a screen block configured, YepMsg asks YepShield for a verdict before it calls the routing hook, for outbound and inbound messages. It performs the returned action: allow, label by rewriting the body or sender, throttle, hold, reject, dead-end or drop. The call has a hard deadline and one attempt. If it cannot be answered, the message passes as unscreened, or is refused, depending on the failure mode set per route. The verdict is passed to the routing hook and written to the record. See YepShield.
Records
YepMsg writes one record per accepted message, per inbound message delivered and per receipt delivered. Records go to append-only JSON Lines files, one per UTC day and synced per record, and optionally to the control plane. Records may arrive after the receipt for the same message and may arrive twice, so deduplicate on message ID and direction. A record the control plane refuses with a 4xx is counted and dropped, so one bad record never blocks the queue. Each record carries the decision ID, policy revision, node name, segment count and any firewall verdict.
Contract and conformance
The hook payloads are specified in a versioned contract, with minor versions additive so either side can upgrade first. A minimal conforming control plane for load tests and a set of conformance cases ship with the gateway. The contract and the tooling are provided to customers and evaluating teams on request. Get in touch.