A daemon that turns a serial AT-command modem (SIM800L class and similar) into an SMS gateway device with an HTTP API, health checks, and Prometheus telemetry. Part of the SMSGate ecosystem.
The AT Gateway manages the full lifecycle of an AT-command modem connected over a serial port: it runs the boot init sequence, gates on SIM readiness, tracks connection state and signal quality, and exposes the device over a small HTTP API.
- AT-command modem bring-up:
AT,ATE0,+CMEE=1,+CMGF=1,+CNMI=2,1,0,0,0,+CPIN?READY gate - Modem state machine with reconnect handling and per-command timeouts
- Signal quality polling and Prometheus metrics (
/metrics) - Automatic device registration with persisted local storage
- Unified HTTP API with HTTP Basic auth and Swagger/OpenAPI docs
- Health endpoints via go-core-fx (
/health,/health/live,/health/ready)
- Go 1.25+ for building from source
- A serial AT-command modem (e.g. SIM800L) exposed as a serial device
- Serial device permissions for the modem port user
make deps
make build
AUTH__BASIC__PASSWORD=change-me ./bin/at-gatewayThe default command is serve; the HTTP API listens on 127.0.0.1:3000.
Configuration is loaded from environment variables (double-underscore nesting) or an optional YAML file via CONFIG_PATH.
| Variable | Default | Description |
|---|---|---|
HTTP__ADDRESS |
127.0.0.1:3000 |
HTTP API listen address |
HTTP__PROXY_HEADER |
X-Forwarded-For |
Trusted proxy header |
HTTP__PROXIES |
(empty) | Comma-separated trusted proxies |
HTTP__OPENAPI__ENABLED |
true |
Enable Swagger UI at /api/v1/docs |
MODEM__PORT |
/dev/ttyUSB0 |
Serial device of the modem |
MODEM__BAUD_RATE |
115200 |
Serial baud rate |
MODEM__INIT_TIMEOUT |
30s |
Modem init timeout |
MODEM__COMMAND_TIMEOUT |
10s |
Per-command timeout |
STORAGE__PATH |
data/storage.json |
Local JSON storage file |
AUTH__BASIC__USERNAME |
sms |
Basic auth username |
AUTH__BASIC__PASSWORD |
(required) | Basic auth password |
DEVICE__NAME |
(empty) | Device display name |
CONFIG_PATH |
(empty) | Optional YAML config file path |
Full reference: Custom Gateway Setup.
docker run -d --name at-gateway \
--device /dev/ttyUSB0 \
-v /path/to/at-gateway-data:/app/data \
-e MODEM__PORT=/dev/ttyUSB0 \
-e HTTP__ADDRESS=0.0.0.0:3000 \
-e AUTH__BASIC__PASSWORD=change-me \
-p 3000:3000 \
ghcr.io/android-sms-gateway/at-gateway:latest/app/data must be persisted (it holds the registered device ID in data/storage.json) and writable by UID 1000 (appuser), e.g. chown 1000:1000 /path/to/at-gateway-data.
| Method | Path | Description |
|---|---|---|
| GET | /health |
Health probes (live, ready) |
| GET | /metrics |
Prometheus metrics |
| GET | /api/v1 |
Service status |
| GET | /api/v1/devices |
Registered devices |
| GET | /api/v1/messages |
Message endpoints (scaffolded) |
| GET | /api/v1/inbox |
Stored incoming messages |
| POST | /api/v1/inbox/refresh |
Replay stored messages as webhooks |
All /api/v1 routes require HTTP Basic auth. Full reference: OpenAPI docs.
Contributions are welcome. Open an issue or pull request; follow the repo's make fmt / make lint / make test checks and the README style guide.
Apache-2.0. See LICENSE.