FS-4709 --resolve, not adding the change to switch_rtp I want to have that log line there, don't make vanity changes mixed in with code changes
This commit is contained in:
parent
9c00466dae
commit
aa89eab58f
|
@ -552,7 +552,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_dtmf_unlock(switch_channel_t *cha
|
||||||
\param dtmf digit
|
\param dtmf digit
|
||||||
\return SWITCH_STATUS_SUCCESS if successful
|
\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);
|
SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(_In_ switch_channel_t *channel, _In_ const char *dtmf_string);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -138,6 +138,7 @@ SWITCH_BEGIN_EXTERN_C
|
||||||
#define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause"
|
#define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause"
|
||||||
#define SWITCH_TRANSFER_HISTORY_VARIABLE "transfer_history"
|
#define SWITCH_TRANSFER_HISTORY_VARIABLE "transfer_history"
|
||||||
#define SWITCH_TRANSFER_SOURCE_VARIABLE "transfer_source"
|
#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_ANSWER_VARIABLE "execute_on_answer"
|
||||||
#define SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE "execute_on_pre_answer"
|
#define SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE "execute_on_pre_answer"
|
||||||
|
@ -246,7 +247,8 @@ typedef enum {
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DTMF_FLAG_SKIP_PROCESS = (1 << 0)
|
DTMF_FLAG_SKIP_PROCESS = (1 << 0),
|
||||||
|
DTMF_FLAG_SENSITIVE = (1 << 1)
|
||||||
} dtmf_flag_t;
|
} dtmf_flag_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -389,14 +389,19 @@ SWITCH_DECLARE(switch_size_t) switch_channel_has_dtmf(switch_channel_t *channel)
|
||||||
return has;
|
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;
|
switch_status_t status;
|
||||||
void *pop;
|
void *pop;
|
||||||
switch_dtmf_t new_dtmf = { 0 };
|
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);
|
switch_assert(dtmf);
|
||||||
|
|
||||||
|
if (sensitive) {
|
||||||
|
switch_set_flag(dtmf, DTMF_FLAG_SENSITIVE);
|
||||||
|
}
|
||||||
|
|
||||||
switch_mutex_lock(channel->dtmf_mutex);
|
switch_mutex_lock(channel->dtmf_mutex);
|
||||||
new_dtmf = *dtmf;
|
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)) {
|
if (is_dtmf(new_dtmf.digit)) {
|
||||||
switch_dtmf_t *dt;
|
switch_dtmf_t *dt;
|
||||||
int x = 0;
|
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.digit != 'w' && new_dtmf.digit != 'W') {
|
||||||
if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) {
|
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_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s EXCESSIVE DTMF DIGIT LEN [%d]\n",
|
||||||
switch_channel_get_name(channel), str, new_dtmf.duration);
|
switch_channel_get_name(channel), new_dtmf.duration);
|
||||||
new_dtmf.duration = switch_core_max_dtmf_duration(0);
|
new_dtmf.duration = switch_core_max_dtmf_duration(0);
|
||||||
} else if (new_dtmf.duration < switch_core_min_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_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s SHORT DTMF DIGIT LEN [%d]\n",
|
||||||
switch_channel_get_name(channel), str, new_dtmf.duration);
|
switch_channel_get_name(channel), new_dtmf.duration);
|
||||||
new_dtmf.duration = switch_core_min_dtmf_duration(0);
|
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;
|
void *pop;
|
||||||
switch_dtmf_t *dt;
|
switch_dtmf_t *dt;
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
int sensitive = 0;
|
||||||
|
|
||||||
switch_mutex_lock(channel->dtmf_mutex);
|
switch_mutex_lock(channel->dtmf_mutex);
|
||||||
|
|
||||||
if (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
if (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
|
||||||
dt = (switch_dtmf_t *) pop;
|
dt = (switch_dtmf_t *) pop;
|
||||||
*dtmf = *dt;
|
*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);
|
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)) {
|
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_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);
|
dtmf->duration = switch_core_max_dtmf_duration(0);
|
||||||
} else if (dtmf->duration < switch_core_min_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_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);
|
dtmf->duration = switch_core_min_dtmf_duration(0);
|
||||||
} else if (!dtmf->duration) {
|
} else if (!dtmf->duration) {
|
||||||
dtmf->duration = switch_core_default_dtmf_duration(0);
|
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);
|
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_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-Digit", "%c", dtmf->digit);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Duration", "%u", dtmf->duration);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Duration", "%u", dtmf->duration);
|
||||||
|
|
|
@ -1477,6 +1477,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (switch_test_flag(dtmf, DTMF_FLAG_SENSITIVE)) {
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
switch_assert(dtmf);
|
switch_assert(dtmf);
|
||||||
|
|
||||||
new_dtmf = *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;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (switch_test_flag(dtmf, DTMF_FLAG_SENSITIVE)) {
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
switch_assert(dtmf);
|
switch_assert(dtmf);
|
||||||
|
|
||||||
new_dtmf = *dtmf;
|
new_dtmf = *dtmf;
|
||||||
|
|
|
@ -2040,7 +2040,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t
|
||||||
if (zstr(digits_regex)) {
|
if (zstr(digits_regex)) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
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) {
|
if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue