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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2025-12-13T20:52:24+01:00

tm: execute on event_route[tm:local-ack-sent] on reply execution path

---

Modified: src/modules/tm/t_msgbuilder.c
Modified: src/modules/tm/t_reply.c
Modified: src/modules/tm/uac.h

---

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

---

diff --git a/src/modules/tm/t_msgbuilder.c b/src/modules/tm/t_msgbuilder.c
index c22941012cc..7cb8a644581 100644
--- a/src/modules/tm/t_msgbuilder.c
+++ b/src/modules/tm/t_msgbuilder.c
@@ -35,6 +35,7 @@
 #include "../../core/config.h"
 #include "../../core/parser/parser_f.h"
 #include "../../core/parser/parse_to.h"
+#include "../../core/parser/parse_from.h"
 #include "../../core/ut.h"
 #include "../../core/trim.h"
 #include "../../core/srapi.h"
diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c
index 449b9653b9a..bc0e1867384 100644
--- a/src/modules/tm/t_reply.c
+++ b/src/modules/tm/t_reply.c
@@ -1398,10 +1398,10 @@ static enum rps t_should_relay_response(struct cell 
*Trans, int new_code,
                /* Do not discard negative replies for forked REGISTER messages
                 * if 200 status for initial trasaction already been set.
                 * In case of REGISTER request is forked to multiple Registrars
-                * some of registrars may reply with AUTH response later than 
others. 
+                * some of registrars may reply with AUTH response later than 
others.
                 * Without this code negative replies will be just discarded 
silently.
                 * This part lests late negative replies for forked REGISTERs 
being treated
-                * the same way negative replies for INVITE requests are 
treated 
+                * the same way negative replies for INVITE requests are treated
                 * However it won't be propagated to UAC, as transacton status 
already 200.
                 */
                if(!(strncmp(Trans->method.s, "REGISTER", 8) == 0 && new_code 
>= 300)) {
@@ -2534,14 +2534,20 @@ int reply_received(struct sip_msg *p_msg)
                        } else if(is_local(t) /*&& 200 <= msg_status < 300*/) {
                                ack = build_local_ack(p_msg, t, branch, 
&ack_len, &lack_dst);
                                if(ack) {
-                                       if(msg_send(&lack_dst, ack, ack_len) < 
0)
+                                       if(msg_send(&lack_dst, ack, ack_len) < 
0) {
                                                LM_ERR("error while sending 
local ACK\n");
-                                       else if(unlikely(has_tran_tmcbs(t, 
TMCB_REQUEST_SENT))) {
-                                               
INIT_TMCB_ONSEND_PARAMS(onsend_params, t->uas.request,
-                                                               p_msg, 
&uac->request, &lack_dst, ack, ack_len,
-                                                               TMCB_LOCAL_F, 
branch, TYPE_LOCAL_ACK);
-                                               run_trans_callbacks_off_params(
-                                                               
TMCB_REQUEST_SENT, t, &onsend_params);
+                                       } else {
+                                               if(unlikely(has_tran_tmcbs(t, 
TMCB_REQUEST_SENT))) {
+                                                       
INIT_TMCB_ONSEND_PARAMS(onsend_params,
+                                                                       
t->uas.request, p_msg, &uac->request,
+                                                                       
&lack_dst, ack, ack_len, TMCB_LOCAL_F,
+                                                                       branch, 
TYPE_LOCAL_ACK);
+                                                       
run_trans_callbacks_off_params(
+                                                                       
TMCB_REQUEST_SENT, t, &onsend_params);
+                                               }
+                                               if(msg_status >= 200 && 
msg_status < 300) {
+                                                       
uac_evrt_local_ack_sent(p_msg);
+                                               }
                                        }
                                }
                        }
diff --git a/src/modules/tm/uac.h b/src/modules/tm/uac.h
index ab6b24366d5..da04b3e58a4 100644
--- a/src/modules/tm/uac.h
+++ b/src/modules/tm/uac.h
@@ -141,6 +141,8 @@ void free_local_ack_unsafe(struct retr_buf *lack);
  */
 int ack_local_uac(struct cell *trans, str *hdrs, str *body);
 
+int uac_evrt_local_ack_sent(sip_msg_t *rpl);
+
 /*
  * Send a transactional request, no dialogs involved
  */

_______________________________________________
Kamailio - Development Mailing List -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to