OP25 (boatbod fork)

repository·master·Indexed 19 days ago

https://github.com/boatbod/op25

A software-defined radio (SDR) application for decoding P25, DMR, and analog radio traffic. It features real-time demodulation, trunking support, and metadata streaming. The suite includes rx.py for receiving, multi_rx.py for managing multiple SDR devices, dv_tx.py for transmitting P25, DMR, D-STAR, and YSF protocols, and p25craft.py for generating APCO P25 test packets.

Tokens
20.9K
Snippets
64
Records
104
Agent score
67%

What's inside op25

  1. Supported DMR Protocols

    master

    The DMR decoder implementation is experimental. Currently supported protocols include:

    • Tier II DMR: A non-trunked TDMA voice protocol. This is handled by configuring multi_rx.py with the static frequency of a known base station (BS) repeater.
    • TRBO Connect Plus: A Motorola proprietary trunking protocol using pre-configured frequencies assigned to Logical Channel Numbers (LCNs).

    Unsupported protocols:

    • Simplex DMR
    • TRBO Capacity Plus
    • Tier III Trunked DMR
  2. Decrypt P25 traffic in multi_rx.py

    master

    multi_rx.py supports decryption for the following algorithms if a known key is provided:

    • P25 ADP/RC4 (algid 0xAA)
    • DES-OFB (algid 0x81)
    • AES-OFB (algid 0x84)

    Configuration examples for these can be found in p25_rtl_example.json, p25_conventional_example.json, and the key format in example_keys.json.

  3. Select the correct Bandplan for SmartNet systems

    master

    The bandplan parameter in the trunking object determines how numeric channel identifiers are translated into actual frequencies.

    Supported Bandplans

    BandSubtypeStandard bandplan valueShuffled bandplan value
    VHF/UHFOBTN/A
    800 MHzRebanded800_rebandedNot supported
    Domestic800_domesticNot supported
    Domestic splinter800_domestic_splinterNot supported
    International800_international800_international_shuffled
    International splinter800_international_splinter800_international_splinter_shuffled
    900 MHz900N/A

    Other Band Trunking (OBT)

    For VHF and UHF systems, set bandplan to OBT. This requires configuring nine bp_ parameters to define the frequency mapping:

    Required bp_ parameters

    • Base frequency (MHz): bp_base, bp_mid, bp_high
    • Channel spacing (MHz): bp_base_spacing, bp_mid_spacing, bp_high_spacing
    • Channel number offset: bp_base_offset, bp_mid_offset, bp_high_offset

    Optional bp_tx_ parameters

    To translate subscriber transmit (uplink) numeric IDs to frequencies (useful for debugging outbound service words), set the corresponding bp_tx_ parameters (e.g., bp_tx_base, bp_tx_base_spacing, bp_tx_base_offset). If not set, they default to the values of the receive bp_ parameters.

  4. Customize Icecast metatag formats

    master

    You can customize the text sent to the Icecast server by modifying the meta_format_* parameters in your metadata configuration. OP25 supports two substitution tokens:

    • %TGID%: The numeric talkgroup ID.
    • %TAG%: The descriptive talkgroup string (sourced from the tgid-tags.tsv file).

    Available format keys:

    • meta_format_idle: The text sent when the system is idle/waiting for a call.
    • meta_format_tgid: The text sent during a call when only the TGID is known.
    • meta_format_tag: The text sent during a call when both the TGID and the descriptive tag are known.
  5. Choose between rx.py and multi_rx.py

    master

    OP25 provides two main execution modes.

    • rx.py: The legacy version. It supports single-frequency P25 Conventional, P25 Trunking (Phase 1, Phase 2, and TDMA Control Channel), and multi-system scanning (sequential switching).
    • multi_rx.py: The modern, recommended version. It supports concurrent multi-system/multi-channel operation, multiple SDR devices (including wideband devices like Airspy), Motorola SmartZone and Connect+ TRBO DMR Trunking, DMR BS Mode, and NBFM analog. It also uses JSON-based configuration and features an HTTP-based terminal.

    Recommendation: Use multi_rx.py for all new deployments as it is the focus of future development.

  6. Configure P25 decryption keys

    master

    OP25 supports real-time decryption of encrypted P25 voice traffic for specific protocols. You must provide the correct encryption key for decryption to occur; the software does not attempt to reverse encryption with unknown keys.

    Supported protocols:

    • ADP/RC4
    • DES-OFB
    • AES-256
  7. Configure OP25 and LiquidSoap to start at boot

    master

    Use systemd to manage OP25 and LiquidSoap as background services.

    1. Prepare Service Files

    Copy the provided service files to the system directory:

    sudo cp ~/op25/op25/gr-op25_repeater/apps/op25-liq.service /etc/systemd/system
    sudo cp ~/op25/op25/gr-op25_repeater/apps/op25-rx.service /etc/systemd/system

    2. Customize Configuration

    • Service Scripts: Edit op25.sh (which is called by op25-rx.service) to include your specific rx.py command line parameters.
    • Terminal Type: When auto-starting, use the HTTP terminal type (e.g., -l http:127.0.0.1:12345) instead of the default curses terminal, as curses will not function correctly in a background service.
    • Paths: Ensure paths in the service files match your environment (the defaults assume /home/pi).

    3. Enable and Start Services

    sudo systemctl enable op25-liq op25-rx
    sudo systemctl start op25-liq op25-rx

    4. Manage Services

    To stop the services:

    sudo systemctl stop op25-rx
    # Or stop both:
    sudo systemctl stop op25-rx op25-liq
    sudo cp ~/op25/op25/gr-op25_repeater/apps/op25-liq.service /etc/systemd/system
    sudo cp ~/op25/op25/gr-op25_repeater/apps/op25-rx.service /etc/systemd/system
    sudo systemctl enable op25-liq op25-rx
    sudo systemctl start op25-liq op25-rx
  8. Install OP25 and LiquidSoap on Raspberry Pi 3

    master

    This guide outlines how to set up a P25 trunked radio receiver and streamer on a Raspberry Pi 3 (or any Debian-based Linux system) using OP25 and LiquidSoap. This configuration is designed to avoid ALSA subsystem issues by using PulseAudio and LiquidSoap for audio routing.

    Prerequisites

    • Hardware: Raspberry Pi 3B (Pi Zero is not powerful enough).
    • OS: Raspbian Stretch or any Debian-based Linux.

    Installation Steps

    1. Install OP25

    sudo apt-get install git
    cd ~
    git clone https://github.com/boatbod/op25
    cd op25
    ./install.sh 

    2. Install LiquidSoap

    sudo apt-get install liquidsoap liquidsoap-plugin-all

    Use PulseAudio instead of ALSA for local audio by selecting the -O pulse option in OP25.

    sudo apt-get install pulseaudio pulseaudio-utils

    4. Install Icecast (Optional)

    To stream to an Icecast server:

    sudo apt-get install icecast2

    Follow the prompts to set passwords, then define your mount point in /etc/icecast2/icecast.xml:

    <listen-socket>
        <port>8000</port>
        <shoutcast-mount>/op25</shoutcast-mount>
    </listen-socket>
    sudo apt-get install git
    cd ~
    git clone https://github.com/boatbod/op25
    cd op25
    ./install.sh
  9. Configure DMR trunking with multi_rx.py

    master

    DMR decoding is integrated into multi_rx.py. Configuration is performed via a .json file.

    Configuration Steps

    1. Select a Template: Use dmr_rtl_example.json as a starting point for RTL-SDR hardware, or cfg.json as a general base.
    2. Define Channels: In the JSON file, a channel represents a logical entity encapsulating demodulation, framing, and decoding. For TRBO Connect Plus, you typically need two channel entries.
    3. Assign Devices: Associate each channel with a device.
      • If using one SDR with a wide enough sample width to cover the full spectrum, you can share a device between channels by setting tunable=false.
      • If using tunable=true, there must be a one-to-one relationship between the device and the channel.
    4. Configure Trunking:
      • Specify the trunking module name (currently only tk_trbo.py is supported).
      • Map all Logical Channel Numbers (LCNs) comprising the system. Each LCN entry must include the correct numeric ID, the frequency to tune, and an optional color code (CC). Set CC to 0 if unknown or unused.
  10. Configure OP25

    master

    All configuration for OP25 takes place within the apps directory located at ~/op25/op25/gr-op25_repeater/apps. For detailed configuration instructions, refer to the README-configuration file located in that same directory.

    cd ~/op25/op25/gr-op25_repeater/apps
  11. Use multi_tx.py for simultaneous multi-protocol transmission

    master

    The multi_tx.py script allows for the simultaneous transmission of four RF channels using different digital voice protocols: DMR, P25, DSTAR, and YSF. It aggregates these channels into a single wideband signal suitable for an SDR sink.

    Key Requirements

    • An input file is required (format: mono 8000 sps S16_LE).
    • The SDR output sample rate (-i) must be an integer multiple of the modulator rate (-s).
    • The total bandwidth required (calculated as (if_offset * 4) + 50000 Hz) must not exceed the SDR output sample rate.

    Input Modes

    1. File Input (Default): Reads from a specified file using the -f flag. The file is repeated if -r is enabled.
    2. Live Audio Input: Uses the -A flag to enable live input from an ALSA device specified by -I (e.g., hw:0,0).

    Example Usage

    python multi_tx.py -f input_audio.file -i 480000 -o 12500 -A
    python multi_tx.py -f <filename> -i <if_rate> -o <if_offset> [-A] [-I <audio_input>]