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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-07-23T19:41:25+02:00

sipdump: made the received info available via the faked message in event route

---

Modified: src/modules/topos/topos_mod.c

---

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

---

diff --git a/src/modules/topos/topos_mod.c b/src/modules/topos/topos_mod.c
index 1af28fb8100..6d1bb65d02c 100644
--- a/src/modules/topos/topos_mod.c
+++ b/src/modules/topos/topos_mod.c
@@ -687,12 +687,13 @@ int tps_get_branch_expire(void)
 static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp,
                int evtype, int evidx, str *evname)
 {
-       struct sip_msg *fmsg;
+       sip_msg_t *fmsg = NULL;
        struct run_act_ctx ctx;
        int rtb;
        sr_kemi_eng_t *keng = NULL;
        onsend_info_t onsnd_info = {0};
-       onsend_info_t *p_onsend_bak;
+       onsend_info_t *p_onsend_bak = 0;
+       receive_info_t fmsg_rcv_bak = {0};
 
        if(!(_tps_eventrt_mode & evtype)) {
                return 0;
@@ -717,7 +718,6 @@ static int tps_execute_event_route(sip_msg_t *msg, 
sr_event_param_t *evp,
 
        LM_DBG("executing event_route[topos:%.*s] (%d)\n", evname->len, 
evname->s,
                        evidx);
-       fmsg = faked_msg_next();
 
        if(evp->dst) {
                onsnd_info.to = &evp->dst->to;
@@ -728,6 +728,11 @@ static int tps_execute_event_route(sip_msg_t *msg, 
sr_event_param_t *evp,
                onsnd_info.len = msg->len;
                onsnd_info.msg = msg;
        } else {
+               fmsg = faked_msg_next();
+               fmsg_rcv_bak = fmsg->rcv;
+               if(evp->rcv != NULL) {
+                       fmsg->rcv = *evp->rcv;
+               }
                onsnd_info.buf = fmsg->buf;
                onsnd_info.len = fmsg->len;
                onsnd_info.msg = fmsg;
@@ -746,10 +751,17 @@ static int tps_execute_event_route(sip_msg_t *msg, 
sr_event_param_t *evp,
                                        < 0) {
                                LM_ERR("error running event route kemi 
callback\n");
                                p_onsend = p_onsend_bak;
+                               if(fmsg != NULL && evp->rcv != NULL) {
+                                       fmsg->rcv = fmsg_rcv_bak;
+                               }
                                return -1;
                        }
                }
        }
+       if(fmsg != NULL && evp->rcv != NULL) {
+               fmsg->rcv = fmsg_rcv_bak;
+       }
+
        set_route_type(rtb);
        if(ctx.run_flags & DROP_R_F) {
                LM_DBG("exit due to 'drop' in event route\n");

_______________________________________________
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