pocket·dialswitchboard

A SIP PBX on one ESP32-S3. No router, no server, no cloud.

What it is

Point a few SIP phones at a small board and they can call each other, transfer, park, page and forward, same as on a rack-mounted PBX. The board handles registration and call control; the audio goes phone to phone. It only touches media when a feature actually needs it: echo test, conference, voicemail, hold music, an outside line.

The same C++17 engine also builds as a plain desktop binary for Linux, macOS and Windows. That’s where most of the testing happens.

How it works

The board does signalling. The phones do audio. An ordinary extension-to-extension call streams RTP straight from phone to phone, so the board never carries it. That is what lets a microcontroller run a PBX.

SIP, UDP 5060SIP, UDP 5060RTP, phone to phonedashboard, HTTP 803CX Call Control:token and REST overHTTPS,events over WSS, audioas HTTPS streamsSIP over UDP,optional,never carries 911 or933

Phone 1001

pocket-dial
ESP32-S3, or classic ESP32

Phone 1002

Browser

3CX media anchor
dial 555, outside lines,
the only route for 911 and 933

Carrier SIP trunk

Public phone network

The engine is a back-to-back call broker, not an RFC 3261 proxy: it ends each call leg and starts the next one itself, and keeps itself in the dialog by rewriting Contact. SDP passes through unchanged, so two phones that both speak G.722 get wideband; an offer with none of PCMU, PCMA or G.722 is refused before anything rings. ARCHITECTURE.md has the full picture.

Phone 1002pocket-dialPhone 1001ring timer armed,20 s or 1002's configured no-answer timeINVITE sip:1002 (SDP offer)INVITE to 1002's registered Contact,Contact rewritten to the board,SDP unchanged100 Trying, 180 Ringing100 Trying, 180 Ringing (relayed)200 OK (SDP answer)200 OK, SDP unchanged,Contact rewrittenACKACKRTP, peer to peerRTP, peer to peerBYE200 OK(the board answers it itself)BYE (the board's own request,its own Via and CSeq)200 OK, the call ends

A call that does not connect ends at the board. It answers some calls itself and relays the callee’s answer for the rest:

Phone 1002pocket-dialPhone 1001alt[the caller hangs up first][nobody answers within the ringtime]alt[the offer has no PCMU, PCMA orG.722][1002 has Do Not Disturb on][1002 is not registered][no free call slot][1002 rings]INVITE sip:1002488 Not Acceptable Here480 Temporarily Unavailable404 Not Found503 Service UnavailableINVITE180 Ringing180 RingingCANCEL200 OKCANCEL487 Request Terminated487 Request Terminated(the board sends its own after 32 sif 1002 never does)ACKACKCANCEL480 Temporarily Unavailable,unless 1002 forwards on no answeror has voicemail

When the board does touch the audio

Some features need a party that can play, record or mix sound. For those the board answers the call itself and terminates the media, PCMU only.

911 or 933777999980 to 989440888997555796700 to 709*8, **exta groupextensiona dial-planrulean extensionno answer

Dialled
number,
checked in
this order

What
is it?

Emergency lane,
see below

Echo test

Page every phone,
auto-answer

Page a zone

Test tone

Meet-me conference,
up to 4 legs mixed
on the board

Multicast page

3CX anchor bridge

Voicemail retrieval

Park orbit,
hold music, rings
the parker back
after 90 s

Call pickup

Ring group
or hunt group

Group, page, park,
outside line

Forward always,
DND (480),
or ring the phone

Forward on
no answer,
or voicemail

Heavy outlines mark the legs where the board terminates the media. Everything else stays peer to peer.

A 911 or 933 is caught before every routing and policy check, including one dialled with a trunk prefix (9911) or produced by a dial-plan rule. Inside the INVITE handler, only dialog, syntax, registration and codec checks come first: a stale dialog draws a 481, malformed From or To a 400, an unregistered caller a 403, and an offer with no PCMU, PCMA or G.722 a plain 488. An offer with PCMA or G.722 but no PCMU is refused later, inside the emergency route, with a 503 Emergency Call Not Routable. Two earlier gates can still drop a 911 before the handler runs: the per-source rate limiter and IP allowlist, which discard the packet silently (open issue #1092), and the SDP admission gate, which yields to emergency only for too many audio streams. Once the call passes those, no operator policy (DND, forwards, dial plan, PIN) can delay, gate or misroute it, and the only route is the 3CX anchor:

E911 notify list3CX anchorpocket-dialPhonelogged EMERGENCY first,ahead of everyoperator settingan offer with none ofPCMU, PCMA or G.722never gets this far:a plain 488 at the codec gatealt[the far leg answers][3CX drops the leg before it connects]alt[the 3CX anchor is the provider and accepts thejob][no real anchor, not connected, no free slot,or the offer has PCMA or G.722 but no PCMU]never a SIP trunk,never a 404,never reaped for RTP silenceINVITE 911 (or 933,9911, 9933) from aregistered phonemakeCall 911,the bare number,on the tel_sos worker180 Ringingnotification, routedAnswered200 OK, PCMU,the board bridgesthe audioDropped503 Service Unavailablecorrection, NOT ROUTED503 Emergency CallNot Routable,Warning says why,no Retry-After(for that offer, if theanchor is connected:no G.711 codec offered)notification, NOT ROUTEDand the reason

Quickstart

Got a board? Plug it in over USB and open the browser flasher (Chrome, Edge or Opera, desktop only). It picks the right image, writes it, and can set up Wi-Fi, a WPA2 passphrase for the access point and the registrar mode before the first boot. If you’d rather do it from a terminal, FLASHING.md has you covered.

No board? Run it on a PC or a Raspberry Pi:

# Linux / macOS
curl -fsSL https://raw.githubusercontent.com/GlomarGadaffi/pocket-dial/main/install.sh | sh

# Windows (PowerShell)
irm https://raw.githubusercontent.com/GlomarGadaffi/pocket-dial/main/install.ps1 | iex

Or build it yourself:

cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
./build/SipServer --ip 127.0.0.1 --port 5060 --web 8080

Then open http://127.0.0.1:8080, point two softphones at sip:127.0.0.1:5060 as 1001 and 1002, and dial 777 for an echo test or 999 to page everyone. The setup guide walks through the rest.

What the phones get

Not all of this has been exercised on real hardware yet. The feature roadmap is honest about which features have, and which have only passed the host tests.

The pocket-dial operator console, Overview section: annunciator, signal path, readouts, and the jack board with four registered extensions
The operator console’s Overview, here on a desktop build with four demo phones registered.

Hardware

ESP32-S3: prebuilt in every release

eth
W5500 Ethernet, SPI
LilyGO T-ETH-ELITE, PoE
(Waveshare ESP32-S3-ETH from source)

wifi
own access point
any ESP32-S3

display
Guition JC3248W535
3.5 inch AXS15231B touchscreen

Classic ESP32: build from source

lan8720
internal EMAC + LAN8720 PHY
LilyGO T-Internet-COM

ImageBoardGood for
ethESP32-S3 + W5500 Ethernet. Default board: LilyGO T-ETH-ELITE S3 (802.3af PoE)An office closet. The best-tested path.
wifiAny ESP32-S3, running its own access pointA bag, a field site, a demo. No cables, no router.
displayGuition JC3248W535 (3.5" touchscreen)A wallboard that shows what the PBX is doing.
lan8720Classic ESP32 + LAN8720. Build from source.Older boards you already own.

Pin maps, wiring and parts lists live in HARDWARE.md. PHONE_COMPATIBILITY.md covers which phones work, and how well.

Read this before you plug it in

pocket-dial assumes a flat, trusted local network. Out of the box:

Learned2 re-register3 second ext.4 other MAC, 4031 first REGISTER6 digest, 4017 admin forgets it5 admin secures it

Learned, unlocked

Learned, locked

Secured

  1. first REGISTER from a new MAC, no challenge
  2. same MAC re-registers 30 s or more later, no earlier device holds the extension
  3. same MAC registers a second extension, marked shared, never locks
  4. another MAC registers the extension, 403 Extension Locked To Another Device
  5. admin secures it, the extension has a SIP secret (from either Learned state)
  6. every REGISTER digest-challenged, 401
  7. admin forgets it (from any state)

That is Learn mode: trust on first use. Switch the registrar to Secure and every REGISTER is digest-challenged; an extension with no stored secret cannot register at all.

Which all adds up to one rule: do not expose UDP 5060 or the dashboard to the Internet. Not with a port forward, not “just for a minute”. The threat model spells out what’s defended, what isn’t, and why.

Releases

v1.8.0 (2026-11-18) is current: 8 pull requests since v1.7.0, on memory pressure, soaked on two boards. The flasher offers it and every earlier tag; images and checksums are on the releases page too. main runs ahead of the latest tag between releases, and the changelog tracks what changed and what’s still a known gap.

Further reading