Browse code

- CANCEL terminates retransmission timers properly (backported)

Jan Janak authored on 20/09/2005 09:31:40
Showing 1 changed files
... ...
@@ -308,7 +308,7 @@ error:
308 308
 void e2e_cancel( struct sip_msg *cancel_msg, 
309 309
 	struct cell *t_cancel, struct cell *t_invite )
310 310
 {
311
-	branch_bm_t cancel_bm;
311
+	branch_bm_t cancel_bm, tmp_bm;
312 312
 	int i;
313 313
 	int lowest_error;
314 314
 	str backup_uri;
... ...
@@ -335,10 +335,26 @@ void e2e_cancel( struct sip_msg *cancel_msg,
335 335
 	/* send them out */
336 336
 	for (i=0; i<t_cancel->nr_of_outgoings; i++) {
337 337
 		if (cancel_bm & (1<<i)) {
338
+			/* Provisional reply received on this branch, send CANCEL */
339
+			/* No need to stop timers as they have already been stopped by the reply */
338 340
 			if (SEND_BUFFER( &t_cancel->uac[i].request)==-1) {
339 341
 				LOG(L_ERR, "ERROR: e2e_cancel: send failed\n");
340 342
 			}
341 343
 			start_retr( &t_cancel->uac[i].request );
344
+		} else {
345
+			if (t_invite->uac[i].last_received < 100) {
346
+				     /* No provisional response received, stop
347
+				      * retransmission timers
348
+				      */
349
+				reset_timer(&t_invite->uac[i].request.retr_timer);
350
+				reset_timer(&t_invite->uac[i].request.fr_timer);
351
+
352
+				/* Generate faked reply */
353
+				LOCK_REPLIES(t_invite);
354
+				if (relay_reply(t_invite, FAKED_REPLY, i, 487, &tmp_bm) == RPS_ERROR) {
355
+					lowest_error = -1;
356
+				}
357
+			}
342 358
 		}
343 359
 	}
344 360