Rotary Phone over LTE: ESP32-S3 + Asterisk PBX
🤖 Researched and drafted automatically from the official docs, and reviewed before publishing. Commands are taken from the source projects — but always sanity-check before running anything on your own hardware.
A rotary phone is pure mechanical elegance—no batteries, no circuits, just a cam and contacts. An ESP32-S3 can decode the dial pulses, bridge to Asterisk running on your home server, and route calls over LTE. You get a working vintage phone that makes real calls without touching a carrier’s infrastructure.
This is a hardware and software integration project. You’ll need to understand dial pulse detection, SIP registration, and basic Asterisk configuration. The payoff: a conversation piece that actually works.
Hardware Setup
-
Acquire a rotary phone. Any vintage model works—Western Electric, Stromberg-Carlson, whatever you find. Test the dial mechanically first; clean contacts with isopropyl if needed.
-
Identify the dial pulse contacts. Rotary dials have a normally-open switch that closes once per digit. For example, dialing “5” produces five pulses. Trace the wires from the dial mechanism to the phone’s handset jack or internal terminals.
-
Connect the ESP32-S3 to the dial contacts. Use a GPIO pin (e.g., GPIO 1) as input. Add a 10 kΩ pull-up resistor to 3.3V and a 100 nF debounce capacitor to ground. The dial pulse will pull the GPIO low; your firmware counts the duration and pulses to determine the digit.
-
Wire the audio path. The phone’s speaker and microphone need to connect to the ESP32-S3’s I2S interface (or an external codec like the MAX98357A for speaker output and an I2S microphone module). You’ll need a small amplifier for the speaker; a simple Class D module (PAM8302 or similar) works.
-
Mount the ESP32-S3 inside the phone. Use hot glue or a 3D-printed bracket. Keep the handset cord intact if possible; re-terminate it to the audio codec inputs.
Asterisk Server Setup
- Install Asterisk on your home server. On a Linux machine (Ubuntu, Debian, CentOS), run the prerequisites and build:
sudo apt-get update
sudo apt-get install build-essential libncurses5-dev libssl-dev libxml2-dev libsqlite3-dev uuid-dev
git clone https://github.com/asterisk/asterisk.git
cd asterisk
./configure
make menuselect
make
sudo make install
sudo make samples
- Create a SIP peer for the ESP32. Edit
/etc/asterisk/sip.confand add:
[esp32-rotary]
type=friend
host=dynamic
context=from-internal
allow=ulaw
allow=alaw
allow=gsm
- Create a dial plan. Edit
/etc/asterisk/extensions.confand add a context:
[from-internal]
exten => _X.,1,Dial(SIP/${EXTEN}@upstream-provider)
exten => _X.,n,Hangup()
Replace upstream-provider with your SIP trunk (Twilio, Flowroute, or a local SIP provider).
- Start Asterisk:
sudo asterisk -vvvc
You’ll see the CLI prompt *CLI>. Type core show help to verify it’s running.
ESP32-S3 Firmware
-
Set up the Arduino IDE or PlatformIO with ESP32-S3 board support.
-
Write firmware to detect dial pulses. Pseudocode outline:
- Read GPIO pin for dial input
- Count low pulses (each pulse = one digit unit)
- Measure pause between pulse trains (indicates end of digit)
- Map pulse count to digit (1 pulse = “1”, 2 pulses = “2”, etc.; 10 pulses = “0”)
- Accumulate digits into a dial buffer
- On silence timeout, send the buffer to Asterisk via SIP INVITE
-
Integrate SIP client library. Use a lightweight SIP stack like PJSUA2-embedded or implement minimal SIP REGISTER and INVITE yourself. Register the ESP32 with your Asterisk server using the credentials you set in
sip.conf. -
Handle audio streaming. Use I2S to send/receive PCM audio at 8 kHz, 16-bit (ulaw or alaw codec). Route incoming RTP streams to the speaker codec and microphone input to outgoing RTP.
-
Test locally first. Before connecting over LTE, use a WiFi hotspot or home network to verify dial detection and SIP registration.
LTE Connectivity
-
Add an LTE modem to your setup. Options include a Quectel EC25, SIM7600, or similar module with UART or USB interface. Some have built-in TCP/IP stacks; others require the ESP32 to handle the stack.
-
Configure the modem. Send AT commands to establish a data connection:
AT+CPIN?
AT+CREG?
AT+CGACT=1,1
-
Route SIP traffic over the LTE data connection. Once the modem is online, the ESP32’s IP stack will send SIP packets through the modem’s gateway. Ensure your Asterisk server is reachable from the public internet or use a relay service (Twilio, Asterisk’s IAX2 protocol, or a VPN tunnel).
-
Keep the server on your LAN behind a firewall. Do not expose Asterisk directly to the internet. Instead, use a SIP trunk provider (Twilio, Nexmo, Flowroute) or run a secure VPN tunnel from the ESP32 to your home network, then to Asterisk. This prevents toll fraud and unauthorized access.
Testing
-
Verify dial pulse detection. Dial a test number (e.g., “1234”) and watch the serial monitor for pulse counts.
-
Check SIP registration. In the Asterisk CLI, type
sip show peersand confirm the ESP32 is registered. -
Make a test call. Dial a number; Asterisk should log the INVITE and attempt to route it. Listen for ringback or answer from the destination.
-
Adjust audio levels. Tweak the I2S gain, codec settings, and amplifier volume until speech is clear both ways.
Honest Take
This project is genuinely cool if you love retro hardware and want a working phone that doesn’t depend on commercial carriers. The dial pulse detection is straightforward; SIP is well-documented. Where it gets spicy: reliable audio codec integration on the ESP32, managing LTE uptime, and ensuring Asterisk stays accessible without exposing it to the internet.
If you’re comfortable with embedded systems, network protocols, and don’t mind debugging audio latency, it’s worth the effort. If you want something that “just works,” buy a smartphone. But if you want to say “I made a rotary phone that calls over LTE,” this is the way.
Related video
New self-hosted AI & homelab shorts, daily.
Subscribe on YouTubeRelated guides
Turn an old webcam into an AI security camera with Frigate
Run Frigate NVR on a spare PC to detect people, cars, and animals in real-time from cheap IP cameras or old USB webcams. Local processing, no cloud, integrates with Home Assistant.
Turn a $15 Android TV Box into an Armbian Linux Server
Flash Armbian on Amlogic S905/S922 TV boxes to run Docker, Pi-hole, and other services. Boot from USB first—eMMC flashing can brick it.
Turn Old WiFi Gear Into a 320Msps SDR Receiver with GQRX
Repurpose abandoned WiFi hardware as a software-defined radio receiver. Build a 320Msps SDR station on your homelab using GQRX, GNU Radio, and RTL-SDR dongles—no new gear required.