Module: kamailio
Branch: master
Commit: fc366962cf6142fd7614baee9ace854ac661d698
URL: 
https://github.com/kamailio/kamailio/commit/fc366962cf6142fd7614baee9ace854ac661d698

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-08-12T08:54:04+02:00

dispatcher: load tm api earlier than records loading not to reset the probing 
flag

---

Modified: src/modules/dispatcher/dispatcher.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/fc366962cf6142fd7614baee9ace854ac661d698.diff
Patch: 
https://github.com/kamailio/kamailio/commit/fc366962cf6142fd7614baee9ace854ac661d698.patch

---

diff --git a/src/modules/dispatcher/dispatcher.c 
b/src/modules/dispatcher/dispatcher.c
index c31b7bb95ad..b0f5942e6e7 100644
--- a/src/modules/dispatcher/dispatcher.c
+++ b/src/modules/dispatcher/dispatcher.c
@@ -389,7 +389,20 @@ static int mod_init(void)
                LM_ERR("Fail to declare the configuration\n");
                return -1;
        }
-
+       /* if the ping-keepalive-timer is enabled the tm-api needs to be loaded 
*/
+       if(ds_ping_interval > 0) {
+               if(load_tm_api(&tmb) == -1) {
+                       LM_ERR("could not load the TM-functions - disable DS 
ping\n");
+                       return -1;
+               }
+               if(ds_timer_mode == 1) {
+                       if(sr_wtimer_add(ds_check_timer, NULL, 
ds_ping_interval) < 0)
+                               return -1;
+               } else {
+                       if(register_timer(ds_check_timer, NULL, 
ds_ping_interval) < 0)
+                               return -1;
+               }
+       }
        /* Initialize the counter */
        ds_ping_reply_codes = (int **)shm_malloc(sizeof(unsigned int *));
        if(!(ds_ping_reply_codes)) {
@@ -535,26 +548,6 @@ static int mod_init(void)
                }
        }
 
-       /* Only, if the Probing-Timer is enabled the TM-API needs to be loaded: 
*/
-       if(ds_ping_interval > 0) {
-               /*****************************************************
-                * TM-Bindings
-                *****************************************************/
-               if(load_tm_api(&tmb) == -1) {
-                       LM_ERR("could not load the TM-functions - disable DS 
ping\n");
-                       return -1;
-               }
-               /*****************************************************
-                * Register the PING-Timer
-                *****************************************************/
-               if(ds_timer_mode == 1) {
-                       if(sr_wtimer_add(ds_check_timer, NULL, 
ds_ping_interval) < 0)
-                               return -1;
-               } else {
-                       if(register_timer(ds_check_timer, NULL, 
ds_ping_interval) < 0)
-                               return -1;
-               }
-       }
        if(ds_latency_estimator_alpha_i > 0
                        && ds_latency_estimator_alpha_i < 1000) {
                ds_latency_estimator_alpha = ds_latency_estimator_alpha_i / 
1000.0f;

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to