New Tone Detection and Finder Software - Python Based

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
I removed it due to the fact BCFY Calls isn't meant to be using in the way I was using it for this software. It is frowned upon to just post only detected toneouts via BCFY Calls. They want a full audio stream seperated by transmissions.
Ah, yeah, that makes sense. Good to know.
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
While attempting to run this on a headless install of Ubuntu 22.04, I'm seeing the following errors:

Code:
Traceback (most recent call last):
  File "<dist/obf/main.py>", line 3, in <module>
  File "<frozen main>", line 16, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "<lib/detection_handler.py>", line 1, in <module>
  File "<frozen lib.detection_handler>", line 13, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "<lib/system_tray_handler.py>", line 1, in <module>
  File "<frozen lib.system_tray_handler>", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "pystray/__init__.py", line 64, in <module>
  File "pystray/__init__.py", line 56, in backend
  File "pystray/__init__.py", line 36, in xorg
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "pystray/_xorg.py", line 36, in <module>
  File "Xlib/display.py", line 80, in __init__
  File "Xlib/display.py", line 62, in __init__
  File "Xlib/protocol/display.py", line 53, in __init__
  File "Xlib/support/connect.py", line 62, in get_display
  File "Xlib/support/unix_connect.py", line 47, in get_display
Xlib.error.DisplayNameError: Bad display name ""
[746] Failed to execute script 'main' due to unhandled exception!

I know this is due to the lack of a desktop environment as I had almost the exact same issue with the latest version of TTD. Any suggestions?
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
While attempting to run this on a headless install of Ubuntu 22.04, I'm seeing the following errors:

Code:
Traceback (most recent call last):
  File "<dist/obf/main.py>", line 3, in <module>
  File "<frozen main>", line 16, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "<lib/detection_handler.py>", line 1, in <module>
  File "<frozen lib.detection_handler>", line 13, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "<lib/system_tray_handler.py>", line 1, in <module>
  File "<frozen lib.system_tray_handler>", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "pystray/__init__.py", line 64, in <module>
  File "pystray/__init__.py", line 56, in backend
  File "pystray/__init__.py", line 36, in xorg
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller/loader/pyimod02_importers.py", line 493, in exec_module
  File "pystray/_xorg.py", line 36, in <module>
  File "Xlib/display.py", line 80, in __init__
  File "Xlib/display.py", line 62, in __init__
  File "Xlib/protocol/display.py", line 53, in __init__
  File "Xlib/support/connect.py", line 62, in get_display
  File "Xlib/support/unix_connect.py", line 47, in get_display
Xlib.error.DisplayNameError: Bad display name ""
[746] Failed to execute script 'main' due to unhandled exception!

I know this is due to the lack of a desktop environment as I had almost the exact same issue with the latest version of TTD. Any suggestions?

if you open etc/config.json and under general change headless from 0 to 1 error should go away.
this error it due to the software trying to start up a tray icon. It doesn’t start the try icon if headless = 1

😊 that should fix it
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
if you open etc/config.json and under general change headless from 0 to 1 error should go away.
this error it due to the software trying to start up a tray icon. It doesn’t start the try icon if headless = 1

😊 that should fix it
Unfortunately, I don’t have an etc folder in that directory, only the binary, the bash script for starting, and a bin folder.
 

xicarusx

Member
Feed Provider
Joined
Oct 2, 2008
Messages
104
Location
Sayre, PA
Create the folder etc in icad root folder and create the config.json using the following contents


JSON:
{
    "general": {
        "log_debug": 1,
        "headless": 1,
        "base_url": "https://example.com",
        "url_audio_path": "https://example.com/audio/"
    },
    "web_gui": {"ip": "0.0.0.0",
                "port": 9911
                },
    "audio": {
        "trunk_recorder": {
            "enabled": 0,
            "pulse_sink": "dispatch"
        },
        "input_device_index": 99,
        "output_device_index": 99
    },
    "detection": {
        "mode": 0,
        "silence_threshold": 54,
        "rounded_detection": 0,
        "rounded_detection_range": 20,
        "find_long_tones": 0,
        "long_tone_range": 20

    },
    "recording": {
        "enabled": 1,
        "path": "audio/",
        "max_length": 120.0,
        "min_length": 15.0,
        "start_delay": 2.5,
        "silence_release": 5.0
    },
    "alerting": {
        "exclude_times": {}
    },
    "email": {
        "pre_record_enabled": 0,
        "post_record_enabled": 0,
        "send_as_single_email": 0,
        "smtp_hostname": "mail.example.com",
        "smtp_port": 465,
        "smtp_username": "dispatch@example.com",
        "smtp_password": "CE3QsT2biDfruQM",
        "email_address_from": "dispatch@example.com",
        "email_text_from": "iCAD Example County",
        "pre_record_subject": "Dispatch Alert - %detector_name%",
        "pre_record_body": "%detector_name% Alert at %timestamp%<br><br>",
        "post_record_subject": "Dispatch Alert - %detector_name%",
        "post_record_body": "%detector_name% Alert at %timestamp%<br><br> %mp3_url%"
    },
    "mqtt": {
        "enabled": 0,
        "mqtt_hostname": "192.168.1.88",
        "mqtt_port": 1883,
        "mqtt_username": "testing",
        "mqtt_password": "Testing3"
    },
    "mp3_settings": {
        "bitrate": 32,
        "fix_clipping": {
            "enabled": 0
        },
        "noise_filter": {
            "enabled": 0,
            "model": 0
        },
        "remove_silence": {
            "enabled": 0,
            "min_silence_length": 3.0,
            "silence_threshold": -35
        },
        "remove_tones": {
            "enabled": 0,
            "min_silence_length": 950,
            "silence_threshold": -37
        },
        "high_pass_filter": {
            "enabled": 0,
            "cutoff_freq": 200
        },
        "low_pass_filter": {
            "enabled": 0,
            "cutoff_freq": 3000
        },
        "gain_filter": {
            "enabled": 0,
            "gain_db": 3
        },
        "convert_to_stereo": {
            "enabled": 0
        },
        "append_text_to_speech": {
            "enabled": 0,
            "speech_rate": 125
        },
        "append_audio_file": {
            "enabled": 0
        }
    },
    "sftp_settings": {
        "enabled": 0,
        "sftp_hostname": "",
        "sftp_port": 22,
        "sftp_username": "",
        "sftp_password": "",
        "remote_path": "/var/www/bcfirewire.com/audio/",
        "private_key": "/home/user/.ssh/id_rsa"
    },
    "mysql_settings": {
        "enabled": 0,
        "mysql_hostname": "192.168.1.107",
        "mysql_port": 3306,
        "mysql_username": "icad",
        "mysql_password": "password",
        "mysql_database": "icad_web",
        "mysql_table_prefix": ""
    },
    "redis_settings": {
        "enabled": 0,
        "redis_hostname": "192.168.1.107",
        "redis_port": 6379,
        "redis_password": "",
        "redis_key": "icad_incidents"
    },
    "rabbitmq_settings": {
        "hostname": "localhost",
        "port": 5672,
        "username": "tone_detect",
        "password": "rabbit_mq_password",
        "vhost": "/",
        "tone_detection_queue": "tone_detect"
    },
    "pushover_settings": {
        "enabled": 0,
        "all_detector_group": 0,
        "all_detector_group_token": "secretgrouptokengoeshere",
        "all_detector_app_token": "secretapptokengoeshere",
        "message_html_string": "<font color=\"red\"><b>%detector_name%</b></font><br><br><a href=\"%mp3_url%\">Click for Dispatch Audio</a>",
        "subject": "Alert!",
        "sound": "pushover",
    },
    "zello_settings": {
        "enabled": 0,
        "call_wait_time": 70,
        "username": "",
        "password": "",
        "channel": "",
        "issuer": "",
        "private_key": ""
    },
    "telegram_settings": {
        "enabled": 0,
        "call_wait_time": 70.0,
        "telegram_bot_token": "12345-12345-12345-12345",
        "telegram_channel_ids": [-9999, 8899]
    },
    "facebook_settings": {
        "enabled": 0,
        "call_wait_time": 70.0,
        "facebook_app_token_page": "",
        "facebook_page_id": 0
    },
    "cleanup_settings": {
        "local_enabled": 0,
        "local_cleanup_days": 7,
        "remote_enabled": 0,
        "remote_cleanup_days": 7
    }
}
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
Create the folder etc in icad root folder and create the config.json using the following contents


JSON:
{
    "general": {
        "log_debug": 1,
        "headless": 1,
        "base_url": "https://example.com",
        "url_audio_path": "https://example.com/audio/"
    },
    "web_gui": {"ip": "0.0.0.0",
                "port": 9911
                },
    "audio": {
        "trunk_recorder": {
            "enabled": 0,
            "pulse_sink": "dispatch"
        },
        "input_device_index": 99,
        "output_device_index": 99
    },
    "detection": {
        "mode": 0,
        "silence_threshold": 54,
        "rounded_detection": 0,
        "rounded_detection_range": 20,
        "find_long_tones": 0,
        "long_tone_range": 20

    },
    "recording": {
        "enabled": 1,
        "path": "audio/",
        "max_length": 120.0,
        "min_length": 15.0,
        "start_delay": 2.5,
        "silence_release": 5.0
    },
    "alerting": {
        "exclude_times": {}
    },
    "email": {
        "pre_record_enabled": 0,
        "post_record_enabled": 0,
        "send_as_single_email": 0,
        "smtp_hostname": "mail.example.com",
        "smtp_port": 465,
        "smtp_username": "dispatch@example.com",
        "smtp_password": "CE3QsT2biDfruQM",
        "email_address_from": "dispatch@example.com",
        "email_text_from": "iCAD Example County",
        "pre_record_subject": "Dispatch Alert - %detector_name%",
        "pre_record_body": "%detector_name% Alert at %timestamp%<br><br>",
        "post_record_subject": "Dispatch Alert - %detector_name%",
        "post_record_body": "%detector_name% Alert at %timestamp%<br><br> %mp3_url%"
    },
    "mqtt": {
        "enabled": 0,
        "mqtt_hostname": "192.168.1.88",
        "mqtt_port": 1883,
        "mqtt_username": "testing",
        "mqtt_password": "Testing3"
    },
    "mp3_settings": {
        "bitrate": 32,
        "fix_clipping": {
            "enabled": 0
        },
        "noise_filter": {
            "enabled": 0,
            "model": 0
        },
        "remove_silence": {
            "enabled": 0,
            "min_silence_length": 3.0,
            "silence_threshold": -35
        },
        "remove_tones": {
            "enabled": 0,
            "min_silence_length": 950,
            "silence_threshold": -37
        },
        "high_pass_filter": {
            "enabled": 0,
            "cutoff_freq": 200
        },
        "low_pass_filter": {
            "enabled": 0,
            "cutoff_freq": 3000
        },
        "gain_filter": {
            "enabled": 0,
            "gain_db": 3
        },
        "convert_to_stereo": {
            "enabled": 0
        },
        "append_text_to_speech": {
            "enabled": 0,
            "speech_rate": 125
        },
        "append_audio_file": {
            "enabled": 0
        }
    },
    "sftp_settings": {
        "enabled": 0,
        "sftp_hostname": "",
        "sftp_port": 22,
        "sftp_username": "",
        "sftp_password": "",
        "remote_path": "/var/www/bcfirewire.com/audio/",
        "private_key": "/home/user/.ssh/id_rsa"
    },
    "mysql_settings": {
        "enabled": 0,
        "mysql_hostname": "192.168.1.107",
        "mysql_port": 3306,
        "mysql_username": "icad",
        "mysql_password": "password",
        "mysql_database": "icad_web",
        "mysql_table_prefix": ""
    },
    "redis_settings": {
        "enabled": 0,
        "redis_hostname": "192.168.1.107",
        "redis_port": 6379,
        "redis_password": "",
        "redis_key": "icad_incidents"
    },
    "rabbitmq_settings": {
        "hostname": "localhost",
        "port": 5672,
        "username": "tone_detect",
        "password": "rabbit_mq_password",
        "vhost": "/",
        "tone_detection_queue": "tone_detect"
    },
    "pushover_settings": {
        "enabled": 0,
        "all_detector_group": 0,
        "all_detector_group_token": "secretgrouptokengoeshere",
        "all_detector_app_token": "secretapptokengoeshere",
        "message_html_string": "<font color=\"red\"><b>%detector_name%</b></font><br><br><a href=\"%mp3_url%\">Click for Dispatch Audio</a>",
        "subject": "Alert!",
        "sound": "pushover",
    },
    "zello_settings": {
        "enabled": 0,
        "call_wait_time": 70,
        "username": "",
        "password": "",
        "channel": "",
        "issuer": "",
        "private_key": ""
    },
    "telegram_settings": {
        "enabled": 0,
        "call_wait_time": 70.0,
        "telegram_bot_token": "12345-12345-12345-12345",
        "telegram_channel_ids": [-9999, 8899]
    },
    "facebook_settings": {
        "enabled": 0,
        "call_wait_time": 70.0,
        "facebook_app_token_page": "",
        "facebook_page_id": 0
    },
    "cleanup_settings": {
        "local_enabled": 0,
        "local_cleanup_days": 7,
        "remote_enabled": 0,
        "remote_cleanup_days": 7
    }
}
Unfortunately we're still no go. I've verified all permissions are set correctly on that etc folder as well as the new config.json file.
 

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA

jschmall

Member
Premium Subscriber
Joined
Jul 15, 2017
Messages
79
Location
Anderson, CA
Not sure if I missed it but is there a method to attach the recorded MP3s to the email sent out for post recordings?
 

natecarlson

Member
Joined
Feb 5, 2016
Messages
5
Location
Savage, MN
So unfortunately I'm still unable to get past the need for a desktop environment and the creation of the tray icon. No changes made to the config.json file seem to have any effect. I'm wondering if that file isn't being read before the tray icon is being created. Is there logs I can send to you to take a look at?
If you're on Ubuntu 22.04 at least, install libayatana-appindicator3-1 to get past that.

Also need to fix the JSON error in the config file (change "sound": "pushover", to "sound": "pushover" - no comma at the end). (Well, not positive, the app may accept a busted json file.. but it irked me.)
 

natecarlson

Member
Joined
Feb 5, 2016
Messages
5
Location
Savage, MN
I'm assuming this is not open source - correct?

Have you considered adding a http endpoint, where we can submit a file and get a response on if matching tones are detected or not? That would be awesome for custom integrations.
 

okavitch09

Member
Premium Subscriber
Joined
Dec 15, 2012
Messages
7
Location
Burgettstown pa
Alpha Release 16

Changes:
Added Zello Channel Stream
Added Telegram Channel Posting
Added Broadcastify Calls Posting



Resources:
iCAD Dispatch Discord Server
https://github.com/TheGreatCodeholio/iCAD_Dispatch

Latest Binaries:
Linux Download - https://bcfirewire.com/downloads/icad_td_alpha_16.tar.gz
Windows Download - https://bcfirewire.com/downloads/icad_td_alpha_16.zip
Raspberry PI - https://bcfirewire.com/downloads/icad_td_alpha_16_rpi.tar.gz
I downloaded this software to try it out. And can't get it to load at all. Any suggestions? When I try to load the software. It looks like it's going to load then disappears
 
Top