Browse code

modules/tm: Filled in the $snd() structure for event_route[tm:local-request]

Peter Dunkley authored on 06/03/2012 18:10:13
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 "../../onsend.h"
89 90
 #include "t_lookup.h"
90 91
 #endif
91 92
 
... ...
@@ -349,6 +350,8 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
349 350
 				LM_ERR("failed to set dst_uri");
350 351
 				free_sip_msg(&lreq);
351 352
 			} else {
353
+				struct onsend_info onsnd_info;
354
+
352 355
 				lreq.force_send_socket = uac_r->dialog->send_sock;
353 356
 				lreq.rcv.proto = dst.send_sock->proto;
354 357
 				lreq.rcv.src_ip = dst.send_sock->address;
... ...
@@ -363,6 +366,12 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
363 366
 				sflag_bk = getsflags();
364 367
 				tm_xdata_swap(new_cell, &backup_xd, 0);
365 368
 
369
+				onsnd_info.to=&dst.to;
370
+				onsnd_info.send_sock=dst.send_sock;
371
+				onsnd_info.buf=buf;
372
+				onsnd_info.len=buf_len;
373
+				p_onsend=&onsnd_info;
374
+
366 375
 				/* run the route */
367 376
 				backup_route_type = get_route_type();
368 377
 				set_route_type(LOCAL_ROUTE);
... ...
@@ -378,6 +387,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
378 387
 				set_t(backup_t, backup_branch);
379 388
 				global_msg_id=backup_msgid;
380 389
 				set_route_type( backup_route_type );
390
+				p_onsend=0;
381 391
 
382 392
 				/* restore original environment */
383 393
 				tm_xdata_swap(new_cell, &backup_xd, 1);