This commit is contained in:
Evgenii Buchnev 2025-01-21 00:17:22 +00:00 committed by GitHub
commit d90088057d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 0 deletions

View File

@ -21,6 +21,7 @@
*
* Eric des Courtis <eric.des.courtis@benbria.com>
* Piotr Gregor <piotrgregor@rsyncme.org>
* Evgenii Buchnev <evgenii.buchnev@yabbr.io>
*
* mod_avmd.c -- Advanced Voicemail Detection Module
*
@ -1978,6 +1979,10 @@ static void avmd_report_detection(avmd_session_t *s, enum avmd_detection_mode mo
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "<<< AVMD - Beep Detected [%u][%u][%u][%u]: amplitude = [%f](max [%f]) variance = [%f], detection time [%" PRId64 "] [us] >>>\n",
mode, b->resolution, b->offset, d->idx, sma_amp_b->sma, b->amplitude_max, v_amp, detection_time);
}
switch_channel_set_variable_printf(channel, "avmd_report_amplitude", "%f", sma_amp_b->sma);
switch_channel_set_variable_printf(channel, "avmd_report_amplitude_max", "%f", b->amplitude_max);
switch_channel_set_variable_printf(channel, "avmd_report_amplitude_variance", "%f", v_amp);
break;
case AVMD_DETECT_FREQ:
@ -1988,6 +1993,9 @@ static void avmd_report_detection(avmd_session_t *s, enum avmd_detection_mode mo
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "<<< AVMD - Beep Detected [%u][%u][%u][%u]: f = [%f] variance = [%f], detection time [%" PRId64 "] [us] >>>\n",
mode, b->resolution, b->offset, d->idx, AVMD_TO_HZ(s->rate, f_sma), v_fir, detection_time);
}
switch_channel_set_variable_printf(channel, "avmd_report_frequency", "%f", AVMD_TO_HZ(s->rate, f_sma));
switch_channel_set_variable_printf(channel, "avmd_report_frequency_variance", "%f", v_fir);
break;
case AVMD_DETECT_BOTH:
@ -1999,11 +2007,23 @@ static void avmd_report_detection(avmd_session_t *s, enum avmd_detection_mode mo
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(s->session), SWITCH_LOG_INFO, "<<< AVMD - Beep Detected [%u][%u][%u][%u]: f = [%f] variance = [%f], amplitude = [%f](max [%f]) variance = [%f], detection time [%" PRId64 "] [us] >>>\n",
mode, b->resolution, b->offset, d->idx, AVMD_TO_HZ(s->rate, f_sma), v_fir, sma_amp_b->sma, b->amplitude_max, v_amp, detection_time);
}
switch_channel_set_variable_printf(channel, "avmd_report_amplitude", "%f", sma_amp_b->sma);
switch_channel_set_variable_printf(channel, "avmd_report_amplitude_max", "%f", b->amplitude_max);
switch_channel_set_variable_printf(channel, "avmd_report_amplitude_variance", "%f", v_amp);
switch_channel_set_variable_printf(channel, "avmd_report_frequency", "%f", AVMD_TO_HZ(s->rate, f_sma));
switch_channel_set_variable_printf(channel, "avmd_report_frequency_variance", "%f", v_fir);
break;
default:
break;
}
switch_channel_set_variable_printf(channel, "avmd_report_mode", "%u", mode);
switch_channel_set_variable_printf(channel, "avmd_report_resolution", "%u", b->resolution);
switch_channel_set_variable_printf(channel, "avmd_report_offset", "%u", b->offset);
switch_channel_set_variable_printf(channel, "avmd_report_idx", "%u", d->idx);
switch_channel_set_variable_printf(channel, "avmd_report_detection_time", "%" SWITCH_TIME_T_FMT, detection_time);
s->state.beep_state = BEEP_DETECTED;
}