Browse code

- tm t_reply.c: flag status fixed to be transfered from reply/failure backported from HEAD

Andrei Pelinescu-Onciul authored on 13/11/2003 20:20:29
Showing 1 changed files
... ...
@@ -49,6 +49,8 @@
49 49
  *  2003-09-11  t_reply_with_body() reshaped to use reply_lumps +
50 50
  *              build_res_buf_from_sip_req() instead of
51 51
  *              build_res_buf_with_body_from_sip_req() (bogdan)
52
+ *  2003-11-05  flag context updated from failure/reply handlers back
53
+ *              to transaction context (jiri)
52 54
  */
53 55
 
54 56
 
... ...
@@ -469,6 +471,8 @@ restore:
469 471
 	set_t(backup_t);
470 472
 	global_msg_id=backup_msgid;
471 473
 	rmode=backup_mode;
474
+	/* if failure handler changed flag, update transaction context */
475
+	shmem_msg->flags=fake->flags;
472 476
 	return 0;
473 477
 }
474 478
 
... ...
@@ -476,12 +480,19 @@ restore:
476 480
 int failure_route(struct cell *t)
477 481
 {
478 482
 	struct sip_msg faked_msg;
483
+	struct sip_msg *orig_request;
479 484
 
480 485
 	/* don't do anything if we don't have to */
481 486
 	if (!t->on_negative) return 0;
487
+	orig_request=t->uas.request;
488
+	/* failure_route for a local UAC? */
489
+	if (!orig_request) {
490
+		LOG(L_WARN, "Warning: failure_route: no UAC support\n");
491
+		return 0;
492
+	}
482 493
 
483 494
 	/* if fake message creation failes, return error too */
484
-	if (!faked_env(&faked_msg, t, t->uas.request, 0 /* create fake */ )) {
495
+	if (!faked_env(&faked_msg, t, orig_request, 0 /* create fake */ )) {
485 496
 		LOG(L_ERR, "ERROR: on_negative_reply: faked_env failed\n");
486 497
 		return 0;
487 498
 	}
... ...
@@ -495,7 +506,7 @@ int failure_route(struct cell *t)
495 506
 		LOG(L_ERR, "ERROR: on_negative_reply: "
496 507
 			"Error in do_action\n");
497 508
 	/* restore original environment */
498
-	faked_env(&faked_msg, 0, 0, 1 );
509
+	faked_env(&faked_msg, 0, orig_request, 1 );
499 510
 	return 1;
500 511
 }
501 512
 
... ...
@@ -1109,8 +1120,12 @@ int reply_received( struct sip_msg  *p_msg )
1109 1120
 	/* processing of on_reply block */
1110 1121
 	if (t->on_reply) {
1111 1122
 		rmode=MODE_ONREPLY;
1123
+		/* transfer transaction flag to message context */
1124
+		if (t->uas.request) p_msg->flags=t->uas.request->flags;
1112 1125
 	 	if (run_actions(onreply_rlist[t->on_reply], p_msg)<0) 
1113 1126
 			LOG(L_ERR, "ERROR: on_reply processing failed\n");
1127
+		/* transfer current message context back to t */
1128
+		if (t->uas.request) t->uas.request->flags=p_msg->flags;
1114 1129
 	}
1115 1130
 	LOCK_REPLIES( t );
1116 1131
 	if (t->local) {