فهرست منبع

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.
Kristiyan Peychev 3 سال پیش
والد
کامیت
2067f11033
5فایلهای تغییر یافته به همراه15 افزوده شده و 6 حذف شده
  1. 1 1
      src/modules/tm/t_lookup.c
  2. 10 5
      src/modules/tm/t_suspend.c
  3. 2 0
      src/modules/tm/t_suspend.h
  4. 1 0
      src/modules/tm/tm_load.c
  5. 1 0
      src/modules/tm/tm_load.h

+ 1 - 1
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).
  */

+ 10 - 5
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 @@ kill_trans:
 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.

+ 2 - 0
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);
 

+ 1 - 0
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;

+ 1 - 0
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;