[sr-dev] git:tmp/build_request: tm: local req. route rcv init fix

Andrei Pelinescu-Onciul andrei at iptel.org
Tue Jul 21 12:01:44 CEST 2009


Module: sip-router
Branch: tmp/build_request
Commit: ef6fed5b07e4f199974e2236d1f44526d487559c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ef6fed5b07e4f199974e2236d1f44526d487559c

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Tue Jul 21 11:10:48 2009 +0200

tm: local req. route rcv init fix

- dialog->send_sock can be null and should not be used (switched
  to dst.send_sock which is guaranteed to be non-null at that
  point)

- initialize also the other members of the msg rcv structure:
  dst_ip, dst_port, src_su, bind_address and dst.comp.
  Note: the rcv structure is initialized as if the message
  originated from the dst.send_sock, so in the script src_ip &
  friends will be the send ip. This is different from on_send
  route, were src_ip is the original forwarded message source and
  snd_ip is the send ip.

---

 modules/tm/uac.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/modules/tm/uac.c b/modules/tm/uac.c
index 0a238bd..4e46489 100644
--- a/modules/tm/uac.c
+++ b/modules/tm/uac.c
@@ -336,9 +336,16 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
 				free_sip_msg(&lreq);
 			} else {
 				lreq.force_send_socket = uac_r->dialog->send_sock;
-				lreq.rcv.proto = uac_r->dialog->send_sock->proto;
-				lreq.rcv.src_ip = uac_r->dialog->send_sock->address;
-				lreq.rcv.src_port = uac_r->dialog->send_sock->port_no;
+				lreq.rcv.proto = dst.send_sock->proto;
+				lreq.rcv.src_ip = dst.send_sock->address;
+				lreq.rcv.src_port = dst.send_sock->port_no;
+				lreq.rcv.dst_port = su_getport(&dst.to);
+				su2ip_addr(&lreq.rcv.dst_ip, &dst.to);
+				lreq.rcv.src_su=dst.send_sock->su;
+				lreq.rcv.bind_address=dst.send_sock;
+			#ifdef USE_COMP
+				lreq.rcv.comp=dst.comp;
+			#endif /* USE_COMP */
 				/* backup environment (e.g., AVP lists, ...) */
 				backup_uri_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI,
 					&new_cell->uri_avps_from);




More information about the sr-dev mailing list