Hi All,

Our system has two IP address, one is used for kamailio and 2nd one is used for data.
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'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.
 
I tired to force the socket using pseudo variable $fs or force_send_socket(), but neither of them worked from reply_route.
 
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.
 
Please let me know is there anyother way we could acheive it?
 
 
   }else{
    buf = build_res_buf_from_sip_res( relayed_msg, &res_len );
    /* if we build a message from shmem, we need to remove
       via delete lumps which are now stirred in the shmem-ed
       structure
    */
    if (branch!=relay) {
     free_via_clen_lump(&relayed_msg->add_rm);
    }
    /* update send_flags with possible additions from the
       reply route */
    SND_FLAGS_OR(&uas_rb->dst.send_flags, &uas_rb->dst.send_flags,
        &relayed_msg->rpl_send_flags);
                /* Make the response to use the same IP where it receives the message */
  
           
     uas_rb->dst.send_flags.f |= SND_F_FORCE_SOCKET; 
  }
 
Thanks
JIjo