P25 on this network
Core 1.0.1 · “Tatra Edition” — pairs with Multi-Mode Digital 1.0.1. The Advanced protocol gained floor control in this release, so both ends must be on 1.0.1; the Basic protocol is unchanged and older Basic terminals keep working exactly as before.
How the two protocols this core speaks actually work on the wire, what the Multi-Mode Digital app does with them, and what would have to be built for an MMDVM hotspot to reach the wideband side. Everything below about the Basic wire format was read out of the upstream reflector and MMDVM sources rather than assumed; the Advanced format is this project's own and is described from its implementation.
1 · What P25 is
P25 (APCO Project 25, standardised as the TIA-102 series) is the digital land mobile radio family used by public safety in North America and, increasingly, by amateur radio operators on the same hardware. It is a narrowband voice system: it was designed to put intelligible speech through 12.5 kHz of channel, not to sound good.
Phase 1 is what every amateur P25 network runs. It is FDMA in a 12.5 kHz channel, and its air interface is fixed by the standard rather than left to the implementer:
| Layer | P25 Phase 1 |
|---|---|
| Modulation | C4FM — four-level FSK, ±1.8 kHz and ±0.6 kHz deviation |
| Symbol rate | 4800 baud, 2 bits per symbol → 9600 bps gross |
| Vocoder | IMBE Full rate — 88 bits per 20 ms frame (11 bytes), 8 kHz |
| Framing | TIA-102 frames — LDU1 and LDU2 voice frames, 360 ms superframe |
| Error correction | FEC specific to P25 — Golay, Hamming and Reed-Solomon over the voice and control fields, with interleaving |
| Signalling | Link Control (LC), carried inside the voice frames — call type, source and destination |
| Network identity | NAC (Network Access Code, 12-bit, per RF channel) and the Network ID / WACN of the system |
Yaesu System Fusion also transmits something it calls C4FM, and the two are not interchangeable. The modulation is the same family of four-level FSK; everything above it differs — System Fusion carries a different vocoder inside a different frame structure, with its own error correction and signalling, none of which a P25 radio can interpret. A receiver demodulating one will recover symbols from the other and understand nothing. Sharing a modulation name says as much about compatibility as two languages sharing an alphabet.
Voice is narrowband: IMBE Full rate is what every P25 radio on the air produces. Phase 2 adds two-slot TDMA with a half-rate coder; it exists in commercial fleets but essentially not on amateur networks, and this core does not speak it.
Two identifiers do all the addressing work, and both are 24-bit:
- Radio ID (source) — who is talking. On amateur networks this is the operator's DMR/radio ID.
- Talkgroup (destination) — the channel the transmission is addressed to. A radio hears a talkgroup when it is affiliated to it.
A transmission is not a stream in the internet sense. It is a sequence of superframes: an LDU1 followed by an LDU2, 360 ms in total, each LDU being nine 20 ms voice frames plus interleaved link-control metadata. The identifiers above travel inside that metadata, which is why they repeat continuously during a call — a receiver that joins mid-transmission still learns who is talking and on what within a fraction of a second.
None of that survives contact with the internet unchanged. Over IP, P25 is carried by the
MMDVM ecosystem: a hotspot or repeater runs MMDVMHost, which hands P25 to
P25Gateway, which speaks UDP to a reflector. That reflector protocol — not the
RF standard — is what this core implements as Basic.
Basic — the P25Reflector protocol
This is the interoperable protocol. Anything that talks to a conventional P25 reflector talks to this core unmodified: MMDVM hotspots, repeaters via P25Gateway, and other reflectors. It is deliberately not extended — every deviation would break something in the field.
| Aspect | Value |
|---|---|
| Transport | UDP, port 41000, one datagram per frame, no extra framing |
| Session identity | the source UDP address itself — there is no session ID in any packet |
| Connect & keepalive | poll 0xF0 + 10-character callsign; the server echoes it back verbatim as the implicit acknowledgement |
| Disconnect | 0xF1, same layout, no reply |
| End of transmission | 0x80 + sixteen zero bytes |
| Session timeout | 120 s with no packet of any kind |
| Voice | LDU1 records 0x62–0x6A, LDU2 0x6B–0x73; each datagram carries exactly one 11-byte IMBE frame |
| Cadence | one datagram every 20 ms · 180 ms per LDU · 360 ms per superframe |
| Talkgroup | 24-bit big-endian in record 0x65 |
| Source radio ID | 24-bit big-endian in record 0x66 |
| Audio | narrowband only — IMBE Full rate, 8 kHz, no negotiation |
Nothing in the protocol guarantees a transmission ever ends. A hotspot that loses power
mid-sentence simply stops sending, and the last 0x80 never arrives. The core
therefore releases the talkgroup after 1500 ms without frames, which is why a dropped
transmission frees the channel almost immediately instead of jamming it until the session
times out.
Advanced — this project's extension
Advanced exists because Basic cannot express three things people actually want: audio wider than 8 kHz, listening to more than one talkgroup at a time, and calling one person rather than a channel. It runs on the same UDP port as Basic and is separated by the first byte of each datagram, whose values are disjoint from every Basic tag. One listener, two protocols, no second port to open.
| Byte | Datagram |
|---|---|
0xA0 | HELLO — JSON, client → server |
0xA2 | WELCOME — JSON, server → client |
0xA3 | BYE — explicit disconnect, dropped from the roster immediately |
0xA1 | voice, v1.0 framing |
0xA5 | voice, v1.1 — [tag][flags][dest:4][seq:4][source:4][payload] |
0xA6 | control — currently only private call busy |
Handshake and negotiation
The client sends JSON: protocol version, radio ID, callsign, the codecs it can receive in order of preference, the talkgroup it wants, any talkgroups it is scanning, its jitter target, whether it accepts audio that originated in the other mode, and the keepalive interval it would like. The server replies with what it actually selected. Unknown fields are ignored on both sides, so a newer client and an older server still interoperate — that is the whole reason the handshake is JSON rather than a packed struct.
Keepalive is negotiated rather than fixed. A client on a metered or battery-constrained link can ask for a much longer interval than Basic's implicit one and stop waking its radio every few seconds.
Codecs on the wire
| Tag | Mode | Coder | Rate | Frame |
|---|---|---|---|---|
0x01 | narrowband | IMBE Full rate | 8 kHz | 11 bytes, 20 ms |
0x03 | wideband | Opus | 16 kHz | variable, 60 ms |
Both tags are live on the same link at the same time: which one arrives depends on the terminal that is transmitting, not on the link. A receiver therefore decodes per talker rather than per session, which is what makes the two modes seamlessly integrated — narrowband and wideband stations share a talkgroup and simply hear each other, with nothing to select and nothing to configure.
Multi-talkgroup and private calls
The v1.1 voice frame carries an explicit 4-byte destination, so one session can be addressed on several talkgroups without renegotiating. A flag bit switches the destination's meaning from talkgroup to radio ID, which is how private calls work: the frame is relayed unicast to that one session and never fans out. If the callee is busy, the core answers the caller with a control frame so the radio can give a busy tone instead of silence.
The frame also carries a 4-byte source radio ID, but the core overwrites it with the authoritative value from the session before relaying. A client cannot claim to be someone else by editing a field.
Floor control — who may transmit
Half-duplex is not a politeness convention between operators; it is a property somebody has to enforce, and the core is the only party that sees every speaker. Each talkgroup has at most one holder of the floor, and every request gets an explicit answer.
When a radio presses PTT it asks for the floor and the core replies at once — granted, or denied. A denial carries the radio ID of whoever is speaking, so the screen can name them instead of showing a bare "busy". The floor is reserved at the moment of the request rather than at the first voice frame, which is what keeps two operators who press within milliseconds of each other from both believing they are on the air.
Waiting for that answer costs nothing audible. The terminal opens its microphone immediately and buffers the encoded speech until the reply arrives, then sends it in order, so a granted press loses no syllable of the first word. A refused press transmits nothing at all — and if the core stays silent, the radio speaks anyway rather than being held mute by an unanswered question.
A holder who falls silent is treated as finished within a few hundred milliseconds. The wideband wire carries no end-of-transmission marker, so without that rule the channel would stay locked to the previous speaker and the immediate reply — the whole point of a QSO — would be refused by a station that had already stopped talking.
Control frames are marked as expedited traffic on the wire. A "busy" that arrives after the operator has finished speaking is as useless as one that never arrives.
2 · Multi-Mode Digital
Multi-Mode Digital is the Android terminal built alongside this core. It is a half-duplex push-to-talk application: the microphone is opened when PTT is pressed and released the moment it is let go, never in between. It speaks both P25 protocols, plus DMR and TETRA, which is where the name comes from.
| Feature | Basic | Advanced | Notes |
|---|---|---|---|
| IMBE narrowband voice | yes | yes | 8 kHz, 11-byte frames |
| Opus wideband voice | no | yes | 16 kHz; Basic has no way to signal it |
| Mixed-codec talkgroup | no | yes | decoder selected per talker, not per session |
| Talkgroup select | yes | yes | |
| Scan across talkgroups | one | yes | Advanced scans several on a single session |
| Talkback with hold | yes | yes | reply lands on the talkgroup that was heard, for as long as hold lasts |
| Private call | no | yes | unicast, with a busy answer |
| Negotiated keepalive | no | yes | materially better battery life |
| Hardware / Bluetooth PTT | yes | rugged-handset keys, and speaker-microphones over Bluetooth | |
On the audio path the app conditions transmit audio per vocoder rather than applying one equaliser to everything: the narrowband, wideband and TETRA coders disagree about what helps them, and a single set of controls could only ever be right for one of the three. On receive, decoded levels are aligned across codecs so that switching between a narrowband and a wideband correspondent does not mean reaching for the volume knob.
3 · What this core does
Routing and sessions
- One UDP port for both protocols. Basic and Advanced are demultiplexed on the first byte, so a deployment opens a single port for voice.
- Talkgroups and affiliation. A session declares what it wants to hear; voice fans out only to the sessions affiliated to that destination.
- Floor control per talkgroup. One transmitter at a time, with the watchdog described above releasing the channel when a transmitter vanishes.
- External trunking. A remote reflector can be mapped onto a local talkgroup, so traffic from another network appears as an ordinary channel here.
Audio
- Seamless integration of narrowband and wideband. A talkgroup that mixes IMBE Full rate and Opus wideband stations simply works: everyone hears everyone, with nothing to select at either end. A talkgroup where every station is in the same mode is relayed untouched, so audio is never handled more than it has to be.
- Jitter buffering ahead of relay, so a client on a poor link does not make everyone else's audio stutter.
Operations
- Console at / — who is connected, on which talkgroups, who is transmitting now, and recent history.
- Status at /status — infrastructure health with the reason for it, and a Prometheus exposition for scrapers. Conditions escalate on duration rather than on peaks, and clear themselves once the cause is gone.
- Persistence in an embedded database — talkgroups and an audit trail survive restarts, with writes batched to protect flash storage.
- Administrative actions — disconnect a client, terminate a transmission, manage talkgroups. These are not exposed on the public interface unless an operator explicitly configures a token; by default they are reachable only from the node itself.
4 · Pi-Star / WPSD
Pi-Star and WPSD are the two dashboard distributions that most amateur hotspots run. Both
are, underneath, the same chain: MMDVMHost driving the radio board, and
P25Gateway speaking the reflector protocol upstream.
A Pi-Star or WPSD hotspot connects to this core right now, with no
changes to anything, because the core is a conformant P25 reflector. Point
P25Gateway at the host on port 41000 and it works: narrowband IMBE, one
talkgroup, exactly as with any other reflector.
What a hotspot cannot do today is reach the Advanced side — wideband audio, scanning
several talkgroups, private calls. That is not a limitation of the hotspot hardware. It is
simply that P25Gateway has no notion of this protocol.
There is also a hard physical constraint worth stating before any of the work below is planned. The RF link between a hotspot and a P25 handheld is 9600 bps C4FM carrying an 11-byte IMBE frame every 20 ms. Wideband audio cannot cross that link. A P25 radio in front of a hotspot will always hear narrowband, whatever the hotspot's uplink does. The value of teaching a hotspot to speak Advanced is therefore not audio quality for RF users — it is everything else: multi-talkgroup scanning, private calls, negotiated keepalive, and the seamless integration that lets an RF user hear a wideband station at all instead of missing them entirely.
Implementation to-do
None of the following is built. It is the work that would be required, in the order that makes each step useful on its own.
- Advanced client mode in P25Gateway Send
0xA0HELLO with the hotspot's callsign and radio ID, handle0xA2WELCOME, keep the session alive on the negotiated interval, and send0xA3BYE on shutdown. Offer only codec tag0x01— the hotspot has nothing that produces wideband audio — and accept audio that originated in the other mode, so wideband stations integrate seamlessly instead of being silent. This step alone gets a hotspot onto the Advanced link with correct identity. new UDP client state machine · no RF-side change - v1.1 voice framing both ways Emit
0xA5with the explicit destination and the source radio ID taken from the LDU1 link control, and accept it inbound. The core overwrites the source with the authoritative session value, so a mismatch is harmless — but sending the real ID means Last Heard and any logging upstream stay correct. framing only · depends on step 1 - Multi-talkgroup scanning Declare the hotspot's configured talkgroup list in the HELLO scan field and route inbound frames by their destination rather than assuming a single channel.
MMDVMHostalready carries the talkgroup per superframe, so the RF side needs nothing new — the gateway simply stops discarding traffic for talkgroups it did not ask for. Talkback needs a hold timer so a reply goes back to the talkgroup that was actually heard. gateway routing table · hold timer - Private calls P25 already has individual calls on the air: link control format
0x03with a destination radio ID instead of a talkgroup. Map that to the private flag in the v1.1 frame and back. Handle the busy control frame by generating the standard busy tone, so a user calling an engaged station hears the same thing they would on a trunked system rather than dead air. LC parsing · tone generation - Dashboard surface in Pi-Star / WPSD Both dashboards render P25 state from
MMDVMHost's log and status files. Advanced adds facts those files do not currently express: which codec each talker used, which talkgroup a frame was addressed to when several are being scanned, and whether a call was private. Extending the log lines is the small part; agreeing a format that the existing parsers do not choke on is the real work. log format · dashboard parsing · coordinate upstream - Configuration and fallback A reflector entry needs a type — Basic or Advanced — and the gateway must fall back to Basic automatically if the handshake is refused or unanswered. A hotspot that cannot reach the Advanced core should degrade to a working narrowband connection, not to nothing. config schema · fallback path · the step that makes it safe to ship
Steps 1 and 2 are worth doing on their own — they get hotspots onto the Advanced link and bring in the seamless integration, which is the single largest gain for RF users, since it turns wideband stations from inaudible into audible. Steps 3 and 4 are features. Step 6 is what makes any of it safe to put in front of people, and should not be deferred to the end in practice even though it is listed last.