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 469
 	set_t(backup_t);
470 470
 	global_msg_id=backup_msgid;
471 471
 	rmode=backup_mode;
472
+	/* if failure handler changed flag, update transaction context */
473
+	shmem_msg->flags=fake->flags;
472 474
 	return 0;
473 475
 }
474 476
 
... ...
@@ -476,12 +480,19 @@ restore:
476 476
 int failure_route(struct cell *t)
477 477
 {
478 478
 	struct sip_msg faked_msg;
479
+	struct sip_msg *orig_request;
479 480
 
480 481
 	/* don't do anything if we don't have to */
481 482
 	if (!t->on_negative) return 0;
483
+	orig_request=t->uas.request;
484
+	/* failure_route for a local UAC? */
485
+	if (!orig_request) {
486
+		LOG(L_WARN, "Warning: failure_route: no UAC support\n");
487
+		return 0;
488
+	}
482 489
 
483 490
 	/* if fake message creation failes, return error too */
484
-	if (!faked_env(&faked_msg, t, t->uas.request, 0 /* create fake */ )) {
491
+	if (!faked_env(&faked_msg, t, orig_request, 0 /* create fake */ )) {
485 492
 		LOG(L_ERR, "ERROR: on_negative_reply: faked_env failed\n");
486 493
 		return 0;
487 494
 	}
... ...
@@ -495,7 +506,7 @@ int failure_route(struct cell *t)
495 495
 		LOG(L_ERR, "ERROR: on_negative_reply: "
496 496
 			"Error in do_action\n");
497 497
 	/* restore original environment */
498
-	faked_env(&faked_msg, 0, 0, 1 );
498
+	faked_env(&faked_msg, 0, orig_request, 1 );
499 499
 	return 1;
500 500
 }
501 501
 
... ...
@@ -1109,8 +1120,12 @@ int reply_received( struct sip_msg  *p_msg )
1109 1109
 	/* processing of on_reply block */
1110 1110
 	if (t->on_reply) {
1111 1111
 		rmode=MODE_ONREPLY;
1112
+		/* transfer transaction flag to message context */
1113
+		if (t->uas.request) p_msg->flags=t->uas.request->flags;
1112 1114
 	 	if (run_actions(onreply_rlist[t->on_reply], p_msg)<0) 
1113 1115
 			LOG(L_ERR, "ERROR: on_reply processing failed\n");
1116
+		/* transfer current message context back to t */
1117
+		if (t->uas.request) t->uas.request->flags=p_msg->flags;
1114 1118
 	}
1115 1119
 	LOCK_REPLIES( t );
1116 1120
 	if (t->local) {