Skip to content

KC3DVR/allstartordio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

AllStarLink to Rdio-Scanner Plugin

This plugin enables automatic uploading of received audio from AllStarLink nodes to a Rdio-Scanner instance, allowing you to build a complete radio scanner system with web-based playback.

Features

  • Automatic audio capture from AllStarLink nodes
  • Real-time upload to rdio-scanner via API
  • Configurable recording (duration, format, sample rate)
  • Multiple implementation options (Bash script, Python AGI, or Asterisk dialplan)
  • Metadata support (system, talkgroup, frequency, timestamps)
  • Debug logging for troubleshooting

Prerequisites

Software Requirements

  1. AllStarLink 3.x (or ASL 2.x with Asterisk)
  2. Rdio-Scanner (version 6.x or later) installed and running
  3. System tools:
    • curl (for HTTP uploads)
    • sox (for audio file manipulation)
    • Python 3.6+ with requests module (for Python version)

Installation Commands

# Install required packages (Debian/Ubuntu)
sudo apt-get update
sudo apt-get install curl sox python3 python3-pip

# Install Python dependencies (for Python version)
sudo pip3 install requests

Installation

Option 1: Bash Script (Recommended for Simplicity)

  1. Download and install the script:
sudo wget -O /usr/local/bin/asl-rdio-uploader.sh \
  https://your-server/asl-rdio-uploader.sh

sudo chmod +x /usr/local/bin/asl-rdio-uploader.sh
  1. Configure the script:

Edit /usr/local/bin/asl-rdio-uploader.sh and update the configuration section:

# Rdio-Scanner API Configuration
RDIO_URL="http://192.168.1.100:3000/api/call-upload"
RDIO_API_KEY="your-api-key-here"

# System Configuration
SYSTEM_ID="1"
SYSTEM_LABEL="AllStarLink"

# Node Configuration
NODE_NUMBER="1999"  # Your node number
TALKGROUP_ID="1"
TALKGROUP_LABEL="Repeater"
TALKGROUP_GROUP="Amateur Radio"
FREQUENCY=146520000  # 146.520 MHz in Hz
  1. Test the configuration:
/usr/local/bin/asl-rdio-uploader.sh test

Option 2: Python AGI Script (Recommended for Advanced Features)

  1. Install the Python script:
sudo wget -O /usr/local/bin/asl-rdio-agi.py \
  https://your-server/asl-rdio-agi.py

sudo chmod +x /usr/local/bin/asl-rdio-agi.py
  1. Configure the script:

Edit /usr/local/bin/asl-rdio-agi.py and update the CONFIG dictionary.

  1. Test:
/usr/local/bin/asl-rdio-agi.py test

Rdio-Scanner Setup

1. Create System in Rdio-Scanner

  1. Access rdio-scanner admin interface: http://your-rdio-scanner:3000/admin
  2. Default password: rdio-scanner
  3. Go to ConfigSystemsAdd System
  4. Configure:
    • ID: 1 (or your chosen ID)
    • Label: AllStarLink
    • Talkgroups: Add your node(s)

2. Generate API Key

  1. In rdio-scanner admin: ConfigAPI Keys
  2. Click New API Key
  3. Set Ident (e.g., "AllStarLink")
  4. Copy the generated key
  5. Update your plugin configuration with this key

AllStarLink Configuration

Method 1: Manual Recording Control via DTMF

Add to /etc/asterisk/rpt.conf in your [functions] section:

[1999]  ; Your node number
; ... existing config ...

[functions1999]
; Start recording - dial *991
991=cmd,/usr/local/bin/asl-rdio-uploader.sh start 1999

; Stop recording and upload - dial *992
992=cmd,/usr/local/bin/asl-rdio-uploader.sh stop 1999

; Test - dial *993
993=cmd,/usr/local/bin/asl-rdio-uploader.sh test

Method 2: Automatic Recording via Events

Add to /etc/asterisk/extensions.conf:

[rdio-scanner-monitor]
; Called when transmission starts
exten => start,1,NoOp(Starting rdio-scanner recording for node ${NODE})
 same => n,System(/usr/local/bin/asl-rdio-uploader.sh start ${NODE})
 same => n,Return()

; Called when transmission ends
exten => stop,1,NoOp(Stopping rdio-scanner recording for node ${NODE})
 same => n,System(/usr/local/bin/asl-rdio-uploader.sh stop ${NODE})
 same => n,Return()

Then modify your node's context to call these on transmit events.

Method 3: Using MixMonitor (Most Integrated)

Add to your /etc/asterisk/extensions.conf:

[rdio-auto-record]
; Automatically start MixMonitor when channel is up
exten => s,1,NoOp(Auto-recording for rdio-scanner)
 same => n,Set(RECFILE=/tmp/asl-rdio-recordings/node_${NODE}_${EPOCH}.wav)
 same => n,MixMonitor(${RECFILE},b)
 same => n,Set(GLOBAL(RDIO_RECFILE_${NODE})=${RECFILE})
 same => n,Goto(${CONTEXT},${EXTEN},1)

; On hangup
exten => h,1,NoOp(Upload recording on hangup)
 same => n,StopMixMonitor()
 same => n,Wait(1)
 same => n,System(/usr/local/bin/asl-rdio-uploader.sh upload ${GLOBAL(RDIO_RECFILE_${NODE})})

Usage

Manual Operation

Start recording:

/usr/local/bin/asl-rdio-uploader.sh start 1999

Stop and upload:

/usr/local/bin/asl-rdio-uploader.sh stop 1999

Upload specific file:

/usr/local/bin/asl-rdio-uploader.sh upload /path/to/audio.wav

Via DTMF (if configured)

  • Dial *991 to start recording
  • Dial *992 to stop and upload
  • Dial *993 to test

Automatic (if configured with events)

Recordings happen automatically when:

  • Someone keys up on your repeater/node
  • Transmission ends and audio is uploaded

Monitoring and Troubleshooting

Check Logs

Bash script log:

tail -f /tmp/asl-rdio-recordings/asl-rdio-uploader.log

Python script log:

tail -f /var/log/asl-rdio-uploader.log

Asterisk logs:

tail -f /var/log/asterisk/messages

Common Issues

Problem: "Cannot reach Rdio-Scanner server"

  • Check rdio-scanner is running: systemctl status rdio-scanner
  • Verify URL is correct
  • Check firewall rules

Problem: "Audio file is empty"

  • Check audio routing in AllStarLink
  • Verify MixMonitor is working: asterisk -rx "core show channels"
  • Check disk space: df -h

Problem: "Upload failed (HTTP 401)"

  • Invalid API key - regenerate in rdio-scanner admin
  • Update plugin configuration with new key

Problem: "Audio too short, skipping"

  • Adjust MIN_AUDIO_LENGTH in configuration
  • Check actual transmission duration

Debug Mode

Enable debug logging by editing the script:

Bash script:

DEBUG=1  # Change from 0 to 1

Python script:

'debug': True  # Change from False to True

Advanced Configuration

Multiple Nodes

To monitor multiple AllStarLink nodes:

  1. Create separate configurations for each node
  2. Use different NODE_NUMBER and TALKGROUP_ID values
  3. Set up rdio-scanner with corresponding talkgroups

Custom Audio Processing

You can add audio processing before upload:

# Example: Normalize audio before upload
upload_to_rdio() {
    local audio_file=$1
    local processed_file="${audio_file%.wav}_processed.wav"
    
    # Normalize audio with sox
    sox "$audio_file" "$processed_file" gain -n -3
    
    # Upload processed file
    curl -F "audio=@${processed_file}" ...
    
    rm -f "$processed_file"
}

Integration with Other Systems

The plugin can be extended to upload to multiple destinations:

  • Broadcastify Calls
  • OpenMHz
  • Custom logging systems
  • Archive storage

Performance Considerations

  • Disk Space: Audio files accumulate in /tmp/asl-rdio-recordings/

    • Successfully uploaded files are automatically deleted
    • Failed uploads remain for retry/debugging
    • Consider adding a cleanup cron job
  • Network Bandwidth: Each transmission upload uses bandwidth

    • 8kHz audio ≈ 64 kbps
    • 30-second transmission ≈ 240 KB
  • CPU Usage: Minimal impact

    • Audio recording: negligible
    • Upload: brief spike during HTTP POST

Security

  • API Key: Keep your rdio-scanner API key secure
  • File Permissions: Recording directory should be writable only by asterisk user
  • Network: Use HTTPS for rdio-scanner if exposed to internet
  • Firewall: Restrict rdio-scanner API access to trusted IPs
# Set proper permissions
sudo chown asterisk:asterisk /tmp/asl-rdio-recordings
sudo chmod 755 /tmp/asl-rdio-recordings

Uninstallation

# Remove scripts
sudo rm /usr/local/bin/asl-rdio-uploader.sh
sudo rm /usr/local/bin/asl-rdio-agi.py

# Remove audio directory
sudo rm -rf /tmp/asl-rdio-recordings

# Remove configuration from Asterisk
# Edit /etc/asterisk/extensions.conf and /etc/asterisk/rpt.conf
# Remove rdio-scanner related sections

# Reload Asterisk
sudo asterisk -rx "dialplan reload"
sudo asterisk -rx "module reload"

Support and Contributing

For issues, questions, or contributions:

  1. Check rdio-scanner documentation: https://github.com/chuot/rdio-scanner
  2. Check AllStarLink documentation: https://allstarlink.github.io
  3. Review logs for error messages
  4. Test configuration with built-in test command

License

This plugin is provided as-is for integration between AllStarLink and Rdio-Scanner. Both AllStarLink and Rdio-Scanner are open source projects with their own licenses.

Credits

About

a plug in to upload calls form allstar link to rdio scanner

Resources

Stars

Watchers

Forks

Contributors

Languages