Browse code

tmx(k): core & tm onreply route support

- support for core onreply route (like for tm onreply route, but
with extra t_unref).
- use get_route_type() instead of directly accessing route_type.

Andrei Pelinescu-Onciul authored on 22/02/2010 18:41:33
Showing 1 changed files
... ...
@@ -404,12 +404,18 @@ int pv_get_tm_reply_code(struct sip_msg *msg, pv_param_t *param,
404 404
 		/* no T */
405 405
 		code = 0;
406 406
 	} else {
407
-		switch (route_type) {
407
+		switch (get_route_type()) {
408 408
 			case REQUEST_ROUTE:
409 409
 				/* use the status of the last sent reply */
410 410
 				code = t->uas.status;
411 411
 				break;
412
-			case ONREPLY_ROUTE:
412
+			case CORE_ONREPLY_ROUTE:
413
+				/*  t_check() above has the side effect of setting T and
414
+				    REFerencing T => we must unref and unset it for the 
415
+				    main/core onreply_route. */
416
+				_tmx_tmb.t_unref(msg);
417
+				/* no break */
418
+			case TM_ONREPLY_ROUTE:
413 419
 				/* use the status of the current reply */
414 420
 				code = msg->first_line.u.reply.statuscode;
415 421
 				break;
... ...
@@ -424,7 +430,7 @@ int pv_get_tm_reply_code(struct sip_msg *msg, pv_param_t *param,
424 424
 				}
425 425
 				break;
426 426
 			default:
427
-				LM_ERR("unsupported route_type %d\n", route_type);
427
+				LM_ERR("unsupported route_type %d\n", get_route_type());
428 428
 				code = 0;
429 429
 		}
430 430
 	}