A push gateway between your PBX and the phones.
A phone cannot hold a SIP registration while it sleeps. The gateway holds it instead, and when a call arrives it wakes the phone with a push. You run it yourself, next to your PBX.
In testingSource
The gateway is built and in testing with the iOS and Android apps. There is no public release yet; the source is public.
What it does
It is a SIP back-to-back user agent with a REST API on the other side.
- Registrations
- Holds the SIP registration for each device against your registrar, so the PBX sees the phone as reachable whether or not the app is running. Transport, port, domain and registrar are set per device.
- Incoming calls
- Answers the PBX's INVITE with 100 Trying, then sends a push: an APNs VoIP push for iOS, a high-priority FCM data message for Android. The phone fetches the offer over HTTPS and answers through the API; the gateway completes the SIP side.
- Outgoing calls
- The app posts an SDP offer; the gateway sends the INVITE to the destination with the user's SIP credentials and returns the answer. Reject, hang up and BYE are API calls too.
- Media
- RTP flows directly between the PBX and the phone. The gateway carries signalling only.
- Storage
- SQLite, created on first run. No external database.
- Authentication
- JWT bearer tokens, issued from a user id and an API key you set in the config.
- Built with
- Rust: Axum for HTTP,
sqlxfor SQLite, andsip-5060for SIP parsing and digest authentication, the same crate the desktop app uses.
How a call reaches a phone
The PBX talks SIP to the gateway. The phone talks HTTPS to the gateway.
The exchange below is the gateway's view of one incoming call to an iPhone. Lines in amber leave the gateway; lines in green arrive at it. The push and the two HTTP requests are the parts the PBX never sees.
- 0.000← INVITE sip:alice@pbx.example.com from PBX
- 0.002→ 100 Trying to PBX
- 0.004→ PUSH APNs VoIP push: call_token, caller
- 0.611← GET /v1/calls/{token} phone wakes
- 0.613→ 200 SDP offer, caller info
- 3.870← POST /v1/calls/{token}/accept sdp_answer
- 3.872→ 200 OK SDP from the phone to PBX
- 3.901← ACK from PBX
On the phone, the push is handed to CallKit or to Android's ConnectionService, so the native incoming-call screen appears before the app has finished waking. If the user declines, the app posts to/v1/calls/{token}/reject and the gateway returns 603 to the PBX.
API
Twelve routes. POST /v1/auth/token issues the bearer token the rest require; /health is open.
| Method | Path | What it does |
|---|---|---|
| POST | /v1/auth/token | Issue a bearer token for a user id. An API key is optional, set in the config. |
| POST | /v1/devices | Register a device: platform, push token, SIP account and registrar. |
| GET | /v1/devices/{id} | The device and its SIP registration status. |
| DELETE | /v1/devices/{id} | Unregister a device. |
| POST | /v1/devices/{id}/heartbeat | Keep the device's registration alive. |
| POST | /v1/calls | Start an outgoing call; the gateway sends the INVITE. |
| GET | /v1/calls/{token} | Fetch an incoming call: SDP offer and caller. |
| POST | /v1/calls/{token}/accept | Answer with an SDP answer. |
| POST | /v1/calls/{token}/reject | Decline; the gateway sends 603 to the PBX. |
| POST | /v1/calls/{token}/hangup | End the call; the gateway sends BYE. |
| GET | /v1/calls/{token}/status | The call's state. |
| GET | /health | Returns ok. |
The mobile apps use this API through aria-mobile-core. Nothing stops another client from using it.
Running it
One binary, one TOML file, a SQLite database it creates itself.
- Network
- UDP to your SIP server for REGISTER and INVITE traffic, and outbound HTTPS to APNs and FCM.
- Push credentials
- An APNs authentication key (
.p8) for iOS, a Firebase service account JSON for Android, or both. The gateway starts without either but cannot then deliver incoming calls. - TLS
- Put it behind a reverse proxy such as nginx, Caddy or Traefik for HTTPS. The apps connect over HTTPS.
- DNS
- A subdomain, for example
gateway.example.com, pointed at the server. - Hardware
- 1 vCPU and 256 MB RAM handles hundreds of concurrent registrations; about 10 MB of disk for the binary and database. Linux, macOS or anything Rust targets.
Build
cargo build --release
# binary: target/release/aria-gatewayConfigure
cp gateway.example.toml gateway.toml
# set auth.secret and the push provider credentialsThe example file, with the push sections filled in. Configure at least one of APNs or FCM.
[server]
listen = "0.0.0.0:8080"
public_url = "https://gateway.example.com"
[database]
url = "sqlite:gateway.db?mode=rwc"
[auth]
secret = "CHANGE-ME-TO-A-STRONG-RANDOM-SECRET"
token_expiry_secs = 2592000
[push.apns]
key_path = "/path/to/AuthKey_XXXXXXXXXX.p8"
key_id = "XXXXXXXXXX"
team_id = "XXXXXXXXXX"
bundle_id = "com.example.aria"
sandbox = false
[push.fcm]
service_account_path = "/path/to/firebase-service-account.json"
project_id = "your-firebase-project-id"Run
./target/release/aria-gateway --config gateway.toml
# listens on 0.0.0.0:8080 by default; override with --listen
./target/release/aria-gateway --listen 0.0.0.0:443Docker
The image builds from the parent directory of the checkout; see the Dockerfile.
# from the parent directory of the push-gateway checkout
docker build -f push-gateway/Dockerfile -t aria-gateway .
docker run -d -p 8080:8080 -v /path/to/data:/data --name aria-gateway aria-gateway
# mount gateway.toml, the APNs .p8 key and the FCM service account JSON into /dataStatus
Built, in testing, not released.
In testing
The gateway is being tested with the iOS and Android apps. There are no binaries or images published yet; you can build it from source. The desktop app does not need it.
The gateway's licence is proprietary to 5060 Solutions. The crates it is built on areMIT or Apache-2.0.