Browse code

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

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