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
Show replies by date
Trying setting force_send_socket(PUBLIC_IP:5060); in a branch route. Get
redirects creates a new branch for each contact header returned in the 302
and you want to act upon those branches.
if (t_check_status("302")) {
get_redirects("*");
t_on_branch("REDIRECT_BRANCH")
t_relay();
}
branch_route[REDIRECT_BRANCH] {
force_send_socket(PUBLIC_IP:5060);
}
John
thank you John, that did the trick!.
________________________________
From: Fabian Borot <fborot(a)hotmail.com>
Sent: Wednesday, January 31, 2018 5:05 PM
To: sr-users(a)lists.kamailio.org
Subject: question about force_send_socket
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