Docs · v0.5.3

The config file

Everything Trunk Recorder Pro does is set in one JSON file. The interface's Setup and Plugins pages edit it for you, so most people never open it. This section is for writing or reviewing it by hand: where it lives, the rules it follows, and every key. For the "how and why" of each part, see the guides; these pages list what each key does.

Page Covers
sources.md Radios and capture files (sources)
systems.md Trunked systems (systems), unit names, site lock
conventional.md Conventional systems and channels (conventional), the channel CSV
recording.md Where and how calls are saved (recording), per-system rules, file names
server-and-log.md The web server (server) and signing in (server.auth), the log (log), the dashboard's checks (monitor)
plugins.md Which plugins run and their settings (plugins)
storage.md The store (storage): what's kept between runs, how much it writes, reporting from it

Where the file is

Where you run it Default location
macOS ~/Library/Application Support/trunk-pro/config.json
Linux, Raspberry Pi $XDG_CONFIG_HOME/trunk-pro/config.json, else ~/.config/trunk-pro/config.json
Windows %APPDATA%\trunk-pro\config.json
Docker image /data/config/trunk-pro/config.json inside the container (the /data volume)
Browser version Not a file: the browser's localStorage, under the key trp.config

To use another file, start the app with --config:

trunk-pro --config /home/me/scanner/config.json

If the file doesn't exist yet, the app starts with the defaults and writes the file the first time you change a setting. The folder the config file is in is also where the app keeps what it learns and installs (see Files kept beside the config), so two recorders started with --config files in different folders never share band plans, talker aliases or plugins.

General rules

  • Keys are camelCase: controlChannelsHz, squelchDb, captureDir.
  • Frequencies are in Hz, everywhere. 857.9875 MHz is 857987500. Keys carry their unit in the name: …Hz, …Db, …S (seconds), …Kbps, …Mb, …PerS. The Airspy gains are the driver's steps (…Step), not dB.
  • A key ending in File holds a path (channelFile). Talkgroups and unit names aren't in the config at all: they're kept in the recorder's store, loaded and edited in Setup.
  • A missing key takes its default, listed in each table. The few marked ✓ in the Required column have no default: a source without its centerHz, for example, makes the file unreadable.
  • A missing sources key gives one RTL-SDR with default settings (first free dongle, Auto center, 2.4 MSPS, 25.4 dB), not none.
  • A value of the wrong type makes the whole file unreadable: a string where a number belongs, an unknown source type, a fraction in an integer field ("bufLen": 16384.5 on an RTL-SDR), a value that isn't one of a fixed list ("level": "loud", a system "type": "P25x"). The app then refuses to start, with <file>: not a config this version reads (<what was wrong>). It never replaces a file it can't read with the defaults.
  • Fixed lists are closed. Where a key takes one of a few names (a system's type, modulation, vocoder, m4a.encoder, a channel's mode…), the pages list them. They are read in any case ("P25" is "p25"), and "" is the default; any other value is refused as above, where older versions fell back to the default without a word. A source's type is read in any case too, but can't be left empty.
  • Keys this version doesn't know are kept and saved back as they were, at the top level and inside a trunked system, a site, a conventional system, recording, server, log, a key source and a delay rule. Notes of your own there survive the interface saving the file. Unknown keys anywhere else (inside a source, a channel, expect, unitNames, a system's own recording, m4a, ramSpool, an interface, a plugin's entry, monitor) are dropped the next time the file is saved.
  • Talkgroups aren't in the config. Each system's talkgroup file is kept in the store; Setup loads and downloads it as Trunk Recorder's CSV.
  • The interface saves the whole file on every change, so hand edits made while the app is running are overwritten by the next change in the interface. Stop the app, or make the change in the interface, rather than editing underneath it.
  • The file is written safely: to a temporary file beside it, then renamed over it, so a crash or power cut leaves the old file or the new one, never half of each.
  • Problems are checked when recording starts, not when the file is saved. See Validation.

Top level

Key Required Default Type Description
sources one RTL-SDR array Radios and capture files. sources.md
systems [] array Trunked systems, each with its sites. systems.md
conventional [] array Conventional systems, each a group of single-frequency channels. conventional.md
recording see page object Where calls go and which are kept. recording.md
server see page object The built-in interface's address and port; the other interfaces, each on a port of its own; signing in. server-and-log.md
log see page object How much is logged and where to. server-and-log.md
monitor see page object What the dashboard checks: hosts, the time server, the clock. server-and-log.md
storage { "backend": "sqlite", "retentionDays": 120, "commitSeconds": 300, "statsDays": 365 } object The call store: where it's kept, how long calls stay in it, and how far apart it commits. storage.md
plugins {} object Which plugins run and their recorder-wide settings, by plugin id. plugins.md
keys {} object P25 encryption key sources, by name: where each set of keys is read from. Encryption keys
pluginDelays [] array How long plugins wait for calls, for every system. Delays
diagnostics {} object Rules that capture what the radios receive when something goes wrong: captureDir, rules and budget. Capture rules
nextSystemId, nextSiteId number Kept by the app so a system or site id is never given twice. Leave them alone. A config restored from an older copy is fine: new systems are still numbered above every one the call store keeps data for.

A minimal config

One RTL-SDR placed automatically, one P25 system, recordings in a folder of your choice:

{
  "sources": [
    { "type": "rtlsdr", "serial": "", "centerHz": 0, "rateHz": 2400000, "ppm": 0 }
  ],
  "systems": [
    { "shortName": "dcfd", "type": "p25", "sites": [{ "controlChannelsHz": [857987500, 858987500] }] }
  ],
  "recording": { "captureDir": "/home/me/TrunkRecorderPro" }
}

centerHz: 0 means Auto: the app centers the dongle over the system's control channels. Everything not written takes its default.

A fuller example

Three RTL-SDRs, a P25 system, a UHF SmartNet system using the custom (OBT) band plan, and a small conventional system, with an upload plugin turned on. JSON has no comments, so the notes are below the example.

{
  "sources": [
    { "type": "rtlsdr", "serial": "00000101", "centerHz": 0, "rateHz": 2400000,
      "gainDb": 25.4, "ppm": 1, "autoTune": true },
    { "type": "rtlsdr", "serial": "00000102", "centerHz": 0, "rateHz": 2400000,
      "gainDb": 28, "ppm": 0, "guardHz": 100000 },
    { "type": "rtlsdr", "serial": "00000103", "centerHz": 154400000, "rateHz": 2400000,
      "gainDb": 30, "ppm": 0 }
  ],
  "systems": [
    {
      "shortName": "dcfd",
      "name": "DC Fire and EMS",
      "type": "p25",
      "sites": [{ "controlChannelsHz": [857987500, 858987500], "modulation": "auto", "expect": { "nac": 1091 } }],
      "recording": { "minCallS": 1 },
      "plugins": { "openmhz": { "apiKey": "...", "systemName": "dcfd" } }
    },
    {
      "shortName": "wmata",
      "type": "smartnet",
      "defaultMode": "analog",
      "sites": [{
        "controlChannelsHz": [489087500],
        "bandplan": "400_custom",
        "bandplanBaseHz": 489012500,
        "bandplanSpacingHz": 12500,
        "bandplanOffset": 380,
        "bandplanHighHz": 490000000
      }]
    }
  ],
  "conventional": [
    {
      "shortName": "county-fire",
      "squelchDb": 8,
      "channels": [
        { "freqHz": 154430000, "mode": "fm", "name": "Fire Dispatch", "talkgroup": 1001 },
        { "freqHz": 154325000, "mode": "fm", "name": "Station 1", "code": "151.4" }
      ]
    }
  ],
  "recording": {
    "captureDir": "/home/me/TrunkRecorderPro",
    "archiveM4a": true
  },
  "server": { "bind": "127.0.0.1", "port": 8080, "autoStart": true },
  "plugins": {
    "openmhz": { "enabled": true }
  }
}

Notes on the example (the frequencies and band plan numbers are placeholders; use your own system's):

  • Sources. The dongles are named by serial, so each keeps its own ppm. The first two are Auto (centerHz: 0): the first is placed over the first system, the second over whatever the first doesn't reach. The second leaves 100 kHz unused at each edge instead of the default 75 kHz. The third is set by hand to 154.4 MHz for the conventional channels (Auto would work too).
  • dcfd. modulation: "auto" detects which P25 receiver the channels need, then runs only that. expect locks it to NAC 0x443, written in decimal (1091). Its own recording drops calls under a second; every other rule follows the global recording. Its OpenMHz key is a per-system plugin setting.
  • wmata. A UHF SmartNet system needs 400_custom and the four band plan numbers; Find my system fills them in. defaultMode: "analog" records a talkgroup it has never seen granted as analog FM.
  • county-fire. Two analog channels. The first is filed under talkgroup 1001; the second records only transmissions with a 151.4 Hz CTCSS tone and is filed under 154325 (the frequency in kHz).
  • recording. Every call also gets an .m4a.
  • server. Recording starts when the app starts.
  • plugins. OpenMHz runs while recording; its settings for dcfd are in that system.

Validation

The file is read when the app starts; only its format is checked then (see the rules above). Whether it makes sense is checked when recording starts: if it doesn't, Start refuses with a message saying what to fix. The interface runs the same checks as you edit: until the first problem is fixed, Start is greyed out (hover over it to see why) and the dashboard pages show the problem in a banner with Open setup. Every message, and what to do about it, is in Troubleshooting.

"Usable bandwidth" is the source's sample rate less its guard band at each edge: see sources.md.

Changes while recording

You can change settings while recording. Most take effect the next time you press Start (Stop, then Start). A few apply at once:

Applies at once Applies at the next Start Applies when the app restarts
A trunked system's talkgroup file: an Ignore or Priority change takes effect immediately Sources, systems, conventional channels, squelch server.bind, server.port
Plugin settings (plugins, each system's plugins): the plugin changed restarts with them, alone, except a change only to its recorder-wide settings, which is sent to it when it takes settings that way. Turning one on or off and recording.m4a restart them all. The .m4a that Keep .m4a keeps uses the new m4a from the next Start Recording rules, filenameFormat, captureDir
log settings, monitor (the hosts checked, the time server, the Checks switch, the update check) recording.ramSpool (the interface says "from the next start")
server.allowedOrigins, server.interfaces (an interface moves to its new port at once), server.auth from the interface (trunk-pro access edits the file: at the restart) A linked channelFile is re-read at every Start

Files kept beside the config

The app keeps these in the folder the config file is in. With the default config that is the app's config folder above; with --config elsewhere/config.json, it's elsewhere/. Talkgroups, band plans, talker aliases, the Heard list, the radio registry and the dashboard's history are kept in the store.

File or folder What it holds
trunk-pro.sqlite The store (SQLite), and trunk-pro.backup, its daily copy of what can't be made again
plugins/<id>/ Installed plugins
plugin-data/<id>/ Each plugin's own data (calls waiting to upload, for example), and its working folder
plugin-registry.json The plugin store's cached index
interfaces/<id>/ Interfaces installed from the interface store
interface-registry.json The interface store's cached index
plugin-hold/ Finished calls waiting out a plugin delay, one .json each. Deleting one drops that call for its plugin
session-key What browsers' sign-ins are signed with (Sessions). Deleting it signs every browser out
access-state.json When each user was last signed out everywhere, and each passkey's count of sign-ins (Sessions). Deleting it lets sessions signed out everywhere count again until they expire
logs/ Log files, when log.file is on and log.dir is empty
spool/ macOS only: where the RAM spool's RAM disk is mounted, when recording.ramSpool is on

A linked conventional channelFile and a relative log.dir or server.interfaces path are also taken from this folder.

This page on GitHub · written for v0.5.3