Compare commits
10 Commits
offline
...
48743574ad
| Author | SHA1 | Date | |
|---|---|---|---|
| 48743574ad | |||
| 19c9881784 | |||
| 5e2390d9a5 | |||
| cc5cec6cd2 | |||
| 7d21de2dd0 | |||
| ef9ac651f9 | |||
| ed3b91d8c1 | |||
| c186badb43 | |||
| 59d38975e3 | |||
| ace93a7c51 |
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Oneliner to find script's directory. Please note - last path component should NOT be symlink.
|
|
||||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
|
||||||
|
|
||||||
/usr/bin/python3 ${SCRIPT_DIR}/src/utils_network_impairment.py --start
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Oneliner to find script's directory. Please note - last path component should NOT be symlink.
|
|
||||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
|
||||||
|
|
||||||
/usr/bin/python3 ${SCRIPT_DIR}/src/utils_network_impairment.py --stop
|
|
||||||
Binary file not shown.
@@ -25,8 +25,8 @@ rabbitmq:
|
|||||||
cache_dir: cache
|
cache_dir: cache
|
||||||
audio:
|
audio:
|
||||||
# Silence prefix & suffix lengths (in seconds)
|
# Silence prefix & suffix lengths (in seconds)
|
||||||
silence_prefix: 30
|
silence_prefix: 10
|
||||||
silence_suffix: 30
|
silence_suffix: 10
|
||||||
|
|
||||||
bluetooth_mac: "MAC_ADDRESS"
|
bluetooth_mac: "MAC_ADDRESS"
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
# Oneliner to find script's directory. Please note - last path component should NOT be symlink.
|
# Oneliner to find script's directory. Please note - last path component should NOT be symlink.
|
||||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )";
|
||||||
|
|
||||||
|
for pid in $(pidof -x run_agent.sh); do
|
||||||
|
if [ $pid != $$ ]; then
|
||||||
|
echo "[$(date)] : run_agent.sh : Process is already running with PID $pid. Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ def upload_results():
|
|||||||
# Path to audio
|
# Path to audio
|
||||||
path_audio = t[1]
|
path_audio = t[1]
|
||||||
|
|
||||||
utils.log(f'Found {path_report.name} and {path_audio.name} files.')
|
utils.log(f'Found {t} report pair.')
|
||||||
|
if path_report is not None and path_report.exists():
|
||||||
try:
|
try:
|
||||||
with open(path_report, 'rt') as f:
|
with open(path_report, 'rt') as f:
|
||||||
report = json.loads(f.read())
|
report = json.loads(f.read())
|
||||||
@@ -104,26 +105,16 @@ def upload_results():
|
|||||||
if success:
|
if success:
|
||||||
utils.log(f'Report {upload_id} is uploaded ok.')
|
utils.log(f'Report {upload_id} is uploaded ok.')
|
||||||
|
|
||||||
# Rename files to make sync audio filename with reported ones
|
|
||||||
# path_report_fixed = CACHE.dir / f'{upload_id}.json'
|
|
||||||
# path_report = path_report.rename(path_report_fixed)
|
|
||||||
|
|
||||||
# path_audio_fixed = CACHE.dir / f'{upload_id}.wav'
|
|
||||||
# path_audio = path_audio.rename(path_audio_fixed)
|
|
||||||
if path_audio.exists():
|
|
||||||
utils.log(f'Uploading {path_audio.name} file...')
|
|
||||||
# Upload recorded audio
|
|
||||||
upload_result = BACKEND.upload_audio(upload_id, path_audio)
|
|
||||||
if upload_result:
|
|
||||||
utils.log(f' Recorded audio {upload_id}.wav is uploaded ok.')
|
|
||||||
os.remove(path_audio)
|
|
||||||
else:
|
|
||||||
utils.log(f'No recorded audio file found, skipping audio upload.')
|
|
||||||
os.remove(path_report)
|
os.remove(path_report)
|
||||||
|
|
||||||
else:
|
if path_audio is not None and path_audio.exists():
|
||||||
utils.log(f'Failed to upload report {path_report.name}')
|
utils.log(f'Uploading {path_audio.name} file...')
|
||||||
break
|
# Upload recorded audio
|
||||||
|
upload_result = BACKEND.upload_audio(path_audio.stem, path_audio)
|
||||||
|
if upload_result:
|
||||||
|
utils.log(f' Recorded audio {path_audio.stem}.wav is uploaded ok.')
|
||||||
|
os.remove(path_audio)
|
||||||
|
|
||||||
|
|
||||||
def run_analyze(file_test: str, file_reference: str, number: str) -> bool:
|
def run_analyze(file_test: str, file_reference: str, number: str) -> bool:
|
||||||
global CALL_COUNTER
|
global CALL_COUNTER
|
||||||
@@ -147,8 +138,8 @@ def run_analyze(file_test: str, file_reference: str, number: str) -> bool:
|
|||||||
utils.log(f'Recorded audio call duration: {test_audio_length}s, reference audio length: {ref_audio_length}s')
|
utils.log(f'Recorded audio call duration: {test_audio_length}s, reference audio length: {ref_audio_length}s')
|
||||||
|
|
||||||
# Check if audio length is strange - skip such calls. Usually this is missed call.
|
# Check if audio length is strange - skip such calls. Usually this is missed call.
|
||||||
is_caller_audio_big = is_caller and test_audio_length > ref_audio_length * 1.5
|
is_caller_audio_big = is_caller and test_audio_length > ref_audio_length * 3
|
||||||
is_answerer_audio_big = is_answerer and test_audio_length > ref_audio_length * 1.5
|
is_answerer_audio_big = is_answerer and test_audio_length > ref_audio_length * 3
|
||||||
|
|
||||||
if is_caller_audio_big or is_answerer_audio_big:
|
if is_caller_audio_big or is_answerer_audio_big:
|
||||||
utils.log_error(f'Recorded call is too big - looks like mobile operator prompt, skipping analysis')
|
utils.log_error(f'Recorded call is too big - looks like mobile operator prompt, skipping analysis')
|
||||||
|
|||||||
@@ -80,11 +80,16 @@ class InfoCache:
|
|||||||
lst = os.listdir(self.dir)
|
lst = os.listdir(self.dir)
|
||||||
for n in lst:
|
for n in lst:
|
||||||
p = self.dir / n
|
p = self.dir / n
|
||||||
if self.is_valid_uuid(p.stem) and n.endswith('.json'):
|
if self.is_valid_uuid(p.stem) and (n.endswith('.json') or n.endswith(".wav")):
|
||||||
# Probe found
|
# Probe found
|
||||||
|
p_json = p.with_suffix('.json')
|
||||||
p_audio = p.with_suffix('.wav')
|
p_audio = p.with_suffix('.wav')
|
||||||
if p_audio.exists():
|
if p_json.exists() and p_audio.exists():
|
||||||
r.append((p, p.with_suffix('.wav')))
|
r.append((p_json, p_audio))
|
||||||
|
elif p_json.exists():
|
||||||
|
r.append((p_json, None))
|
||||||
|
elif p_audio.exists():
|
||||||
|
r.append((None, p_audio))
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ TRACE_TOTAL_TIMEOUT = 30
|
|||||||
# a webpage is mostly I/O bound, it's not going to be significant.
|
# a webpage is mostly I/O bound, it's not going to be significant.
|
||||||
|
|
||||||
def trace_function(frame, event, arg):
|
def trace_function(frame, event, arg):
|
||||||
|
global TRACE_START_TIME
|
||||||
if time.time() - TRACE_START_TIME > TRACE_TOTAL_TIMEOUT:
|
if time.time() - TRACE_START_TIME > TRACE_TOTAL_TIMEOUT:
|
||||||
raise Exception('Timed out!') # Use whatever exception you consider appropriate.
|
raise Exception('Timed out!') # Use whatever exception you consider appropriate.
|
||||||
|
|
||||||
@@ -114,6 +115,7 @@ class QualtestBackend:
|
|||||||
|
|
||||||
|
|
||||||
def upload_audio(self, probe_id, path_recorded: Path):
|
def upload_audio(self, probe_id, path_recorded: Path):
|
||||||
|
global TRACE_START_TIME
|
||||||
result = False
|
result = False
|
||||||
|
|
||||||
# Log about upload attempt
|
# Log about upload attempt
|
||||||
|
|||||||
Reference in New Issue
Block a user