Module: kamailio
Branch: master
Commit: 1a2477ba348928e6bdff15be765cb907e32cffc4
URL:
https://github.com/kamailio/kamailio/commit/1a2477ba348928e6bdff15be765cb90…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-01-22T14:02:47+01:00
sl: mark request with final reply flag
- send error function checks flag and returns if set to avoid sending
more than one final reply in case of failures
---
Modified: src/modules/sl/sl.c
Modified: src/modules/sl/sl_funcs.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1a2477ba348928e6bdff15be765cb90…
Patch:
https://github.com/kamailio/kamailio/commit/1a2477ba348928e6bdff15be765cb90…
---
diff --git a/src/modules/sl/sl.c b/src/modules/sl/sl.c
index 2a8f49fe78c..83eb8bac0d3 100644
--- a/src/modules/sl/sl.c
+++ b/src/modules/sl/sl.c
@@ -335,6 +335,12 @@ static int w_send_reply(struct sip_msg *msg, char *p1, char *p2)
static int ki_send_reply_error(sip_msg_t *msg)
{
int ret;
+
+ if(msg->msg_flags & FL_FINAL_REPLY) {
+ LM_INFO("message marked with final-reply flag\n");
+ return -2;
+ }
+
if(sl_bind_tm != 0 && tmb.t_reply_error != NULL) {
ret = tmb.t_reply_error(msg);
if(ret > 0) {
diff --git a/src/modules/sl/sl_funcs.c b/src/modules/sl/sl_funcs.c
index 253686a4a77..29ef6835e22 100644
--- a/src/modules/sl/sl_funcs.c
+++ b/src/modules/sl/sl_funcs.c
@@ -337,6 +337,10 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str
*tag)
goto error;
}
+ if(code >= 200) {
+ msg->msg_flags |= FL_FINAL_REPLY;
+ }
+
update_sl_stats(code);
return 1;
@@ -408,6 +412,11 @@ int sl_reply_error(struct sip_msg *msg)
return -2;
}
+ if(msg->msg_flags & FL_FINAL_REPLY) {
+ LM_INFO("message marked with final-reply flag\n");
+ return -2;
+ }
+
ret = err2reason_phrase(
prev_ser_error, &sip_error, err_buf, sizeof(err_buf), "SL");
if(ret > 0) {