Dispatcher is sending inbound calls to Freeswitch boxes. Both the FS boxes and Kam are behind the same nat. What is the correct way to pass calls to the FS boxes so that all SIP between FS & Kam use local IP's?
Should Kam put two record-route headers on, one with PUBLICIP and one with PRIVATEIP? How is this accomplished?
Thanks
On Mon, Nov 27, 2017 at 12:00:10AM -0500, Daniel Greenwald wrote:
Should Kam put two record-route headers on, one with PUBLICIP and one with PRIVATEIP? How is this accomplished?
Yep, you're exactly on the right track.
For purposes of this discussion, 10.0.0.1 is the internal IP (and also the IP to which an external IP is NAT'd), 192.0.0.1 is the public IP, and we're using UDP only.
1) Add two listeners on the same interface, one of which advertises the public interface and the other of which does not[1], e.g.
# "External" interface.
listen=udp:10.0.0.1:5060 advertise 192.0.0.1:5060
# "Internal" interface. Same network address, but by necessity, # different port.
listen=udp:10.0.0.1:5080
2) Use the following setting to enable double Record-Route, though it's on by default so if it's not set you can just omit it.
modparam("rr", "enable_double_rr", 1)
3) Set mhomed=0[3] as its routing logic will fail you here, and use $fs[4] to steer initial requests manually, e.g.
route[INBOUND_INVITE] { ...
$fs = 'udp:10.0.0.1:5080';
if(!t_relay()) sl_reply_error(); }
route[OUTBOUND_INVITE] { ...
$fs = 'udp:10.0.0.1:5060';
if(!t_relay()) sl_reply_error(); }
Do the same for any other types of _initial_ requests you wish to route between the interfaces, e.g. if you're passing on REGISTERs, SUBSCRIBE, etc.
4) Profit. Everything else should fall into place "automagically", including a) in-dialog requests, by way of the appropriate Route set and b) replies.
-- Alex
[1] https://www.kamailio.org/wiki/cookbooks/5.0.x/core#listen
[2] https://kamailio.org/docs/modules/5.0.x/modules/rr.html#idp25575876
[3] https://www.kamailio.org/wiki/cookbooks/5.0.x/core#mhomed
[4] https://www.kamailio.org/wiki/cookbooks/5.0.x/pseudovariables#fs_-_forced_so...
Cool! Thanks for the fast and thorough response. I will try this out. Would TCP not work the same way, if I omit udp?
On Mon, Nov 27, 2017 at 12:08 AM, Alex Balashov abalashov@evaristesys.com wrote:
On Mon, Nov 27, 2017 at 12:00:10AM -0500, Daniel Greenwald wrote:
Should Kam put two record-route headers on, one with PUBLICIP and one with PRIVATEIP? How is this accomplished?
Yep, you're exactly on the right track.
For purposes of this discussion, 10.0.0.1 is the internal IP (and also the IP to which an external IP is NAT'd), 192.0.0.1 is the public IP, and we're using UDP only.
- Add two listeners on the same interface, one of which advertises the
public interface and the other of which does not[1], e.g.
# "External" interface.
listen=udp:10.0.0.1:5060 advertise 192.0.0.1:5060
# "Internal" interface. Same network address, but by necessity, # different port.
listen=udp:10.0.0.1:5080
- Use the following setting to enable double Record-Route, though it's
on by default so if it's not set you can just omit it.
modparam("rr", "enable_double_rr", 1)
- Set mhomed=0[3] as its routing logic will fail you here, and use
$fs[4] to steer initial requests manually, e.g.
route[INBOUND_INVITE] { ...
$fs = 'udp:10.0.0.1:5080'; if(!t_relay()) sl_reply_error();
}
route[OUTBOUND_INVITE] { ...
$fs = 'udp:10.0.0.1:5060'; if(!t_relay()) sl_reply_error();
}
Do the same for any other types of _initial_ requests you wish to route between the interfaces, e.g. if you're passing on REGISTERs, SUBSCRIBE, etc.
- Profit. Everything else should fall into place "automagically",
including a) in-dialog requests, by way of the appropriate Route set and b) replies.
-- Alex
[1] https://www.kamailio.org/wiki/cookbooks/5.0.x/core#listen
[2] https://kamailio.org/docs/modules/5.0.x/modules/rr.html#idp25575876
[3] https://www.kamailio.org/wiki/cookbooks/5.0.x/core#mhomed
[4] https://www.kamailio.org/wiki/cookbooks/5.0.x/ pseudovariables#fs_-_forced_socket
-- Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On Mon, Nov 27, 2017 at 12:28:26AM -0500, Daniel Greenwald wrote:
Cool! Thanks for the fast and thorough response. I will try this out.
You're very welcome!
Would TCP not work the same way, if I omit udp?
Indeed it should.
A common approach is to use TCP at the customer access edge and use UDP inside your core for maximal efficiency, but it depends on what kind of services you're delivering (e.g. whether you're prone to big packets that get fragmented, whether you have big MTUs, etc.), as well as customs, habits and tastes in general.