Telecom · Backend
SMPP / USSD Gateway
A transport layer for short-code services: a Go service keeps SMPP connections to operators, while business logic stays in Node.js and talks to it over gRPC.
- Category
- Telecom · Backend
- Stack
- Go · gRPC · SMPP · Redis · Node.js
The problem
- Business logic for short-code services (subscriptions, quizzes, notifications) is written in Node.js and has to be decoupled from SMS transport.
- The system needs long-lived SMPP connections to several operators, automatic reconnects, and intake of inbound messages and delivery reports.
- The architecture must allow new capabilities — USSD menus first of all — without rewriting the logic.
The solution
- A Go service with a gRPC interface; its clients are Node.js services running on the same or on other servers.
- An account is an SMPP connection bound to a short code. The short code selects the account, and accounts can belong to different operators.
- A pool of long-lived connections with automatic reconnects.
- Batch sending: a batch is acknowledged on intake and then sent. NORMAL and FAST modes: FAST pre-empts a running NORMAL campaign.
- Delivery reports (DLR) and inbound SMS (MO) are published to Redis separately, tagged with the short code.
- An Admin API for account management, plus metrics; TPS and inflight limits are configurable.
- The USSD gateway is being designed on top of the SMPP gateway: the gateway handles transport only, while menu logic lives in Node.js; menus are defined as configuration, each item mapped to a function ID.
Architecture
Data flow, step by step
- A Node.js service sends an SMS or a batch to the SMS Service over gRPC.
- The short code selects the SMPP account; the message goes to the operator SMSC over a long-lived connection.
- Delivery reports (DLR) and inbound SMS (MO) come back over the same connection.
- The service publishes DLR and MO to Redis separately, tagged with the short code; Node.js services consume them from there.
Data flow, step by step
- A subscriber dials a USSD code; the operator forwards the request to the USSD Gateway.
- The gateway hands the request to the Node.js menu logic without making decisions itself.
- The logic resolves the menu item to a function via configuration and returns the reply through the gateway.
- Transport is separated from logic: Node.js services know nothing about SMPP, and the gateway knows nothing about business rules.
- Using the short code as the routing key lets one service hold accounts of different operators.
- Redis as an event buffer decouples DLR/MO intake from processing.
Technology stack
- GoSMPP transport and connection pool
- gRPCinterface for Node.js services
- SMPPprotocol for operator SMSCs
- Redisdelivering DLR and MO to consumers
- Node.jsbusiness logic and USSD menu logic