Module: kamailio Branch: master Commit: 569b536404afd855742a42320d7c858a8bb4952b URL: https://github.com/kamailio/kamailio/commit/569b536404afd855742a42320d7c858a...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2024-01-22T14:11:29+01:00
tm: 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 failure
---
Modified: src/modules/tm/t_reply.c Modified: src/modules/tm/tm.c
---
Diff: https://github.com/kamailio/kamailio/commit/569b536404afd855742a42320d7c858a... Patch: https://github.com/kamailio/kamailio/commit/569b536404afd855742a42320d7c858a...
---
diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c index f52ecc7d3ad..e012dc29c28 100644 --- a/src/modules/tm/t_reply.c +++ b/src/modules/tm/t_reply.c @@ -640,6 +640,11 @@ static int _reply_light(struct cell *trans, char *buf, unsigned int len, * (timer_allow_del()) (there's no chance of having the wait handler * executed while we still need t) --andrei */ put_on_wait(trans); + + /* mark the request with final reply flag */ + if(trans->uas.request != NULL) { + trans->uas.request->msg_flags |= FL_FINAL_REPLY; + } } pkg_free(buf); LM_DBG("finished\n"); diff --git a/src/modules/tm/tm.c b/src/modules/tm/tm.c index 0be958a0848..0147bf44579 100644 --- a/src/modules/tm/tm.c +++ b/src/modules/tm/tm.c @@ -1608,6 +1608,11 @@ int ki_t_reply_error(sip_msg_t *msg) int sip_err; int ret;
+ 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_err, err_buffer, sizeof(err_buffer), "TM"); if(ret > 0) {