char str[2] = "";
str[0] = new_dtmf.digit;
+
+ 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);
+ 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);
+ new_dtmf.duration = switch_core_min_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_channel_get_name(channel), str, 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);
- new_dtmf.duration = switch_core_min_dtmf_duration(0);
- } else if (!new_dtmf.duration) {
+ if (!new_dtmf.duration) {
new_dtmf.duration = switch_core_default_dtmf_duration(0);
}
+
switch_zmalloc(dt, sizeof(*dt));
*dt = new_dtmf;
switch_assert(dtmf);
new_dtmf = *dtmf;
-
- if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
- switch_channel_get_name(session->channel), new_dtmf.digit, 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_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
+
+ if (new_dtmf.digit != 'w' && new_dtmf.digit != 'W') {
+ if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
+ switch_channel_get_name(session->channel), new_dtmf.digit, 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_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration);
- new_dtmf.duration = switch_core_min_dtmf_duration(0);
- } else if (!new_dtmf.duration) {
- new_dtmf.duration = switch_core_default_dtmf_duration(0);
+ new_dtmf.duration = switch_core_min_dtmf_duration(0);
+ }
}
+ if (!new_dtmf.duration) {
+ new_dtmf.duration = switch_core_default_dtmf_duration(0);
+ }
if (!switch_test_flag(dtmf, DTMF_FLAG_SKIP_PROCESS)) {
for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) {
for (p = argv[i]; p && *p; p++) {
if (is_dtmf(*p)) {
dtmf.digit = *p;
-
- if (dtmf.duration > switch_core_max_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
- switch_channel_get_name(session->channel), 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_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
- switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
- dtmf.duration = switch_core_min_dtmf_duration(0);
- } else if (!dtmf.duration) {
+
+ if (dtmf.digit != 'w' && dtmf.digit != 'W') {
+ if (dtmf.duration > switch_core_max_dtmf_duration(0)) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n",
+ switch_channel_get_name(session->channel), 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_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n",
+ switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
+ dtmf.duration = switch_core_min_dtmf_duration(0);
+ }
+ }
+
+ if (!dtmf.duration) {
dtmf.duration = switch_core_default_dtmf_duration(0);
}
+
if (switch_core_session_send_dtmf(session, &dtmf) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n",
uint32_t last_read_ts;
uint32_t last_cng_ts;
uint32_t last_write_samplecount;
- uint32_t next_write_samplecount;
+ uint32_t delay_samples;
uint32_t max_next_write_samplecount;
uint32_t queue_delay;
switch_time_t last_write_timestamp;
rtp_session->dtmf_data.out_digit_dur = 0;
set_dtmf_delay(rtp_session, 40, 500);
-
return;
}
}
void *pop;
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
- if (rtp_session->last_write_ts < rtp_session->next_write_samplecount && rtp_session->timer.samplecount < rtp_session->max_next_write_samplecount) {
+ if (rtp_session->timer.samplecount < rtp_session->max_next_write_samplecount) {
return;
}
+
if (rtp_session->timer.samplecount >= rtp_session->max_next_write_samplecount) {
rtp_session->queue_delay = 0;
}
- } else {
- if (rtp_session->last_write_ts < rtp_session->next_write_samplecount) {
- return;
+ } else if (rtp_session->queue_delay) {
+ if (rtp_session->delay_samples >= rtp_session->samples_per_interval) {
+ rtp_session->delay_samples -= rtp_session->samples_per_interval;
+ } else {
+ rtp_session->delay_samples = 0;
+ }
+
+ if (!rtp_session->delay_samples) {
+ rtp_session->queue_delay = 0;
}
}
rtp_session->last_write_ts = this_ts;
if (rtp_session->queue_delay) {
- rtp_session->next_write_samplecount = rtp_session->last_write_ts + rtp_session->queue_delay;
+ rtp_session->delay_samples = rtp_session->queue_delay;
rtp_session->queue_delay = 0;
}
fwd = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) && switch_test_flag(frame, SFF_RAW_RTP)) ? 1 : 0;
- if (!fwd && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) && (rtp_session->rtp_bugs & RTP_BUG_GEN_ONE_GEN_ALL)) {
+ if (!fwd && !rtp_session->sending_dtmf && !rtp_session->queue_delay &&
+ switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) && (rtp_session->rtp_bugs & RTP_BUG_GEN_ONE_GEN_ALL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Generating RTP locally but timestamp passthru is configured, disabling....\n");
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE);
+ rtp_session->last_write_ts = RTP_TS_RESET;
}
switch_assert(frame != NULL);