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

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

tm: added event_route[tm:local-ack-sent]

- event route executed after the ACK for 200ok of local INVITE
  transaction was sent. it is executed with the received 200ok response

---

Modified: src/modules/tm/uac.c

---

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

---

diff --git a/src/modules/tm/uac.c b/src/modules/tm/uac.c
index f1717cf1ffc..2628bf248a0 100644
--- a/src/modules/tm/uac.c
+++ b/src/modules/tm/uac.c
@@ -956,6 +956,47 @@ void free_local_ack_unsafe(struct retr_buf *lack)
        shm_free_unsafe(lack);
 }
 
+int uac_evrt_local_ack_sent(sip_msg_t *rpl)
+{
+       int route_no;
+       run_act_ctx_t ctx;
+       int rtb;
+       str tm_evcb_local_ack_sent = str_init("ksr_tm_local_ack_sent");
+       str evname = str_init("tm:local-ack-sent");
+       sr_kemi_eng_t *keng = NULL;
+
+       route_no = route_lookup(&event_rt, "tm:local-ack-sent");
+       if(route_no >= 0) {
+               if(event_rt.rlist[route_no] == 0) {
+                       LM_WARN("event_route[tm:local-ack-sent] is empty\n");
+                       return -1;
+               }
+       } else {
+               keng = sr_kemi_eng_get();
+               if(keng != NULL) {
+                       LM_DBG("event route not defined and no kemi engine\n");
+                       return -2;
+               }
+       }
+
+       rtb = get_route_type();
+       set_route_type(EVENT_ROUTE);
+       init_run_actions_ctx(&ctx);
+       if(route_no >= 0) {
+               run_top_route(event_rt.rlist[route_no], rpl, &ctx);
+       } else {
+               if(sr_kemi_ctx_route(keng, &ctx, rpl, EVENT_ROUTE,
+                                  &tm_evcb_local_ack_sent, &evname)
+                               < 0) {
+                       LM_ERR("error running event route kemi callback\n");
+                       return -1;
+               }
+       }
+       set_route_type(rtb);
+
+       return 0;
+}
+
 /**
  * @return:
  *     0: success
@@ -1034,6 +1075,7 @@ int ack_local_uac(struct cell *trans, str *hdrs, str 
*body)
                                TMCB_LOCAL_F, 0 /* branch */, TYPE_LOCAL_ACK);
                run_trans_callbacks_off_params(
                                TMCB_REQUEST_SENT, trans, &onsend_params);
+               uac_evrt_local_ack_sent(trans->uac[0].reply);
        }
 
        ret = 0;

_______________________________________________
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