]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core] Turn DTMF logging on or off using sensitive_dtmf var
authorVisytel <59720603+Visytel@users.noreply.github.com>
Wed, 12 Feb 2020 19:44:35 +0000 (06:44 +1100)
committerGitHub <noreply@github.com>
Wed, 12 Feb 2020 19:44:35 +0000 (23:44 +0400)
src/switch_cpp.cpp
src/switch_rtp.c

index eda8b0807b271ed9abe5fb83e78c7f1c8523f215..f51d2c1fb875a3619431af459f529dde0ccfe1cf 100644 (file)
@@ -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;
 }
index 8945b60a674346a1cac9631700abdfa936d2c102..e0f1504748d30dca401c7dea042df48d6369ae01 100644 (file)
@@ -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);
        }