FS-4122 --resolve this fixes the issue and eliminates the delay unless you configure it to have some

This commit is contained in:
Anthony Minessale 2012-04-18 09:55:58 -05:00
parent 6ea05d25f7
commit 677b223579
6 changed files with 58 additions and 8 deletions

View File

@ -27,6 +27,11 @@
</domains> </domains>
<settings> <settings>
<!-- inject delay between dtmf digits on send to help some slow interpreters (also per channel with rtp_digit_delay var -->
<!-- <param name="rtp-digit-delay" value="40"/>-->
<!-- <!--
When calls are in no media this will bring them back to media When calls are in no media this will bring them back to media
when you press the hold button. when you press the hold button.

View File

@ -461,6 +461,7 @@ SWITCH_DECLARE(void) switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, swit
SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_session, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_session, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_byte_t) switch_rtp_check_auto_adj(switch_rtp_t *rtp_session); SWITCH_DECLARE(switch_byte_t) switch_rtp_check_auto_adj(switch_rtp_t *rtp_session);
SWITCH_DECLARE(void) switch_rtp_set_interdigit_delay(switch_rtp_t *rtp_session, uint32_t delay);
/*! /*!
\} \}

View File

@ -668,6 +668,7 @@ struct sofia_profile {
uint32_t sip_expires_max_deviation; uint32_t sip_expires_max_deviation;
int ireg_seconds; int ireg_seconds;
sofia_paid_type_t paid_type; sofia_paid_type_t paid_type;
uint32_t rtp_digit_delay;
}; };
struct private_object { struct private_object {

View File

@ -2957,6 +2957,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
} else { } else {
sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID); sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID);
} }
} else if (!strcasecmp(var, "rtp-digit-timeout")) {
int delay = val ? atoi(val) : 0;
if (delay < 0) delay = 0;
profile->rtp_digit_delay = (uint32_t) delay;
} else if (!strcasecmp(var, "watchdog-enabled")) { } else if (!strcasecmp(var, "watchdog-enabled")) {
profile->watchdog_enabled = switch_true(val); profile->watchdog_enabled = switch_true(val);
} else if (!strcasecmp(var, "watchdog-step-timeout")) { } else if (!strcasecmp(var, "watchdog-step-timeout")) {
@ -3839,6 +3845,13 @@ switch_status_t config_sofia(int reload, char *profile_name)
} else { } else {
sofia_clear_pflag(profile, PFLAG_LIBERAL_DTMF); sofia_clear_pflag(profile, PFLAG_LIBERAL_DTMF);
} }
} else if (!strcasecmp(var, "rtp-digit-timeout")) {
int delay = val ? atoi(val) : 0;
if (delay < 0) delay = 0;
profile->rtp_digit_delay = (uint32_t) delay;
} else if (!strcasecmp(var, "watchdog-enabled")) { } else if (!strcasecmp(var, "watchdog-enabled")) {
profile->watchdog_enabled = switch_true(val); profile->watchdog_enabled = switch_true(val);
} else if (!strcasecmp(var, "watchdog-step-timeout")) { } else if (!strcasecmp(var, "watchdog-step-timeout")) {

View File

@ -3532,6 +3532,21 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
tech_pvt->cng_pt = 0; tech_pvt->cng_pt = 0;
} }
if (tech_pvt->profile->rtp_digit_delay || ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_digit_delay")))) {
uint32_t delay = tech_pvt->profile->rtp_digit_delay;
if (!delay) {
int delayi = atoi(val);
if (delayi < 0) delayi = 0;
delay = (uint32_t) delay;
}
switch_rtp_set_interdigit_delay(tech_pvt->rtp_session, delay);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
"%s Set rtp dtmf delay to %u\n", switch_channel_get_name(tech_pvt->channel), delay);
}
if (tech_pvt->cng_pt && !sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) { if (tech_pvt->cng_pt && !sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", tech_pvt->cng_pt); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set comfort noise payload to %u\n", tech_pvt->cng_pt);
switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt); switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt);

View File

@ -193,6 +193,7 @@ struct switch_rtp {
uint32_t last_cng_ts; uint32_t last_cng_ts;
uint32_t last_write_samplecount; uint32_t last_write_samplecount;
uint32_t delay_samples; uint32_t delay_samples;
uint32_t next_write_samplecount;
uint32_t max_next_write_samplecount; uint32_t max_next_write_samplecount;
uint32_t queue_delay; uint32_t queue_delay;
switch_time_t last_write_timestamp; switch_time_t last_write_timestamp;
@ -248,6 +249,15 @@ struct switch_rtp {
uint32_t sync_packets; uint32_t sync_packets;
int rtcp_interval; int rtcp_interval;
switch_bool_t rtcp_fresh_frame; switch_bool_t rtcp_fresh_frame;
switch_time_t send_time;
switch_byte_t auto_adj_used;
uint8_t pause_jb;
uint16_t last_seq;
switch_time_t last_read_time;
switch_size_t last_flush_packet_count;
uint32_t interdigit_delay;
#ifdef ENABLE_ZRTP #ifdef ENABLE_ZRTP
zrtp_session_t *zrtp_session; zrtp_session_t *zrtp_session;
zrtp_profile_t *zrtp_profile; zrtp_profile_t *zrtp_profile;
@ -256,12 +266,7 @@ struct switch_rtp {
int zinit; int zinit;
#endif #endif
switch_time_t send_time;
switch_byte_t auto_adj_used;
uint8_t pause_jb;
uint16_t last_seq;
switch_time_t last_read_time;
switch_size_t last_flush_packet_count;
}; };
struct switch_rtcp_senderinfo { struct switch_rtcp_senderinfo {
@ -2223,6 +2228,11 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
return; return;
} }
SWITCH_DECLARE(void) switch_rtp_set_interdigit_delay(switch_rtp_t *rtp_session, uint32_t delay)
{
rtp_session->interdigit_delay = delay;
}
SWITCH_DECLARE(switch_socket_t *) switch_rtp_get_rtp_socket(switch_rtp_t *rtp_session) SWITCH_DECLARE(switch_socket_t *) switch_rtp_get_rtp_socket(switch_rtp_t *rtp_session)
{ {
return rtp_session->sock_input; return rtp_session->sock_input;
@ -2289,6 +2299,7 @@ static void set_dtmf_delay(switch_rtp_t *rtp_session, uint32_t ms, uint32_t max_
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) { if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
rtp_session->max_next_write_samplecount = rtp_session->timer.samplecount + max_upsamp; rtp_session->max_next_write_samplecount = rtp_session->timer.samplecount + max_upsamp;
rtp_session->next_write_samplecount = rtp_session->timer.samplecount + upsamp;
} }
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Queue digit delay of %dms\n", ms); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Queue digit delay of %dms\n", ms);
@ -2359,7 +2370,11 @@ static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session)
} }
rtp_session->dtmf_data.out_digit_dur = 0; rtp_session->dtmf_data.out_digit_dur = 0;
set_dtmf_delay(rtp_session, 40, 500);
if (rtp_session->interdigit_delay) {
set_dtmf_delay(rtp_session, rtp_session->interdigit_delay, rtp_session->interdigit_delay * 10);
}
return; return;
} }
} }
@ -2368,7 +2383,7 @@ static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session)
void *pop; void *pop;
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) { if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
if (rtp_session->timer.samplecount < rtp_session->max_next_write_samplecount) { if (rtp_session->timer.samplecount < rtp_session->next_write_samplecount) {
return; return;
} }