Module: kamailio
Branch: master
Commit: 1f5444fd2e25d227ffd70f1087d057a3b8002558
URL:
https://github.com/kamailio/kamailio/commit/1f5444fd2e25d227ffd70f1087d057a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-12-22T14:50:59+01:00
tm: make lookup event_route[tm:local-response] only once
- related to issue #3064 and PR #3687
---
Modified: src/modules/tm/t_reply.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1f5444fd2e25d227ffd70f1087d057a…
Patch:
https://github.com/kamailio/kamailio/commit/1f5444fd2e25d227ffd70f1087d057a…
---
diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c
index c5a58bba8ab..f52ecc7d3ad 100644
--- a/src/modules/tm/t_reply.c
+++ b/src/modules/tm/t_reply.c
@@ -443,7 +443,7 @@ inline static void start_final_repl_retr(struct cell *t)
}
-static int _tm_local_response_sent_lookup = 0;
+static int _tm_local_response_sent_evrt = -2;
static int _reply_light(struct cell *trans, char *buf, unsigned int len,
unsigned int code, char *to_tag, unsigned int to_tag_len, int lock,
@@ -573,9 +573,15 @@ static int _reply_light(struct cell *trans, char *buf, unsigned int
len,
}
rt = -1;
if(likely(keng == NULL)) {
- if(_tm_local_response_sent_lookup == 0) {
+ if(_tm_local_response_sent_evrt == -2) {
rt = route_lookup(&event_rt, "tm:local-response");
- _tm_local_response_sent_lookup = 1;
+ if(rt < 0) {
+ _tm_local_response_sent_evrt = -1;
+ } else {
+ _tm_local_response_sent_evrt = rt;
+ }
+ } else {
+ rt = _tm_local_response_sent_evrt;
}
}
if((rt >= 0 && event_rt.rlist[rt] != NULL) || (keng != NULL)