From b997c4fc8b14e696e57723156df55eb4a856995c Mon Sep 17 00:00:00 2001 From: Visytel <59720603+Visytel@users.noreply.github.com> Date: Thu, 13 Feb 2020 06:44:35 +1100 Subject: [PATCH] [core] Turn DTMF logging on or off using sensitive_dtmf var --- src/switch_cpp.cpp | 8 ++++++-- src/switch_rtp.c | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index eda8b0807b..f51d2c1fb8 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -901,8 +901,12 @@ SWITCH_DECLARE(char *) CoreSession::getDigits(int maxdigits, terminators, &terminator, (uint32_t) timeout, (uint32_t)interdigit, (uint32_t)abstimeout); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "getDigits dtmf_buf: %s\n", dtmf_buf); + + /* Only log DTMF buffer if sensitive_dtmf channel variable not set to true */ + if (!(switch_channel_var_true(switch_core_session_get_channel(session), SWITCH_SENSITIVE_DTMF_VARIABLE))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "getDigits dtmf_buf: %s\n", dtmf_buf); + } + end_allow_threads(); return dtmf_buf; } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 8945b60a67..e0f1504748 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -7958,9 +7958,12 @@ SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, switch_mutex_lock(rtp_session->dtmf_data.dtmf_mutex); if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_inqueue, &pop) == SWITCH_STATUS_SUCCESS) { - _dtmf = (switch_dtmf_t *) pop; + _dtmf = (switch_dtmf_t *)pop; *dtmf = *_dtmf; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG, "RTP RECV DTMF %c:%d\n", dtmf->digit, dtmf->duration); + /* Only log DTMF buffer if sensitive_dtmf channel variable not set to true */ + if (!(switch_channel_var_true(switch_core_session_get_channel(rtp_session->session), SWITCH_SENSITIVE_DTMF_VARIABLE))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG,"RTP RECV DTMF %c:%d\n", dtmf->digit, dtmf->duration); + } bytes++; free(pop); }