]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4709 --resolve, not adding the change to switch_rtp I want to have that log line...
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 26 Feb 2013 17:49:17 +0000 (11:49 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 26 Feb 2013 17:49:17 +0000 (11:49 -0600)
src/include/switch_channel.h
src/include/switch_types.h
src/switch_channel.c
src/switch_core_io.c
src/switch_ivr_play_say.c

index 73eb7f102603c0d828a8857eaf68003a598bf2ec..0f9d0f9b4c0a0849270387734d2be027d8da65c0 100644 (file)
@@ -552,7 +552,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *cha
   \param dtmf digit
   \return SWITCH_STATUS_SUCCESS if successful
 */
-SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(_In_ switch_channel_t *channel, _In_ const switch_dtmf_t *dtmf);
+SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(_In_ switch_channel_t *channel, _In_ switch_dtmf_t *dtmf);
 SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(_In_ switch_channel_t *channel, _In_ const char *dtmf_string);
 
 /*!
index f3a15cbe27c86c5e534d5d80312997d526fcae1c..6c75ff4b3de4973e3d117edf14350c06f9600f4a 100644 (file)
@@ -138,6 +138,7 @@ SWITCH_BEGIN_EXTERN_C
 #define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause"
 #define SWITCH_TRANSFER_HISTORY_VARIABLE "transfer_history"
 #define SWITCH_TRANSFER_SOURCE_VARIABLE "transfer_source"
+#define SWITCH_SENSITIVE_DTMF_VARIABLE "sensitive_dtmf"
 
 #define SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE "execute_on_answer"
 #define SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE "execute_on_pre_answer"
@@ -246,7 +247,8 @@ typedef enum {
 
 
 typedef enum {
-       DTMF_FLAG_SKIP_PROCESS = (1 << 0)
+       DTMF_FLAG_SKIP_PROCESS = (1 << 0),
+       DTMF_FLAG_SENSITIVE = (1 << 1)
 } dtmf_flag_t;
 
 typedef struct {
index c00498ce17dd80d4aa3c2972d765c0c89a931e11..68aea4f4093126b07cd3827e6095ba445177f2f7 100644 (file)
@@ -389,14 +389,19 @@ SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(switch_channel_t *channel)
        return has;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *channel, const switch_dtmf_t *dtmf)
+SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *channel, switch_dtmf_t *dtmf)
 {
        switch_status_t status;
        void *pop;
        switch_dtmf_t new_dtmf = { 0 };
+       switch_bool_t sensitive = switch_true(switch_channel_get_variable_dup(channel, SWITCH_SENSITIVE_DTMF_VARIABLE, SWITCH_FALSE, -1));
 
        switch_assert(dtmf);
 
+       if (sensitive) {
+               switch_set_flag(dtmf, DTMF_FLAG_SENSITIVE);
+       }
+
        switch_mutex_lock(channel->dtmf_mutex);
        new_dtmf = *dtmf;
 
@@ -407,18 +412,19 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *chan
        if (is_dtmf(new_dtmf.digit)) {
                switch_dtmf_t *dt;
                int x = 0;
-               char str[2] = "";
 
-               str[0] = new_dtmf.digit;
+               if (!sensitive) {
+                       switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "RECV DTMF %c:%d\n", new_dtmf.digit, new_dtmf.duration);
+               }
 
                if (new_dtmf.digit != 'w' && new_dtmf.digit != 'W') {
                        if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) {
-                               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "%s EXCESSIVE DTMF DIGIT [%s] LEN [%d]\n",
-                                                                 switch_channel_get_name(channel), str, new_dtmf.duration);
+                               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s EXCESSIVE DTMF DIGIT LEN [%d]\n",
+                                                                 switch_channel_get_name(channel), new_dtmf.duration);
                                new_dtmf.duration = switch_core_max_dtmf_duration(0);
                        } else if (new_dtmf.duration < switch_core_min_dtmf_duration(0)) {
-                               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "%s SHORT DTMF DIGIT [%s] LEN [%d]\n",
-                                                                 switch_channel_get_name(channel), str, new_dtmf.duration);
+                               switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s SHORT DTMF DIGIT LEN [%d]\n",
+                                                                 switch_channel_get_name(channel), new_dtmf.duration);
                                new_dtmf.duration = switch_core_min_dtmf_duration(0);
                        } 
                }
@@ -519,14 +525,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(switch_channel_t *ch
        void *pop;
        switch_dtmf_t *dt;
        switch_status_t status = SWITCH_STATUS_FALSE;
+       int sensitive = 0;
 
        switch_mutex_lock(channel->dtmf_mutex);
 
        if (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
                dt = (switch_dtmf_t *) pop;
                *dtmf = *dt;
+               sensitive = switch_test_flag(dtmf, DTMF_FLAG_SENSITIVE);
 
-               if (switch_queue_trypush(channel->dtmf_log_queue, dt) != SWITCH_STATUS_SUCCESS) {
+               if (!sensitive && switch_queue_trypush(channel->dtmf_log_queue, dt) != SWITCH_STATUS_SUCCESS) {
                        free(dt);
                }
 
@@ -534,11 +542,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(switch_channel_t *ch
 
                if (dtmf->duration > switch_core_max_dtmf_duration(0)) {
                        switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
-                                                         switch_channel_get_name(channel), dtmf->digit, dtmf->duration);
+                                                         switch_channel_get_name(channel), sensitive ? 'S' : dtmf->digit, dtmf->duration);
                        dtmf->duration = switch_core_max_dtmf_duration(0);
                } else if (dtmf->duration < switch_core_min_dtmf_duration(0)) {
                        switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
-                                                         switch_channel_get_name(channel), dtmf->digit, dtmf->duration);
+                                                         switch_channel_get_name(channel), sensitive ? 'S' : dtmf->digit, dtmf->duration);
                        dtmf->duration = switch_core_min_dtmf_duration(0);
                } else if (!dtmf->duration) {
                        dtmf->duration = switch_core_default_dtmf_duration(0);
@@ -548,7 +556,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(switch_channel_t *ch
        }
        switch_mutex_unlock(channel->dtmf_mutex);
 
-       if (status == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_DTMF) == SWITCH_STATUS_SUCCESS) {
+       if (!sensitive && status == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_DTMF) == SWITCH_STATUS_SUCCESS) {
                switch_channel_event_set_data(channel, event);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Digit", "%c", dtmf->digit);
                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Duration", "%u", dtmf->duration);
index cfac3bf6293117c4e9adf02b08bbf9499257be4a..dfecf692fb706d34b0334cc677f9afef67ab068c 100644 (file)
@@ -1477,6 +1477,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio
                return SWITCH_STATUS_FALSE;
        }
 
+       if (switch_test_flag(dtmf, DTMF_FLAG_SENSITIVE)) {      
+               return SWITCH_STATUS_SUCCESS;
+       }
+
        switch_assert(dtmf);
 
        new_dtmf = *dtmf;
@@ -1520,6 +1524,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_sessio
                return SWITCH_STATUS_FALSE;
        }
 
+       if (switch_test_flag(dtmf, DTMF_FLAG_SENSITIVE)) {      
+               return SWITCH_STATUS_SUCCESS;
+       }
+
        switch_assert(dtmf);
 
        new_dtmf = *dtmf;
index 3ff6893e44b857c83304058798a137c222f87fb7..82907832f5031e560d6ad2ccf74acfe7eed7024f 100644 (file)
@@ -2040,7 +2040,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
                                        if (zstr(digits_regex)) {
                                                return SWITCH_STATUS_SUCCESS;
                                        }
-                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Test Regex [%s][%s]\n", digit_buffer, digits_regex);
+                                       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "Test Regex [%s][%s]\n", digit_buffer, digits_regex);
                                        if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) {
                                                return SWITCH_STATUS_SUCCESS;
                                        } else {