[sr-dev] git:master:2067f110: tm: add function t_continue_skip_timer to enable skipping of timer checks

Daniel-Constantin Mierla miconda at gmail.com
Thu Apr 21 15:29:41 CEST 2022


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

Author: Kristiyan Peychev <kristiyan.peychev at flolive.net>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-04-21T15:29:37+02:00

tm: add function t_continue_skip_timer to enable skipping of timer checks

This is done because third party registration requests would be skipped because
t_continue would get called on the transaction _way_ before the timer timeout.
All this resulted in the correct route not being called.

---

Modified: src/modules/tm/t_lookup.c
Modified: src/modules/tm/t_suspend.c
Modified: src/modules/tm/t_suspend.h
Modified: src/modules/tm/tm_load.c
Modified: src/modules/tm/tm_load.h

---

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

---

diff --git a/src/modules/tm/t_lookup.c b/src/modules/tm/t_lookup.c
index b90672b3e4..f041116bb8 100644
--- a/src/modules/tm/t_lookup.c
+++ b/src/modules/tm/t_lookup.c
@@ -1587,7 +1587,7 @@ int t_get_canceled_ident(struct sip_msg* msg, unsigned int* hash_index,
  *                0).
  * @param hash_index - searched transaction hash_index (part of the ident).
  * @param label - searched transaction label (part of the ident).
- * @param filter - if 1, skip transaction put on-wait (terminated state).
+ * @param filter - if 1, filter out transactions put on-wait (terminated state).
  * @return -1 on error/not found, 1 on success (found)
  * Side-effects: sets T and T_branch (T_branch always to T_BR_UNDEFINED).
  */
diff --git a/src/modules/tm/t_suspend.c b/src/modules/tm/t_suspend.c
index bae9747282..f0255d6647 100644
--- a/src/modules/tm/t_suspend.c
+++ b/src/modules/tm/t_suspend.c
@@ -163,8 +163,8 @@ int t_suspend(struct sip_msg *msg,
  * 	0  - success
  * 	<0 - failure
  */
-int t_continue_helper(unsigned int hash_index, unsigned int label,
-		struct action *rtact, str *cbname, str *cbparam)
+static int t_continue_helper(unsigned int hash_index, unsigned int label,
+		struct action *rtact, str *cbname, str *cbparam, int skip_timer)
 {
 	tm_cell_t *t;
 	tm_cell_t *backup_T = T_UNDEFINED;
@@ -192,7 +192,7 @@ int t_continue_helper(unsigned int hash_index, unsigned int label,
 	backup_T = get_t();
 	backup_T_branch = get_t_branch();
 
-	if (t_lookup_ident_filter(&t, hash_index, label, 1) < 0) {
+	if (t_lookup_ident_filter(&t, hash_index, label, skip_timer) < 0) {
 		set_t(backup_T, backup_T_branch);
 		LM_WARN("active transaction not found\n");
 		return -1;
@@ -592,13 +592,18 @@ int t_continue_helper(unsigned int hash_index, unsigned int label,
 int t_continue(unsigned int hash_index, unsigned int label,
 		struct action *route)
 {
-	return t_continue_helper(hash_index, label, route, NULL, NULL);
+	return t_continue_helper(hash_index, label, route, NULL, NULL, 1);
+}
+int t_continue_skip_timer(unsigned int hash_index, unsigned int label,
+		struct action *route)
+{
+	return t_continue_helper(hash_index, label, route, NULL, NULL, 0);
 }
 
 int t_continue_cb(unsigned int hash_index, unsigned int label,
 		str *cbname, str *cbparam)
 {
-	return t_continue_helper(hash_index, label, NULL, cbname, cbparam);
+	return t_continue_helper(hash_index, label, NULL, cbname, cbparam, 0);
 }
 
 /* Revoke the suspension of the SIP request, i.e.
diff --git a/src/modules/tm/t_suspend.h b/src/modules/tm/t_suspend.h
index fcbe182ad1..07c4e7bc37 100644
--- a/src/modules/tm/t_suspend.h
+++ b/src/modules/tm/t_suspend.h
@@ -29,6 +29,8 @@ typedef int (*t_suspend_f)(struct sip_msg *msg,
 
 int t_continue(unsigned int hash_index, unsigned int label,
 		struct action *route);
+int t_continue_skip_timer(unsigned int hash_index, unsigned int label,
+		struct action *route);
 typedef int (*t_continue_f)(unsigned int hash_index, unsigned int label,
 		struct action *route);
 
diff --git a/src/modules/tm/tm_load.c b/src/modules/tm/tm_load.c
index 911be5d917..65515a3a28 100644
--- a/src/modules/tm/tm_load.c
+++ b/src/modules/tm/tm_load.c
@@ -115,6 +115,7 @@ int load_tm( struct tm_binds *tmb)
 	tmb->t_get_canceled_ident = t_get_canceled_ident;
 	tmb->t_suspend = t_suspend;
 	tmb->t_continue = t_continue;
+	tmb->t_continue_skip_timer = t_continue_skip_timer;
 	tmb->t_continue_cb = t_continue_cb;
 	tmb->t_cancel_suspend = t_cancel_suspend;
 	tmb->t_get_reply_totag = t_get_reply_totag;
diff --git a/src/modules/tm/tm_load.h b/src/modules/tm/tm_load.h
index a0f3afde00..8190ee977c 100644
--- a/src/modules/tm/tm_load.h
+++ b/src/modules/tm/tm_load.h
@@ -95,6 +95,7 @@ struct tm_binds {
 	t_get_canceled_ident_f    t_get_canceled_ident;
 	t_suspend_f	t_suspend;
 	t_continue_f	t_continue;
+	t_continue_f	t_continue_skip_timer;
 	t_continue_cb_f	t_continue_cb;
 	t_cancel_suspend_f	t_cancel_suspend;
 	tget_reply_totag_f t_get_reply_totag;




More information about the sr-dev mailing list