<div>Hi All,</div>
<div><br>Our system has two IP address, one is used for kamailio and 2nd one is used for data. </div>
<div>The problem is suppose a request came in to kamailio on a TCP connection with first IP address and connection is torned down before sending the response. Later when the response is send out  kamialio is using the 2nd IP to create the connection. The reason is kamailio doesn&#39;t have force socket in in reply, so it uses INADDR_ANY for soruce addres .so kernel uses source address based on the detaintion IP.</div>

<div> </div>
<div>I tired to force the socket using pseudo variable $fs or force_send_socket(), but neither of them worked from reply_route. </div>
<div> </div>
<div>So i modfied the code relay_replay to set the SND_F_FORCE_SOCKET which will use the address where request is recieved  as source address to make the TCP connection  The code change is shown below. </div>
<div> </div>
<div>Please let me know is there anyother way we could acheive it?</div>
<div> </div>
<div> </div>
<div><font face="courier new,monospace">   }else{<br>    buf = build_res_buf_from_sip_res( relayed_msg, &amp;res_len );<br>    /* if we build a message from shmem, we need to remove<br>       via delete lumps which are now stirred in the shmem-ed<br>
       structure<br>    */<font style="BACKGROUND-COLOR: #ffffff"><br></font>    if (branch!=relay) {<br>     free_via_clen_lump(&amp;relayed_msg-&gt;add_rm);<br>    }<br>    /* update send_flags with possible additions from the<br>
       reply route */<br>    SND_FLAGS_OR(&amp;uas_rb-&gt;dst.send_flags, &amp;uas_rb-&gt;dst.send_flags,<br>        &amp;relayed_msg-&gt;rpl_send_flags);<br><font style="BACKGROUND-COLOR: #ffffff"><font color="#000000"><font style="BACKGROUND-COLOR: #ffffff">                /* Make the</font><font style="BACKGROUND-COLOR: #ffffff"> response to use the same IP where it receives the message */</font></font></font></font><font style="BACKGROUND-COLOR: #ffffff" color="#000000" face="courier new,monospace">  </font></div>

<div><font face="courier new,monospace">           <strong> </strong></font></div>
<div><font face="courier new,monospace"><strong>     <font style="BACKGROUND-COLOR: #ffff66">uas_rb-&gt;dst.send_flags.f |= SND_F_FORCE_SOCKET; </font></strong></font></div>
<div><font face="courier new,monospace">  }</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">Thanks</font></div>
<div><font face="Courier New">JIjo</font></div>