]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4122 --resolve this fixes the issue and eliminates the delay unless you configure...
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 18 Apr 2012 14:55:58 +0000 (09:55 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 18 Apr 2012 14:56:06 +0000 (09:56 -0500)
conf/vanilla/sip_profiles/internal.xml
src/include/switch_rtp.h
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c
src/switch_rtp.c

index b8390c7934a82b09a6582ebfdbc6e4c0c67701d3..b9605a192cb4885a4acfd5d0797aadd64d3812bf 100644 (file)
   </domains>
   
   <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 you press the hold button.
index a61326a6b81e589f0bef9c289e07e22c98df49e8..0951498c375bb76973d8f9c68bfd0581b8cf9477 100644 (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_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);
 
 /*!
   \}
index 69afee7c2980a6f2b8a4b92fa2f732d45e98023f..730b592187554639cd3e0bd4e02a3208382b57d1 100644 (file)
@@ -668,6 +668,7 @@ struct sofia_profile {
        uint32_t sip_expires_max_deviation;
        int ireg_seconds;
        sofia_paid_type_t paid_type;
+       uint32_t rtp_digit_delay;
 };
 
 struct private_object {
index 921708c4e3144aa0006ff3b5d6a31193b477c853..44afd6242d5218208a012370c52e190c03ee690f 100644 (file)
@@ -2957,6 +2957,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
                                                } else {
                                                        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")) {
                                                profile->watchdog_enabled = switch_true(val);
                                        } else if (!strcasecmp(var, "watchdog-step-timeout")) {
@@ -3839,6 +3845,13 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                } else {
                                                        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")) {
                                                profile->watchdog_enabled = switch_true(val);
                                        } else if (!strcasecmp(var, "watchdog-step-timeout")) {
index 645203520f7b19c00c98a4f5b5d8e6868e9045ae..871c433090afece2143e24c5f24c7085686f1b7d 100644 (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;
                }
 
+               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)) {
                        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);
index fefb50f551a62062b3128a63f8891ca3c580906b..193520000f9c6791b7df01e6142bddfd4a222eb4 100644 (file)
@@ -193,6 +193,7 @@ struct switch_rtp {
        uint32_t last_cng_ts;
        uint32_t last_write_samplecount;
        uint32_t delay_samples;
+       uint32_t next_write_samplecount;
        uint32_t max_next_write_samplecount;
        uint32_t queue_delay;
        switch_time_t last_write_timestamp;
@@ -248,6 +249,15 @@ struct switch_rtp {
        uint32_t sync_packets;
        int rtcp_interval;
        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
        zrtp_session_t *zrtp_session;
        zrtp_profile_t *zrtp_profile;
@@ -256,12 +266,7 @@ struct switch_rtp {
        int zinit;
 #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 {
@@ -2223,6 +2228,11 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
        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)
 {
        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)) {
                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);    
@@ -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;
-                       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;
                }
        }
@@ -2368,7 +2383,7 @@ static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session)
                void *pop;
 
                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;
                        }