[sr-dev] git:master: tm: dialog send_socket support

Andrei Pelinescu-Onciul andrei at iptel.org
Wed Jul 22 16:50:47 CEST 2009


Module: sip-router
Branch: master
Commit: 934de3e13e2d37ef7d820fbba80264de7cb1fd9e
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=934de3e13e2d37ef7d820fbba80264de7cb1fd9e

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Tue Jul 21 01:18:38 2009 +0200

tm: dialog send_socket support

t_uac()/t_uac_prepare() use now the dialog->send_sock if set
(fixes rpc t_uac_* and mi_t_uac_dlg not obeying the send socket
parameter).

---

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

diff --git a/modules/tm/uac.c b/modules/tm/uac.c
index ddd36b7..e070cd5 100644
--- a/modules/tm/uac.c
+++ b/modules/tm/uac.c
@@ -233,11 +233,13 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
 
 	DBG("DEBUG:tm:t_uac: next_hop=<%.*s>\n",uac_r->dialog->hooks.next_hop->len,
 			uac_r->dialog->hooks.next_hop->s);
-	/* it's a new message, so we will take the default socket */
+	/* new message => take the dialog send_socket if set, or the default
+	  send_socket if not*/
 #ifdef USE_DNS_FAILOVER
 	if (cfg_get(core, core_cfg, use_dns_failover)){
 		dns_srv_handle_init(&dns_h);
-		if ((uri2dst(&dns_h, &dst, 0, uac_r->dialog->hooks.next_hop, PROTO_NONE)==0)
+		if ((uri2dst2(&dns_h, &dst, uac_r->dialog->send_sock,
+							uac_r->dialog->hooks.next_hop, PROTO_NONE)==0)
 				|| (dst.send_sock==0)){
 			dns_srv_handle_put(&dns_h);
 			ser_error = E_NO_SOCKET;
@@ -247,7 +249,8 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
 		}
 		dns_srv_handle_put(&dns_h); /* not needed anymore */
 	}else{
-		if ((uri2dst(0, &dst, 0, uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
+		if ((uri2dst2(0, &dst, uac_r->dialog->send_sock,
+						uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
 				(dst.send_sock==0)){
 			ser_error = E_NO_SOCKET;
 			ret=ser_error;
@@ -255,15 +258,16 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
 			goto error2;
 		}
 	}
-#else
-	if ((uri2dst(&dst, 0, uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
+#else /* USE_DNS_FAILOVER */
+	if ((uri2dst2(&dst, uac_r->dialog->send_sock,
+					uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
 			(dst.send_sock==0)){
 		ser_error = E_NO_SOCKET;
 		ret=ser_error;
 		LOG(L_ERR, "t_uac: no socket found\n");
 		goto error2;
 	}
-#endif
+#endif /* USE_DNS_FAILOVER */
 
 	new_cell = build_cell(0); 
 	if (!new_cell) {




More information about the sr-dev mailing list