- Go 63.1%
- TypeScript 20.5%
- JavaScript 6.7%
- Kotlin 4%
- CSS 2.2%
- Other 3.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
ci / backend-test (push) Successful in 1m24s
play / listing (push) Successful in 4m47s
play / deploy (push) Has been skipped
ci / frontend-test (push) Successful in 6m16s
ci / build-1 (push) Successful in 1m23s
ci / asterisk-docker (push) Successful in 0s
ci / build-2 (push) Successful in 1m54s
ci / sbc-docker (push) Successful in 0s
ci / build (push) Successful in 2m23s
ci / openpbx-docker (push) Successful in 0s
android / apk (push) Successful in 9m23s
ci / build-3 (push) Successful in 4m7s
ci / chart (push) Successful in 0s
All accounts receive calls. For every outgoing call the app asks which account to use. Each account has its own device token and UnifiedPush registration; push messages name the account, since Firebase gives the app only one token and call ids are only unique per server. The ring screen shows the server. A push token is no longer unique on the server: the old index is removed when the database is upgraded. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qu4xuLzARXcwybTFRjHWYd |
||
| .forgejo | ||
| cmd | ||
| deploy | ||
| docs/screenshots | ||
| internal | ||
| mobile | ||
| play | ||
| test | ||
| web | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| compose.yaml | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
OpenPBX
A container-first telephone system: a Go API and React web UI which configure and supervise Asterisk. Built for German numbering, usable elsewhere.
Status: young software. Automated tests run real SIP calls against Asterisk, but it has not been used with hardware phones or a real SIP provider yet. Test your setup, including emergency calls, before relying on it.
Screenshots
The layout of web client and admin console is inspired by 3CX, with its own look.
| Team | Browser softphone |
|---|---|
![]() |
![]() |
| Admin console | Extensions |
|---|---|
![]() |
![]() |
| DECT base station | |
|---|---|
![]() |
| Extension settings | Call flow designer |
|---|---|
![]() |
![]() |
| Call history | Reports |
|---|---|
![]() |
![]() |
| Queue wallboard | |
|---|---|
![]() |
| System settings | Light web client |
|---|---|
![]() |
![]() |
Android app

The screenshots show fictional demo data and are recreated with test/screenshots.sh.
Features
- Extensions, ring groups, queues, conferences, voicemail, call recording
- Call parking, paging and intercom, feature codes, night mode and public holidays, uploadable music on hold, presence, queue wallboard, audit log
- SIP trunks which reconnect by themselves, with several numbers each, with templates for German and international providers and the FRITZ!Box
- E.164 numbering, Durchwahl, inbound rules with office hours, outbound rules with permissions
- Visual call flow (IVR) designer: prompts, menus, digit input, PIN authentication, surveys, credit card input, conditions, variables, holidays, recording, HTTP and database requests, phone book lookup, e-mail, call back, call data, extension and queue status, text to speech and speech input (through an OpenAI compatible speech service), templates and test runs
- Browser softphone and remote office agent (SBC) which only need the web port
- Android app: several accounts, also on different servers, sign in by QR code, push calls through Firebase or UnifiedPush (no permanent connection of its own), Android's own call screen
- Fax: web, fax to mail, mail to fax
- Phone provisioning (Yealink, Snom, Grandstream), phone book, call history and reports
- DECT base stations (Gigaset N670 / N870 IP PRO): assign handsets to extensions in the web UI; the base station fetches its configuration (not yet tried with a real base station)
- Local, LDAP and OpenID Connect logins, automatic IP blacklisting
- Two-factor authentication with an authenticator app (TOTP) or passkeys, recovery codes; passkeys also log in without a password
- Every extension can log in with its number: set a web password in the extension. New extensions with an e-mail address receive one by mail, if SMTP is set up
- Backups to S3, SFTP, FTP, SMB; Prometheus metrics, Grafana dashboard, health alerts
- REST API (Swagger UI at
/swagger/index.html) and an MCP server at/mcp - SQLite, MariaDB or PostgreSQL
Quick start (Docker Compose, Linux)
The OpenPBX image is based on jonasled.dev/infra/images/scratch-rootless, so building
needs docker login jonasled.dev once.
cp .env.example .env # set OPENPBX_AMI_SECRET to a long random value
docker compose up -d --build
Open http://<host>:8080 and log in as admin. Without OPENPBX_ADMIN_PASSWORD the
generated password is printed in the openpbx log on the first start.
Asterisk uses the host network, because SIP needs the real client addresses and many
RTP ports. Its manager and websocket ports are bound to the private compose bridge
(172.30.99.1) only.
| Port | Needed for |
|---|---|
| TCP 8080 (or 443) | web UI, API, browser softphone, SBC agents, provisioning |
| UDP/TCP 5060 | desk phones and SIP trunks |
| UDP 10000-10199 | media of desk phones and SIP trunks |
Do not expose 5060 to the internet unless a trunk needs it; use SBC agents for remote phones.
HTTPS and the softphone
Browsers only allow microphone access over HTTPS. The softphone also needs TURN, which
shares the web port, so OpenPBX has to terminate TLS itself (OPENPBX_TLS_CERT,
OPENPBX_TLS_KEY), or the proxy in front has to pass TCP through. An ordinary HTTP
reverse proxy serves the web UI but breaks softphone audio, unless TURN gets its own
port: OPENPBX_TURN_LISTEN=:3478 and
OPENPBX_TURN_URL=turn:pbx.example.org:3478?transport=tcp. Behind a proxy also set
OPENPBX_TRUSTED_PROXY, so the blacklist sees client addresses and never blocks the
proxy. Set OPENPBX_PUBLIC_URL.
Kubernetes
helm install openpbx oci://forgejo.jonasled.dev/jonasled/openpbx/charts/openpbx \
--version <version> --set tls.existingSecret=<tls secret>
OpenPBX and Asterisk run in one pod; only one replica is supported. See
values.yaml. There are two network modes:
| Mode | Values | Reachable |
|---|---|---|
| Host network (default) | SIP and RTP on the node | |
| Cluster network, web only | hostNetwork=false |
browser softphone, mobile app, SBC agents (web port only) |
| Cluster network with SIP | hostNetwork=false, sip.service.enabled=true, sip.externalAddress=... |
additionally desk phones and trunks through a LoadBalancer or NodePort |
With the SIP service:
helm install openpbx ... --set hostNetwork=false --set sip.service.enabled=true \
--set sip.externalAddress=203.0.113.10 --set sip.service.loadBalancerIP=203.0.113.10 \
--set sip.rtp.end=10099 --set 'sip.localNets={10.244.0.0/16}'
- The load balancer must support UDP and TCP in one service and should keep client
addresses (
externalTrafficPolicy: Local, the default). WithClusterthe IP blacklist would block the node address and with it every phone. - Each RTP port is a service port: keep the range small (about 4 ports per call).
- With
NodePort, SIP and RTP ports must lie in 30000-32767. - The softphone and mobile app need HTTPS: TLS on the pod (
tls.existingSecretwith a web service which passes TCP through) or an ingress, see below.
Ingress and Gateway API
An HTTP ingress cannot carry TURN, which transports the audio of the browser softphone and the mobile app. Either give TURN its own service:
hostNetwork: false
trustedProxies: [10.244.0.0/16] # network of the ingress controller pods (required)
ingress:
enabled: true
className: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" # long lived websockets
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-body-size: "0" # restore of backups
hosts: [pbx.example.org]
tls: [{ secretName: pbx-tls, hosts: [pbx.example.org] }]
turn:
service: { enabled: true, type: LoadBalancer, externalAddress: turn.example.org }
With Traefik use className: traefik; examples for its annotations are in
values.yaml.
or pass TLS through to the pod (ingress.tlsPassthrough=true with tls.existingSecret
or certificate.enabled; ingress-nginx needs --enable-ssl-passthrough, and with
ingress.controller=traefik the chart creates an IngressRouteTCP instead). Then
everything uses port 443, but the pod does not see client addresses, so web logins are
not blacklisted per client. httpRoute.* creates a Gateway API route instead of an
ingress, with the same TURN requirement (rendered in tests, not tried with a gateway).
More chart settings
All settings are documented in values.yaml:
| Values | Purpose |
|---|---|
secrets.existingSecret |
own secret with ami-secret, admin-password, metrics-token |
database.* |
MariaDB or PostgreSQL, DSN from a secret |
ldap.*, oidc.* |
directory and single sign-on, passwords from secrets |
mobilePush.existingSecret |
Firebase service account for the Android app |
certificate.* |
certificate through cert-manager |
metrics.enabled, .serviceMonitor, .grafanaDashboard |
Prometheus and Grafana |
networkPolicy.* |
restrict incoming traffic (without host network) |
persistence.*, extraVolumes, extraEnv |
storage and further settings |
serviceAccount.*, affinity, tolerations, priorityClassName, podAnnotations |
scheduling and metadata |
helm test <release> checks that the web service answers.
DECT base stations
Add the base station under Admin → DECT base stations: MAC address, and one extension
per handset. Enter the provisioning address shown there (.../%MACD.xml) in the web
interface of the base station, then register the handsets with the shown PIN. The file
follows the reference configuration for the Gigaset N870/N670 IP PRO in the BroadSoft
partner guide. It contains the SIP passwords: keep the address secret and use HTTPS. It
has not been tried with a real base station; other models (N610, other vendors) are
not supported.
Two-factor authentication
Users set it up under their account menu, Password, 2FA and API tokens. As soon as an account has an authenticator app or a passkey, the password alone no longer logs it in.
- Passkeys need HTTPS (or
localhost) and a host name; setOPENPBX_PUBLIC_URLbehind a proxy. They are bound to that name: changing it makes them unusable. A passkey logs in without a password only if it verifies the user (PIN, fingerprint) and only for local accounts; directory (LDAP) accounts use it as second factor. - Single sign-on accounts use the second factor of the identity provider.
- The Android app accepts authenticator or recovery codes at sign in, not passkeys.
- API tokens and app device tokens are not asked for a second factor.
- Lost factor: use a recovery code, or let another administrator press Reset 2FA
under Web users. If no administrator can log in, run where the database is reachable,
with the same
OPENPBX_DB_*settings:docker compose exec openpbx /openpbx reset-2fa <user name>(Kubernetes:kubectl exec deploy/<release>-openpbx -c openpbx -- /openpbx reset-2fa <user name>).
Remote office (SBC)
Create the agent under Remote offices, then on a host in that office:
OPENPBX_SBC_URL=https://pbx.example.org OPENPBX_SBC_TOKEN=... \
docker compose -f deploy/compose.sbc.yaml up -d --build
Phones use that host as SIP server (UDP 5060). For provisioned phones, enter the agent address in the phone, since the generated configuration contains the PBX address.
Configuration
Environment variables, all prefixed OPENPBX_:
| Variable | Default | Meaning |
|---|---|---|
LISTEN |
:8080 |
web address, IPv4 and IPv6 |
PUBLIC_URL |
external base URL (required for OIDC) | |
TLS_CERT, TLS_KEY |
serve HTTPS | |
TRUSTED_PROXY |
networks whose X-Forwarded-For is trusted, comma separated |
|
DB_DRIVER, DB_DSN |
sqlite |
sqlite, mariadb (DSN with parseTime=true), postgres |
ADMIN_PASSWORD |
random | initial administrator password |
DATA_DIR, ASTERISK_DIR |
spool and generated configuration, shared with Asterisk under the same paths | |
AMI_ADDR, AMI_USER, AMI_SECRET |
Asterisk manager connection | |
ENGINE_BIND, ENGINE_ALLOW |
all, private networks | where Asterisk's manager/websocket listen and who may connect |
SIP_PORT, RTP_START, RTP_END |
5060, 10000, 10199 |
SIP and media ports |
SIP_EXTERNAL_ADDRESS, SIP_LOCAL_NETS |
web settings | override the public SIP address and the networks reached directly |
FCM_CREDENTIALS |
Firebase service account key; enables push calls of the mobile app through Google | |
UNIFIEDPUSH, UNIFIEDPUSH_ALLOW |
true, |
push calls through UnifiedPush; private push servers (hosts, networks) which may be reached |
SIP_IPV6 |
false |
SIP over IPv6 in addition to IPv4 |
TURN |
true |
built-in TURN server for the softphone |
TURN_LISTEN, TURN_LISTEN_TLS |
, false |
additional TURN-only port (for use behind an HTTP proxy), optionally with TLS |
TURN_URL, TURN_RELAY_IP, TURN_PEERS |
automatic | override TURN URL, relay address, Asterisk media addresses |
METRICS_TOKEN |
enables /metrics with this bearer token |
|
LDAP_URL, LDAP_BIND_DN, LDAP_BIND_PASSWORD, LDAP_BASE_DN |
LDAP login | |
LDAP_USER_FILTER, LDAP_ADMIN_GROUP, LDAP_EXTENSION_ATTRIBUTE, LDAP_STARTTLS |
(uid=%s), , , true |
LDAP mapping |
OIDC_ISSUER, OIDC_CLIENT_ID, OIDC_CLIENT_SECRET |
single sign-on; redirect URI <PUBLIC_URL>/api/v1/auth/oidc/callback |
|
OIDC_SCOPES, OIDC_USERNAME_CLAIM, OIDC_GROUPS_CLAIM, OIDC_ADMIN_GROUP, OIDC_EXTENSION_CLAIM |
openid profile email, preferred_username, groups |
OIDC mapping |
LOG_LEVEL, LOG_FORMAT |
info, json |
error, warn, info, debug, trace; json or text (also for the SBC agent) |
Numbering plan, security limits, e-mail (SMTP/IMAP), alerts and backups are set in the web UI.
Debugging broken calls
- Dial
*43: an announcement, then you hear yourself. - Browser phone and app: after every call they show what went wrong in plain words (no audio path, relay unreachable, silent microphone, one way audio, poor network, why a call failed). Check connection tests server, microphone and audio relay; the app also checks its Android permissions and sends itself a test push.
- Admin → Call diagnostics: the last day's calls with findings, a timeline, audio statistics of every leg as Asterisk saw them, and the reports of browser and app phones; downloadable for bug reports. It is kept in memory only (gone after a restart).
- The call ID there is also in OpenPBX's and Asterisk's logs.
Logs
Both programs write one line per entry to the standard output. At info: logins (also
failed ones, with the address), changes by users and administrators, phone and trunk
registrations, rejected SIP requests, ended calls (extension, result, duration), pushes,
backups and configuration reloads; failed and slow (over 1 s) database queries without
their values. Every web request has an ID, returned as X-Request-ID, which links the
entries about it; successful reads appear only at debug.
Passwords, tokens and keys are not logged, and addresses in errors are cut to the server
name. Phone numbers of calls and phone addresses appear only at debug; user names and IP
addresses of logins are logged at info, so treat the log as personal data. One
exception: on the very first start the generated administrator password is printed, unless
ADMIN_PASSWORD is set.
Asterisk's log (the asterisk container) tells what happens to each call: which trunk
it came in on and for which of your numbers, which extension, group or trunk was tried and
with which result and cause, and why a call was refused. Lines start with [call <ID>];
it is the call_id of OpenPBX's call ended entry. Caller numbers are not in these lines
(Asterisk's own warnings may contain addresses and numbers).
OPENPBX_ASTERISK_VERBOSE=true additionally logs every dialplan step, including
everything callers enter, such as PINs and card numbers. Use it only for a short time,
restart both containers after changing it, and treat that log as secret.
Phone features
| Code | Function |
|---|---|
*97 |
own voicemail (record your greeting here) |
*98 |
voicemail of any mailbox, with PIN |
*8 |
pick up a call of your pickup group |
*78, *79 |
do not disturb on, off |
*72<number>, *73 |
forward all calls to an extension or number, off |
*45, *46 |
pause, resume as a queue agent (all queues) |
*43 |
test call: an announcement with your extension number, then an echo of your voice until # |
*80<extension> |
intercom: the phone answers by itself, if it supports this |
*85 |
switch night mode (extensions allowed under System settings) |
Call parking is switched on under System settings: transfer a call to the park number and dial the announced slot from any phone to fetch it. Paging is a call group strategy.
Fax by mail: send a PDF from the extension's e-mail address to the fax mailbox with the
subject FAX <number> <fax PIN>.
Security notes
- Backups contain passwords, SIP secrets and authenticator secrets and are not encrypted by OpenPBX.
- The provisioning URL is a secret: with it and a MAC address SIP passwords can be read.
- With host networking, logged-in users can relay UDP through TURN to other services on the Asterisk host address.
- Every phone may use intercom (
*80) on any extension without do not disturb. A phone which obeys auto-answer then opens its microphone; switch auto-answer off on phones where that is not wanted. - Call flows can send data to other systems. Database connections are stored unencrypted; use database accounts with the least rights. The credit card step protects card data inside OpenPBX, but does not make an installation PCI DSS compliant (SIP and audio of your provider and phones, networks and the receiving service are all in scope).
- Call recording is subject to legal requirements; check them before enabling it.
Development
go test ./... # unit tests
cd web && npm ci && npm test && npm run build
npm run dev serves the UI with a proxy to a backend on port 8080. The web build is
embedded into the Go binary.
Tests which need Docker (not part of CI):
| Command | What it tests |
|---|---|
test/integration.sh |
real SIP calls against Asterisk; DB=mariadb / DB=postgres |
IPV6=1 test/integration.sh |
calls over IPv6 |
SOFTPHONE=1 test/integration.sh |
two browsers calling through the web port (needs Chromium) |
MOBILE=1 test/integration.sh |
the Android app on an emulator (see mobile/README.md) |
test/backup.sh |
S3, SFTP, FTP and SMB servers |
test/ldap.sh |
OpenLDAP |
test/helm.sh |
the chart in a temporary minikube cluster, all network modes with calls (after integration.sh) |
CI (.forgejo/workflows/ci.yaml) runs unit tests and builds the images and the chart.
Regenerate the API documentation after changing handlers:
go run github.com/swaggo/swag/cmd/swag@v1.16.6 init -g cmd/openpbx/main.go \
-o internal/apidocs --packageName apidocs --parseInternal --outputTypes go,json











