]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add sofia profile params to fine-tune timers
authorMathieu Rene <mrene@avgs.ca>
Wed, 6 May 2009 18:12:44 +0000 (18:12 +0000)
committerMathieu Rene <mrene@avgs.ca>
Wed, 6 May 2009 18:12:44 +0000 (18:12 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13245 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/sip_profiles/internal.xml
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index c27a87ffa4b2d11cf5bc0a77fbe05df72c58a78a..7b52ce0990b214dd10c212dd7595d162c2ac5132 100644 (file)
         <!--<param name="disable-srv" value="false" />-->
         <!--<param name="disable-naptr" value="false" />-->
 
+       <!-- The following can be used to fine-tune timers within sofia's transport layer 
+                Those settings are for advanced users and can safely be left as-is -->
+               
+       <!-- Initial retransmission interval (in milliseconds).
+               Set the T1 retransmission interval used by the SIP transaction engine. 
+               The T1 is the initial duration used by request retransmission timers A and E (UDP) as well as response retransmission timer G.   -->
+       <!-- <param name="timer-T1" value="500" /> -->
+       
+       <!--  Transaction timeout (defaults to T1 * 64).
+               Set the T1x64 timeout value used by the SIP transaction engine.
+               The T1x64 is duration used for timers B, F, H, and J (UDP) by the SIP transaction engine. 
+               The timeout value T1x64 can be adjusted separately from the initial retransmission interval T1. -->
+       <!-- <param name="timer-T1X64" value="32000" /> -->
+       
+       
+       <!-- Maximum retransmission interval (in milliseconds).
+               Set the maximum retransmission interval used by the SIP transaction engine. 
+               The T2 is the maximum duration used for the timers E (UDP) and G by the SIP transaction engine. 
+               Note that the timer A is not capped by T2. Retransmission interval of INVITE requests grows exponentially 
+               until the timer B fires.  -->
+       <!-- <param name="timer-T2" value="4000" /> -->
+               
+       <!--
+               Transaction lifetime (in milliseconds).
+               Set the lifetime for completed transactions used by the SIP transaction engine. 
+               A completed transaction is kept around for the duration of T4 in order to catch late responses. 
+               The T4 is the maximum duration for the messages to stay in the network and the duration of SIP timer K. -->
+       <!-- <param name="timer-T4" value="4000" /> -->
     
   </settings>
 </profile>
index 6ccd286ca5c5c88646e0601de354c4c6eb105493..41948628b5cc17ea92da84444546f7b6c1a13169 100644 (file)
@@ -479,6 +479,10 @@ struct sofia_profile {
        uint32_t ob_calls;
        uint32_t ib_failed_calls;
        uint32_t ob_failed_calls;
+       uint32_t timer_t1;
+       uint32_t timer_t1x64;
+       uint32_t timer_t2;
+       uint32_t timer_t4;      
 };
 
 struct private_object {
index abefb6954ab11da236653ac252b0321cf691f1e7..630edd7f8f085b9fcf3d28c2f4361a7a055f1806 100644 (file)
@@ -775,6 +775,10 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
                                                          NTATAG_DEFAULT_PROXY(profile->outbound_proxy),
                                                          NTATAG_SERVER_RPORT(profile->rport_level), 
                                                          TPTAG_LOG(sofia_test_flag(profile, TFLAG_TPORT_LOG)), 
+                                                         TAG_IF(profile->timer_t1, NTATAG_SIP_T1(profile->timer_t1)),
+                                                         TAG_IF(profile->timer_t1x64, NTATAG_SIP_T1X64(profile->timer_t1x64)),
+                                                         TAG_IF(profile->timer_t2, NTATAG_SIP_T2(profile->timer_t2)),
+                                                         TAG_IF(profile->timer_t4, NTATAG_SIP_T4(profile->timer_t4)),
                                                          TAG_END());   /* Last tag should always finish the sequence */
 
        if (!profile->nua) {
@@ -1780,6 +1784,38 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
                                                        profile->dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n", SWITCH_DEFAULT_DTMF_DURATION);
                                                }
+                                       } else if (!strcasecmp(var, "timer-T1")) {
+                                               int v = atoi(val);
+                                               if (v > 0) {
+                                                       profile->timer_t1 = v;
+                                               } else {
+                                                       profile->timer_t1 = 500;
+                                               }
+                                               nua_set_params(profile->nua, NTATAG_SIP_T1(profile->timer_t1), TAG_END());
+                                       } else if (!strcasecmp(var, "timer-T1X64")) {
+                                               int v = atoi(val);
+                                               if (v > 0) {
+                                                       profile->timer_t1x64 = v;
+                                               } else {
+                                                       profile->timer_t1x64 = 32000;
+                                               }
+                                               nua_set_params(profile->nua, NTATAG_SIP_T1X64(profile->timer_t1x64), TAG_END());
+                                       } else if (!strcasecmp(var, "timer-T2")) {
+                                               int v = atoi(val);
+                                               if (v > 0) {
+                                                       profile->timer_t2 = v;
+                                               } else {
+                                                       profile->timer_t2 = 4000;
+                                               }
+                                               nua_set_params(profile->nua, NTATAG_SIP_T2(profile->timer_t2), TAG_END());
+                                       } else if (!strcasecmp(var, "timer-T4")) {
+                                               int v = atoi(val);
+                                               if (v > 0) {
+                                                       profile->timer_t4 = v;
+                                               } else {
+                                                       profile->timer_t4 = 4000;
+                                               }
+                                               nua_set_params(profile->nua, NTATAG_SIP_T4(profile->timer_t4), TAG_END());
                                        }
                                }
                        }
@@ -2408,6 +2444,34 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                } else {
                                                        profile->tls_version = 0;
                                                }
+                                       } else if (!strcasecmp(var, "timer-T1")) {
+                                               int v = atoi(val);
+                                               if (v > 0) {
+                                                       profile->timer_t1 = v;
+                                               } else {
+                                                       profile->timer_t1 = 500;
+                                               }
+                                       } else if (!strcasecmp(var, "timer-T1X64")) {
+                                               int v = atoi(val);
+                                               if (v > 0) {
+                                                       profile->timer_t1x64 = v;
+                                               } else {
+                                                       profile->timer_t1x64 = 32000;
+                                               }
+                                       } else if (!strcasecmp(var, "timer-T2")) {
+                                               int v = atoi(val);
+                                               if (v > 0) {
+                                                       profile->timer_t2 = v;
+                                               } else {
+                                                       profile->timer_t2 = 4000;
+                                               }
+                                       } else if (!strcasecmp(var, "timer-T4")) {
+                                               int v = atoi(val);
+                                               if (v > 0) {
+                                                       profile->timer_t4 = v;
+                                               } else {
+                                                       profile->timer_t4 = 4000;
+                                               }
                                        }
                                }