FS-5659 --resolve Add logging for spandsp dtmf detector when dtmf_verbose channel variable is set to true
This commit is contained in:
parent
b71fe0031d
commit
8d2805fc42
|
@ -141,7 +141,7 @@ switch_status_t spandsp_fax_detect_session(switch_core_session_t *session,
|
||||||
int hits, const char *app, const char *data, switch_tone_detect_callback_t callback);
|
int hits, const char *app, const char *data, switch_tone_detect_callback_t callback);
|
||||||
|
|
||||||
switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session);
|
switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session);
|
||||||
void spanfax_log_message(void *user_data, int level, const char *msg);
|
void mod_spandsp_log_message(void *session, int level, const char *msg);
|
||||||
switch_status_t load_configuration(switch_bool_t reload);
|
switch_status_t load_configuration(switch_bool_t reload);
|
||||||
void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t self, switch_bool_t on);
|
void mod_spandsp_indicate_data(switch_core_session_t *session, switch_bool_t self, switch_bool_t on);
|
||||||
|
|
||||||
|
|
|
@ -349,6 +349,7 @@ switch_status_t spandsp_tdd_decode_session(switch_core_session_t *session)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
switch_core_session_t *session;
|
switch_core_session_t *session;
|
||||||
dtmf_rx_state_t *dtmf_detect;
|
dtmf_rx_state_t *dtmf_detect;
|
||||||
|
int verbose;
|
||||||
char last_digit;
|
char last_digit;
|
||||||
uint32_t samples;
|
uint32_t samples;
|
||||||
uint32_t last_digit_end;
|
uint32_t last_digit_end;
|
||||||
|
@ -394,6 +395,10 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SWITCH_ABC_TYPE_INIT: {
|
case SWITCH_ABC_TYPE_INIT: {
|
||||||
pvt->dtmf_detect = dtmf_rx_init(NULL, NULL, NULL);
|
pvt->dtmf_detect = dtmf_rx_init(NULL, NULL, NULL);
|
||||||
|
span_log_set_message_handler(dtmf_rx_get_logging_state(pvt->dtmf_detect), mod_spandsp_log_message, pvt->session);
|
||||||
|
if (pvt->verbose) {
|
||||||
|
span_log_set_level(dtmf_rx_get_logging_state(pvt->dtmf_detect), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
|
}
|
||||||
dtmf_rx_parms(pvt->dtmf_detect, pvt->filter_dialtone, pvt->twist, pvt->reverse_twist, pvt->threshold);
|
dtmf_rx_parms(pvt->dtmf_detect, pvt->filter_dialtone, pvt->twist, pvt->reverse_twist, pvt->threshold);
|
||||||
dtmf_rx_set_realtime_callback(pvt->dtmf_detect, spandsp_dtmf_rx_realtime_callback, pvt);
|
dtmf_rx_set_realtime_callback(pvt->dtmf_detect, spandsp_dtmf_rx_realtime_callback, pvt);
|
||||||
break;
|
break;
|
||||||
|
@ -500,6 +505,10 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session)
|
||||||
pvt->filter_dialtone = 0;
|
pvt->filter_dialtone = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((value = switch_channel_get_variable(channel, "dtmf_verbose"))) {
|
||||||
|
pvt->verbose = switch_true(value);
|
||||||
|
}
|
||||||
|
|
||||||
if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
|
if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,14 +259,10 @@ static void counter_increment(void)
|
||||||
switch_mutex_unlock(spandsp_globals.mutex);
|
switch_mutex_unlock(spandsp_globals.mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spanfax_log_message(void *user_data, int level, const char *msg)
|
void mod_spandsp_log_message(void *user_data, int level, const char *msg)
|
||||||
{
|
{
|
||||||
int fs_log_level;
|
int fs_log_level;
|
||||||
switch_core_session_t *session;
|
switch_core_session_t *session = (switch_core_session_t *)user_data;
|
||||||
pvt_t *pvt;
|
|
||||||
|
|
||||||
pvt = (pvt_t *) user_data;
|
|
||||||
session = pvt->session;
|
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case SPAN_LOG_NONE:
|
case SPAN_LOG_NONE:
|
||||||
|
@ -733,8 +729,8 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
|
||||||
|
|
||||||
fax_set_transmit_on_idle(fax, TRUE);
|
fax_set_transmit_on_idle(fax, TRUE);
|
||||||
|
|
||||||
span_log_set_message_handler(fax_get_logging_state(fax), spanfax_log_message, pvt);
|
span_log_set_message_handler(fax_get_logging_state(fax), mod_spandsp_log_message, pvt->session);
|
||||||
span_log_set_message_handler(t30_get_logging_state(t30), spanfax_log_message, pvt);
|
span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, pvt->session);
|
||||||
|
|
||||||
if (pvt->verbose) {
|
if (pvt->verbose) {
|
||||||
span_log_set_level(fax_get_logging_state(fax), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
span_log_set_level(fax_get_logging_state(fax), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
|
@ -789,8 +785,8 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
span_log_set_message_handler(t38_terminal_get_logging_state(t38), spanfax_log_message, pvt);
|
span_log_set_message_handler(t38_terminal_get_logging_state(t38), mod_spandsp_log_message, pvt->session);
|
||||||
span_log_set_message_handler(t30_get_logging_state(t30), spanfax_log_message, pvt);
|
span_log_set_message_handler(t30_get_logging_state(t30), mod_spandsp_log_message, pvt->session);
|
||||||
|
|
||||||
if (pvt->verbose) {
|
if (pvt->verbose) {
|
||||||
span_log_set_level(t38_terminal_get_logging_state(t38), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
span_log_set_level(t38_terminal_get_logging_state(t38), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
|
@ -843,8 +839,8 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
|
||||||
t38_gateway_set_ecm_capability(pvt->t38_gateway_state, TRUE);
|
t38_gateway_set_ecm_capability(pvt->t38_gateway_state, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
span_log_set_message_handler(t38_gateway_get_logging_state(pvt->t38_gateway_state), spanfax_log_message, pvt);
|
span_log_set_message_handler(t38_gateway_get_logging_state(pvt->t38_gateway_state), mod_spandsp_log_message, pvt->session);
|
||||||
span_log_set_message_handler(t38_core_get_logging_state(pvt->t38_core), spanfax_log_message, pvt);
|
span_log_set_message_handler(t38_core_get_logging_state(pvt->t38_core), mod_spandsp_log_message, pvt->session);
|
||||||
|
|
||||||
if (pvt->verbose) {
|
if (pvt->verbose) {
|
||||||
span_log_set_level(t38_gateway_get_logging_state(pvt->t38_gateway_state), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
span_log_set_level(t38_gateway_get_logging_state(pvt->t38_gateway_state), SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
|
|
|
@ -346,23 +346,23 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl
|
||||||
|
|
||||||
if (spandsp_globals.modem_verbose) {
|
if (spandsp_globals.modem_verbose) {
|
||||||
logging = t31_get_logging_state(modem->t31_state);
|
logging = t31_get_logging_state(modem->t31_state);
|
||||||
span_log_set_message_handler(logging, spanfax_log_message, NULL);
|
span_log_set_message_handler(logging, mod_spandsp_log_message, NULL);
|
||||||
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
|
|
||||||
logging = v17_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v17_rx);
|
logging = v17_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v17_rx);
|
||||||
span_log_set_message_handler(logging, spanfax_log_message, NULL);
|
span_log_set_message_handler(logging, mod_spandsp_log_message, NULL);
|
||||||
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
|
|
||||||
logging = v29_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v29_rx);
|
logging = v29_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v29_rx);
|
||||||
span_log_set_message_handler(logging, spanfax_log_message, NULL);
|
span_log_set_message_handler(logging, mod_spandsp_log_message, NULL);
|
||||||
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
|
|
||||||
logging = v27ter_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v27ter_rx);
|
logging = v27ter_rx_get_logging_state(&modem->t31_state->audio.modems.fast_modems.v27ter_rx);
|
||||||
span_log_set_message_handler(logging, spanfax_log_message, NULL);
|
span_log_set_message_handler(logging, mod_spandsp_log_message, NULL);
|
||||||
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
|
|
||||||
logging = t38_core_get_logging_state(modem->t38_core);
|
logging = t38_core_get_logging_state(modem->t38_core);
|
||||||
span_log_set_message_handler(logging, spanfax_log_message, NULL);
|
span_log_set_message_handler(logging, mod_spandsp_log_message, NULL);
|
||||||
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
span_log_set_level(logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue