Browse code

tm: set T before entering local-request route

Andrei Pelinescu-Onciul authored on 23/09/2009 18:59:40
Showing 1 changed files
... ...
@@ -86,6 +86,7 @@
86 86
 #include "../../receive.h"
87 87
 #include "../../route.h"
88 88
 #include "../../action.h"
89
+#include "t_lookup.h"
89 90
 #endif
90 91
 
91 92
 #define FROM_TAG_LEN (MD5_LEN + 1 /* - */ + CRC16_LEN) /* length of FROM tags */
... ...
@@ -205,6 +206,9 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
205 206
 #endif
206 207
 	long nhtype;
207 208
 #ifdef WITH_EVENT_LOCAL_REQUEST
209
+	struct cell *backup_t;
210
+	int backup_branch;
211
+	unsigned int backup_msgid;
208 212
 	static struct sip_msg lreq;
209 213
 	char *buf1;
210 214
 	int buf_len1;
... ...
@@ -353,7 +357,17 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
353 357
 				/* run the route */
354 358
 				backup_route_type = get_route_type();
355 359
 				set_route_type(LOCAL_ROUTE);
360
+				/* set T to the current transaction */
361
+				backup_t=get_t();
362
+				backup_branch=get_t_branch();
363
+				backup_msgid=global_msg_id;
364
+				/* fake transaction and message id */
365
+				global_msg_id=lreq.id;
366
+				set_t(new_cell, T_BR_UNDEFINED);
356 367
 				run_top_route(event_rt.rlist[goto_on_local_req], &lreq, 0);
368
+				/* restore original environment */
369
+				set_t(backup_t, backup_branch);
370
+				global_msg_id=backup_msgid;
357 371
 				set_route_type( backup_route_type );
358 372
 
359 373
 				/* restore original environment */