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

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2026-05-19T08:42:15+02:00

core: events - detect drop used inside event_route[core:receive-parse-error]

---

Modified: src/core/events.c
Modified: src/core/events.h

---

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

---

diff --git a/src/core/events.c b/src/core/events.c
index 11d54aba710..c4c6561a4be 100644
--- a/src/core/events.c
+++ b/src/core/events.c
@@ -48,7 +48,7 @@ void sr_core_ert_init(void)
        /* 0 - is not a valid index in event_route blocks list */
        _sr_core_ert_list.init_parse_error =
                        route_get(&event_rt, "core:receive-parse-error");
-       if(_sr_core_ert_list.init_parse_error <= 0
+       if(_sr_core_ert_list.init_parse_error < 0
                        || event_rt.rlist[_sr_core_ert_list.init_parse_error] 
== NULL) {
                _sr_core_ert_list.init_parse_error = -1;
        } else {
@@ -59,23 +59,29 @@ void sr_core_ert_init(void)
 /**
  *
  */
-void sr_core_ert_run(sip_msg_t *msg, int e)
+int sr_core_ert_run(sip_msg_t *msg, int e)
 {
        struct run_act_ctx ctx;
        int rtb;
 
        switch(e) {
                case SR_CORE_ERT_RECEIVE_PARSE_ERROR:
-                       if(likely(_sr_core_ert_list.init_parse_error <= 0))
-                               return;
+                       if(likely(_sr_core_ert_list.init_parse_error < 0)) {
+                               /* no event route defined */
+                               return 0;
+                       }
                        rtb = get_route_type();
                        set_route_type(REQUEST_ROUTE);
                        init_run_actions_ctx(&ctx);
                        
run_top_route(event_rt.rlist[_sr_core_ert_list.init_parse_error],
                                        msg, &ctx);
                        set_route_type(rtb);
+                       if(ctx.run_flags & DROP_R_F) {
+                               return -1;
+                       }
                        break;
        }
+       return 0;
 }
 
 /**
diff --git a/src/core/events.h b/src/core/events.h
index f5b596a5fc8..d5fa5335277 100644
--- a/src/core/events.h
+++ b/src/core/events.h
@@ -90,7 +90,7 @@ int sr_event_enabled(int type);
 #define SR_CORE_ERT_RECEIVE_PARSE_ERROR 1
 
 void sr_core_ert_init(void);
-void sr_core_ert_run(sip_msg_t *msg, int e);
+int sr_core_ert_run(sip_msg_t *msg, int e);
 int sr_core_ert_run_xname(char *evname);
 
 typedef void (*sr_corecb_void_f)(void);

_______________________________________________
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