Browse code

flag status fixed to be transfered from reply/failure handlers to transaction context

Jiri Kuthan authored on 05/11/2003 21:36:40
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
 
... ...
@@ -480,6 +482,8 @@ restore:
480 482
 	set_t(backup_t);
481 483
 	global_msg_id=backup_msgid;
482 484
 	rmode=backup_mode;
485
+	/* if failure handler changed flag, update transaction context */
486
+	shmem_msg->flags=fake->flags;
483 487
 	return 0;
484 488
 }
485 489
 
... ...
@@ -487,12 +491,19 @@ restore:
487 491
 int failure_route(struct cell *t)
488 492
 {
489 493
 	struct sip_msg faked_msg;
494
+	struct sip_msg *orig_request;
490 495
 
491 496
 	/* don't do anything if we don't have to */
492 497
 	if (!t->on_negative) return 0;
498
+	orig_request=t->uas.request;
499
+	/* failure_route for a local UAC? */
500
+	if (!orig_request) {
501
+		LOG(L_WARN, "Warning: failure_route: no UAC support\n");
502
+		return 0;
503
+	}
493 504
 
494 505
 	/* if fake message creation failes, return error too */
495
-	if (!faked_env(&faked_msg, t, t->uas.request, 0 /* create fake */ )) {
506
+	if (!faked_env(&faked_msg, t, orig_request, 0 /* create fake */ )) {
496 507
 		LOG(L_ERR, "ERROR: on_negative_reply: faked_env failed\n");
497 508
 		return 0;
498 509
 	}
... ...
@@ -506,7 +517,7 @@ int failure_route(struct cell *t)
506 517
 		LOG(L_ERR, "ERROR: on_negative_reply: "
507 518
 			"Error in do_action\n");
508 519
 	/* restore original environment */
509
-	faked_env(&faked_msg, 0, 0, 1 );
520
+	faked_env(&faked_msg, 0, orig_request, 1 );
510 521
 	return 1;
511 522
 }
512 523
 
... ...
@@ -1120,8 +1131,12 @@ int reply_received( struct sip_msg  *p_msg )
1120 1131
 	/* processing of on_reply block */
1121 1132
 	if (t->on_reply) {
1122 1133
 		rmode=MODE_ONREPLY;
1134
+		/* transfer transaction flag to message context */
1135
+		if (t->uas.request) p_msg->flags=t->uas.request->flags;
1123 1136
 	 	if (run_actions(onreply_rlist[t->on_reply], p_msg)<0) 
1124 1137
 			LOG(L_ERR, "ERROR: on_reply processing failed\n");
1138
+		/* transfer current message context back to t */
1139
+		if (t->uas.request) t->uas.request->flags=p_msg->flags;
1125 1140
 	}
1126 1141
 	LOCK_REPLIES( t );
1127 1142
 	if (t->local) {