Skip to content

Audio Consumer

Ian Carey edited this page May 22, 2024 · 1 revision

iCAD Audio Consumer

The scripts that consume audio from a scanner application.

Current Audio Consumers

Requirements

  • Python >= 3.10

Python Libraries

  • requests~=2.31.0
  • colorama~=0.4.6
  • DateTime~=5.2
  • argparse~=1.4.0
  • requests-toolbelt~=1.0.0
  • urllib3~=2.1.0
  • google-cloud-storage~=2.15.0
  • boto3~=1.34.62
  • paramiko~=3.4.0
  • icad-tone-detection~=1.3

Installation

Trunk Recorder Upload Script

A script to jump start the audio consumer when Trunk Recorder completes a call.

Clone the Repository

Clone the GitHub repository to a folder of your choosing.

git clone https://github.com/TheGreatCodeholio/icad_tr_uploader.git

Install requirements with pip

pip3 install -r requirements.txt

Add to Trunk Recorder Configuration

Add to Trunk Recorder system configuration. Add the uploadScript value to the system configuration in trunk recorder.

"uploadScript": "/path/to/icad_tr_uploader/upload.sh example-system",

Modify Upload.sh

Modify and rename upload_example.sh to upload.sh. Modify upload_example.sh to match your environment paths.

cd /path/to/icad_tr_uploader
python3 tr_uploader.py ${1} ${2}
status=$?

if [ $status -ne 0 ]; then
    echo "Error with python script, exit status: $status"
    exit 0
else
    exit 0
fi

After starting trunk recorder it should be trying to run the script when a call completes.

Trunk Recorder MQTT Consumer

A MQTT Consumer Script that can run as a service on a PC separate from Trunk Recorder. This method currently requires Trunk Recorder 5.0RC

Configure Trunk Recorder to Use MQTT Plugin

Build Trunk Recorder with MQTT Plugin

Follow the build and configuration instructions for Taclane's TR MQTT plugin from the test/autobuild branch.

Use Prebuilt Docker with Trunk Recorder with MQTT Plugin

Use my prebuilt docker container for Trunk Recorder that includes the MQTT plugin.

  • Clone the GitHub repository to a folder of your choosing.

git clone https://github.com/TheGreatCodeholio/icad_tr_mqtt_docker

  • Create a Trunk Recorder configuration in tr_config/tr_config.json
  • Add plugin configuration to Trunk Recorder plugins.
   {
  "name": "MQTT Status",
  "library": "/usr/local/lib/trunk-recorder/libmqtt_status_plugin.so",
  "broker": "tcp://192.168.1.44:1883",
  "topic": "trunk_recorder/feeds",
  "unit_topic": "trunk_recorder/units",
  "username": "trunk_recorder",
  "password": "superstrongpasword",
  "mqtt_audio": true,
  "mqtt_audio_type": "wav",
  "console_logs": false
}
  • Run docker compose docker compose up -d

After Trunk Recorder is running. it should be sending audio files and metadata via MQTT

Clone this wiki locally