Browse code

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).

Andrei Pelinescu-Onciul authored on 20/07/2009 23:18:38
Showing 1 changed files
... ...
@@ -233,11 +233,13 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
233 233
 
234 234
 	DBG("DEBUG:tm:t_uac: next_hop=<%.*s>\n",uac_r->dialog->hooks.next_hop->len,
235 235
 			uac_r->dialog->hooks.next_hop->s);
236
-	/* it's a new message, so we will take the default socket */
236
+	/* new message => take the dialog send_socket if set, or the default
237
+	  send_socket if not*/
237 238
 #ifdef USE_DNS_FAILOVER
238 239
 	if (cfg_get(core, core_cfg, use_dns_failover)){
239 240
 		dns_srv_handle_init(&dns_h);
240
-		if ((uri2dst(&dns_h, &dst, 0, uac_r->dialog->hooks.next_hop, PROTO_NONE)==0)
241
+		if ((uri2dst2(&dns_h, &dst, uac_r->dialog->send_sock,
242
+							uac_r->dialog->hooks.next_hop, PROTO_NONE)==0)
241 243
 				|| (dst.send_sock==0)){
242 244
 			dns_srv_handle_put(&dns_h);
243 245
 			ser_error = E_NO_SOCKET;
... ...
@@ -247,7 +249,8 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
247 249
 		}
248 250
 		dns_srv_handle_put(&dns_h); /* not needed anymore */
249 251
 	}else{
250
-		if ((uri2dst(0, &dst, 0, uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
252
+		if ((uri2dst2(0, &dst, uac_r->dialog->send_sock,
253
+						uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
251 254
 				(dst.send_sock==0)){
252 255
 			ser_error = E_NO_SOCKET;
253 256
 			ret=ser_error;
... ...
@@ -255,15 +258,16 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
255 258
 			goto error2;
256 259
 		}
257 260
 	}
258
-#else
259
-	if ((uri2dst(&dst, 0, uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
261
+#else /* USE_DNS_FAILOVER */
262
+	if ((uri2dst2(&dst, uac_r->dialog->send_sock,
263
+					uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
260 264
 			(dst.send_sock==0)){
261 265
 		ser_error = E_NO_SOCKET;
262 266
 		ret=ser_error;
263 267
 		LOG(L_ERR, "t_uac: no socket found\n");
264 268
 		goto error2;
265 269
 	}
266
-#endif
270
+#endif /* USE_DNS_FAILOVER */
267 271
 
268 272
 	new_cell = build_cell(0); 
269 273
 	if (!new_cell) {