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 247
 		}
248 248
 		dns_srv_handle_put(&dns_h); /* not needed anymore */
249 249
 	}else{
250
-		if ((uri2dst(0, &dst, 0, uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
250
+		if ((uri2dst2(0, &dst, uac_r->dialog->send_sock,
251
+						uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
251 252
 				(dst.send_sock==0)){
252 253
 			ser_error = E_NO_SOCKET;
253 254
 			ret=ser_error;
... ...
@@ -255,15 +258,16 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
255 255
 			goto error2;
256 256
 		}
257 257
 	}
258
-#else
259
-	if ((uri2dst(&dst, 0, uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
258
+#else /* USE_DNS_FAILOVER */
259
+	if ((uri2dst2(&dst, uac_r->dialog->send_sock,
260
+					uac_r->dialog->hooks.next_hop, PROTO_NONE)==0) ||
260 261
 			(dst.send_sock==0)){
261 262
 		ser_error = E_NO_SOCKET;
262 263
 		ret=ser_error;
263 264
 		LOG(L_ERR, "t_uac: no socket found\n");
264 265
 		goto error2;
265 266
 	}
266
-#endif
267
+#endif /* USE_DNS_FAILOVER */
267 268
 
268 269
 	new_cell = build_cell(0); 
269 270
 	if (!new_cell) {