Hi, let me explain first how things do work, and then we can see how to change 
:) - I agree that things may be simpler (for user understanding/usage) and may 
be improved.

So, right now the outgoing protocol is determined based on next hop URI and the 
set network socket. What @oteren said is correct - the "transport=TCP" does not 
have anything to do with the received proto, but it indicates the proto to be 
used to reach that URI (so it is not about the inbound proto, but about 
outbound proto).
OpenSIPS looks for the "transport" param in target URI to see if there is any 
special protocol requested for the next hop URI. This is correlated withe the 
protocol from the requested net socket (via force_send_socket) -> if they 
conflict, the proto URI has priority; if one in NONE, the other one will win.
No proto explicitly requested -> UDP will be used.
So, the outbound protocol can be right now controlled via the transport URI 
param (this actually makes that protocol a must and gives no fallback 
posibility) or via the used netowork interface ( you can do 
force_send_socket("tcp:.....") - if the URI does not forces another proto, the 
socket proto will be used). I would say this force_send_socket() is closest to 
what you need (setting a preferred transport proto without messing with the sip 
message), but has no fallback to another proto.

Maybe adding a new function like set_preferred_proto(tcp, tls) - this will set 
the outbound protocol if none is forced by the target URI (via the transport 
param). It will allow you to change the default (which now is hardcoded to UDP) 
and to have a fallback. If TCP is not available, TLS will be used (like in your 
case when the DNS based proto selection did not return anything usable).

Looking forward for input and comments :)

Regards,
Bogdan
 

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/420#issuecomment-77351332
_______________________________________________
Devel mailing list
Devel@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel

Reply via email to