[SR-Users] question about force_send_socket

Fabian Borot fborot at hotmail.com
Wed Jan 31 23:05:22 CET 2018


  our kamailo has 2 IPs, a public (87.x.x.x) and a private (192.168.1.1). It is listening on all of them. For all calls it listens on the public IP but for some calls I need to forward the incoming INVITE to a server in the private network so I do a " force_send_socket(privateip:port)"  before the route that forwards the INVITE to the server in the private network and that works.

But then when the server in the private network replies with 302 I have to contact the servers inside the Contact header using the Public IP now so I do this hoping that it will switch back to the public IP:

        if (t_check_status("302")) {
                force_send_socket(PUBLIC_IP:5060);
                get_redirects("*");
                t_relay();
        }

But it stays in the private, so the INVITEs to the servers inside the Contact header are sent from the Private IP and they are blocked.

This would be the flow:
customer INVITE  -> kamailio(publicIP)
kamailio (publicIP) 100 trying -> customer

kamailio(privateIP) INVITE -> Server(privateIP)
Server(privateIP) 302 redirect -> kamailio(privateIP)
kamailio(privateIP) ACK -> Server(privateIP)

after I would like this to happen

kamailio(publicIP) INVITE -> Server1(publicIP)
but instead this happens:

kamailio(privateIP) INVITE -> Server1(publicIP)

how can I switch back to the public IP to continue with this call flow?
thank you



More information about the sr-users mailing list