On Tue, Nov 17, 2009 at 1:03 AM, Andrei Pelinescu-Onciul andrei@iptel.org wrote:
On Nov 16, 2009 at 23:46, Juha Heinanen jh@tutpro.com wrote:
is there a flag that i can set before calling t_relay that causes t_relay not to try to create a new tcp connection to the destination if one does not already exist? this would be handy when t_relaying to registered tcp contacts.
From the script, use set_forward_no_connect() before t_relay(). If you want to do this from a module, then use: msg->fwd_send_flags |=SND_F_FORCE_CON_REUSE.
See also set_reply_no_connect(), set_forward_close() and set_reply_close() (they are documented in NEWS and thanks to Klaus also in http://sip-router.org/wiki/cookbooks/core-cookbook/devel).
Note that you cannot reliably tell if a connection to a UA behind NAT can be established. For example, I have a Fritbox NAT at home which can be configured to "expose" one of the hosts to the internet. This means that all incoming traffic for which no other rule is found in the NAT box is forwarded to the exposed host, which in my case is a UA.
-- Jan