Ver Fonte

local 200/INVITE retransmitted now regardless of transport

Jiri Kuthan há 22 anos atrás
pai
commit
1bc818db69
4 ficheiros alterados com 47 adições e 11 exclusões
  1. 6 3
      modules/tm/t_funcs.c
  2. 23 0
      modules/tm/t_funcs.h
  3. 18 7
      modules/tm/t_reply.c
  4. 0 1
      modules/tm/timer.h

+ 6 - 3
modules/tm/t_funcs.c

@@ -29,11 +29,12 @@
 /*
  * History:
  * -------
- *  2003-03-01  start_retr changed to retransmit only for UDP
- *  2003-02-13  modified send_pr_buffer to use msg_send & rb->dst (andrei)
- *  2003-03-13  send_pr_buffer is called w/ file/function/line debugging
+ *  2003-03-31  200 for INVITE/UAS resent even for UDP (jiri)
  *               info only if compiling w/ -DEXTRA_DEBUG (andrei)
  *  2003-03-19  replaced all mallocs/frees w/ pkg_malloc/pkg_free (andrei)
+ *  2003-03-13  send_pr_buffer is called w/ file/function/line debugging
+ *  2003-03-01  start_retr changed to retransmit only for UDP
+ *  2003-02-13  modified send_pr_buffer to use msg_send & rb->dst (andrei)
  */
 
 
@@ -77,6 +78,7 @@ int send_pr_buffer(	struct retr_buf *rb, void *buf, int len
 	}
 }
 
+#ifdef _OBSOLETED
 void start_retr( struct retr_buf *rb )
 {
 	if (rb->dst.proto==PROTO_UDP) {
@@ -85,6 +87,7 @@ void start_retr( struct retr_buf *rb )
 	}
 	set_timer( &rb->fr_timer, FR_TIMER_LIST );
 }
+#endif
 
 
 

+ 23 - 0
modules/tm/t_funcs.h

@@ -31,6 +31,7 @@
   *               in a non-gcc specific way (andrei)
   *  2003-03-13  now send_pr_buffer will be called w/ function/line info
   *               only when compiling w/ -DEXTRA_DEBUG (andrei)
+  *  2003-03-31  200 for INVITE/UAS resent even for UDP (jiri) 
   */
 
 
@@ -106,6 +107,26 @@ int send_pr_buffer( struct retr_buf *rb, void *buf, int len);
 #define IS_REFFED_UNSAFE(_T_cell) ((_T_cell)->ref_count!=0)
 
 
+static void inline _set_fr_retr( struct retr_buf *rb, int retr )
+{
+	if (retr) {
+		rb->retr_list=RT_T1_TO_1;
+		set_timer( &rb->retr_timer, RT_T1_TO_1 );
+	}
+	set_timer(&rb->fr_timer, FR_TIMER_LIST);
+}
+
+static void inline start_retr(struct retr_buf *rb)
+{
+	_set_fr_retr(rb, rb->dst.proto==PROTO_UDP);
+}
+
+static void inline force_retr(struct retr_buf *rb)
+{
+	_set_fr_retr(rb, 1);
+}
+
+
 int   tm_startup();
 void tm_shutdown();
 
@@ -127,7 +148,9 @@ int get_ip_and_port_from_uri( str* uri , unsigned int *param_ip,
 
 void put_on_wait(  struct cell  *Trans  );
 
+#ifdef _OBSOLETED
 void start_retr( struct retr_buf *rb );
+#endif
 
 void cleanup_localcancel_timers( struct cell *t );
 

+ 18 - 7
modules/tm/t_reply.c

@@ -27,6 +27,7 @@
  *
  * History:
  * --------
+ * 2003-03-31  200 for INVITE/UAS resent even for UDP (jiri)
  * 2003-03-16  removed _TOTAG (jiri)
  * 2003-03-10  fixed new to tag bug/typo (if w/o {})  (andrei)
  * 2003-03-06  saving of to-tags for ACK/200 matching introduced, 
@@ -712,13 +713,23 @@ static int _reply( struct cell *trans, struct sip_msg* p_msg,
 
 void set_final_timer( /* struct s_table *h_table, */ struct cell *t )
 {
-	if ( !t->local 
-		&& t->uas.request->REQ_METHOD==METHOD_INVITE 
-		&& (t->uas.status>=300 || 
-				(t->relaied_reply_branch==-2 && t->uas.status>=200) )) {
-			/* crank timers for negative replies */
-			start_retr( &t->uas.response );
-	} else put_on_wait(t);
+	if ( !t->local && t->uas.request->REQ_METHOD==METHOD_INVITE ) {
+		/* crank timers for negative replies */
+		if (t->uas.status>=300) {
+			start_retr(&t->uas.response);
+			return;
+		}
+		/* local UAS retransmits too */
+		if (t->relaied_reply_branch==-2 && t->uas.status>=200) {
+			/* we retransmit 200/INVs regardless of transport --
+			   even if TCP used, UDP could be used upstream and
+			   loose the 200, which is not retransmitted by proxies
+			*/
+			force_retr( &t->uas.response );
+			return;
+		}
+	} 
+	put_on_wait(t);
 }
 
 void cleanup_uac_timers( struct cell *t )

+ 0 - 1
modules/tm/timer.h

@@ -32,7 +32,6 @@
 #include "defs.h"
 
 #include "lock.h"
-#include "t_funcs.h"
 
 /* timer timestamp value indicating a timer has been 
    deactived and shall not be executed