From c99a6effc5897ea72e7442ea82f0f1608fa35240 Mon Sep 17 00:00:00 2001 From: Luis Azedo Date: Thu, 24 May 2018 00:42:10 +0100 Subject: [PATCH 1/5] support single port for registrar success messages --- kamailio/defs.cfg | 9 +++++++++ kamailio/local.cfg | 20 +++++++++++++++++--- kamailio/registrar-role.cfg | 4 ++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/kamailio/defs.cfg b/kamailio/defs.cfg index 35cecc1..573841e 100644 --- a/kamailio/defs.cfg +++ b/kamailio/defs.cfg @@ -99,4 +99,13 @@ #!define KZ_PRESENCE_REQUEST_PROBE 1 #!endif +#!trydef KZ_MULTI_HOMED 0 + +#!ifndef KZ_DISABLE_REGISTRAR_PORT +#!redefine KZ_MULTI_HOMED 1 +#!trydef KZ_REGISTRAR_PORT 7000 +#!endif + +mhomed=KZ_MULTI_HOMED + # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab diff --git a/kamailio/local.cfg b/kamailio/local.cfg index a333d8a..f6b6da0 100644 --- a/kamailio/local.cfg +++ b/kamailio/local.cfg @@ -71,7 +71,7 @@ # udp4_raw_mtu = 1472 ################################################################################ -## BINDINGS +## KZ_MULTI_HOMED ################################################################################ ## This parameter is OPTIONAL. ## It will try to locate outbound interface @@ -79,8 +79,22 @@ ## requests use the incoming socket disregarding ## the destination location. When enabled Kamailio ## will select a socket that can reach the -## destination. This reduces performance. -mhomed=0 +## destination and enables config less webrtc/tls on freeswitch. +## This reduces performance. +###!define KZ_MULTI_HOMED 1 + +################################################################################ +## KZ_DISABLE_REGISTRAR_PORT +################################################################################ +## This parameter is OPTIONAL. +## It will disable publishing single proxy port on registrar success messages +## By default single port proxy is send on registrar success messages +## which enables config less in freeswitch for handling webrtc/tls +## ie, no certs in freeswitch, no webrtc/tls listeners on freeswitch +## by disabling single port proxy, ecallmgr needs to be started with +## 'use_transport_for_fs_path' set to true in its environment configuration +## +###!define KZ_DISABLE_REGISTRAR_PORT 1 ## YOU SHOULD NOT HAVE TO CHANGE THESE! ## By setting MY_IP_ADDRESS above these will resolve diff --git a/kamailio/registrar-role.cfg b/kamailio/registrar-role.cfg index 1531570..6c69a7c 100644 --- a/kamailio/registrar-role.cfg +++ b/kamailio/registrar-role.cfg @@ -291,7 +291,11 @@ route[SAVE_LOCATION] $var(ip) = "[" + $Ri + "]"; } +#!ifndef KZ_DISABLE_REGISTRAR_PORT + $var(port) = KZ_REGISTRAR_PORT; +#!else $var(port) = $Rp; +#!endif $var(AdvIP) = $RAi; if(af==INET6) { From 1cb714d1c37bfedcd9dd79f82c735e39eb46dd3e Mon Sep 17 00:00:00 2001 From: Luis Azedo Date: Tue, 29 May 2018 11:08:02 +0100 Subject: [PATCH 2/5] registrar port without KZ_MULTI_HOMED --- kamailio/defs.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/kamailio/defs.cfg b/kamailio/defs.cfg index 573841e..c5b13dc 100644 --- a/kamailio/defs.cfg +++ b/kamailio/defs.cfg @@ -102,7 +102,6 @@ #!trydef KZ_MULTI_HOMED 0 #!ifndef KZ_DISABLE_REGISTRAR_PORT -#!redefine KZ_MULTI_HOMED 1 #!trydef KZ_REGISTRAR_PORT 7000 #!endif From 9dd7309db6bc7af598b7fd7432a00ae3b9072d29 Mon Sep 17 00:00:00 2001 From: Luis Azedo Date: Wed, 30 May 2018 15:13:23 +0100 Subject: [PATCH 3/5] handle registration port redirect per protocol --- kamailio/defs.cfg | 10 +++++----- kamailio/local.cfg | 29 ++++++++++++++--------------- kamailio/registrar-role.cfg | 36 +++++++++++++++++++++++++++++++----- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/kamailio/defs.cfg b/kamailio/defs.cfg index c5b13dc..6466730 100644 --- a/kamailio/defs.cfg +++ b/kamailio/defs.cfg @@ -99,12 +99,12 @@ #!define KZ_PRESENCE_REQUEST_PROBE 1 #!endif -#!trydef KZ_MULTI_HOMED 0 - -#!ifndef KZ_DISABLE_REGISTRAR_PORT -#!trydef KZ_REGISTRAR_PORT 7000 +#!ifndef KZ_DISABLE_WEBSOCKETS_REGISTRAR_PORT +#!trydef KZ_WEBSOCKETS_REGISTRAR_PORT 7000 #!endif -mhomed=KZ_MULTI_HOMED +#!ifndef KZ_DISABLE_TLS_REGISTRAR_PORT +#!trydef KZ_TLS_REGISTRAR_PORT 7000 +#!endif # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab diff --git a/kamailio/local.cfg b/kamailio/local.cfg index f6b6da0..785d330 100644 --- a/kamailio/local.cfg +++ b/kamailio/local.cfg @@ -70,31 +70,30 @@ ## E.g.: Add MTU=1472 to the /etc/sysconfig/network-scripts/XXX # udp4_raw_mtu = 1472 -################################################################################ -## KZ_MULTI_HOMED -################################################################################ -## This parameter is OPTIONAL. -## It will try to locate outbound interface -## on multihomed host. By default forward -## requests use the incoming socket disregarding -## the destination location. When enabled Kamailio -## will select a socket that can reach the -## destination and enables config less webrtc/tls on freeswitch. -## This reduces performance. -###!define KZ_MULTI_HOMED 1 ################################################################################ -## KZ_DISABLE_REGISTRAR_PORT +## KZ_DISABLE_REGISTRAR_PORTS ################################################################################ ## This parameter is OPTIONAL. ## It will disable publishing single proxy port on registrar success messages ## By default single port proxy is send on registrar success messages +## for websockets/tls protocols. the default port is 7000 ## which enables config less in freeswitch for handling webrtc/tls ## ie, no certs in freeswitch, no webrtc/tls listeners on freeswitch ## by disabling single port proxy, ecallmgr needs to be started with ## 'use_transport_for_fs_path' set to true in its environment configuration -## -###!define KZ_DISABLE_REGISTRAR_PORT 1 +## +###!define KZ_DISABLE_WEBSOCKETS_REGISTRAR_PORT 1 +###!define KZ_DISABLE_TLS_REGISTRAR_PORT 1 +## +## you can also change the ports used for single port redirect +##!define KZ_WEBSOCKETS_REGISTRAR_PORT 5060 +##!define KZ_TLS_REGISTRAR_PORT 5060 +## +## also available for udp/tcp if it works for you +##!define KZ_UDP_REGISTRAR_PORT 8000 +##!define KZ_UDP_REGISTRAR_PORT 8000 + ## YOU SHOULD NOT HAVE TO CHANGE THESE! ## By setting MY_IP_ADDRESS above these will resolve diff --git a/kamailio/registrar-role.cfg b/kamailio/registrar-role.cfg index 6c69a7c..0da7f73 100644 --- a/kamailio/registrar-role.cfg +++ b/kamailio/registrar-role.cfg @@ -291,11 +291,37 @@ route[SAVE_LOCATION] $var(ip) = "[" + $Ri + "]"; } -#!ifndef KZ_DISABLE_REGISTRAR_PORT - $var(port) = KZ_REGISTRAR_PORT; -#!else - $var(port) = $Rp; -#!endif + # allow port redirection on registration + switch($proto) + { + #!ifdef KZ_WEBSOCKETS_REGISTRAR_PORT + case "ws": + case "wss": + $var(port) = KZ_WEBSOCKETS_REGISTRAR_PORT; + break; + #!endif + + #!ifdef KZ_TLS_REGISTRAR_PORT + case "tls": + $var(port) = KZ_TLS_REGISTRAR_PORT; + break; + #!endif + + #!ifdef KZ_UDP_REGISTRAR_PORT + case "udp": + $var(port) = KZ_UDP_REGISTRAR_PORT; + break; + #!endif + + #!ifdef KZ_TCP_REGISTRAR_PORT + case "tcp": + $var(port) = KZ_UDP_REGISTRAR_PORT; + break; + #!endif + + default: + $var(port) = $Rp; + } $var(AdvIP) = $RAi; if(af==INET6) { From 8fb537bc191eec8b6d7a2b6a63d49dd3b2820759 Mon Sep 17 00:00:00 2001 From: Luis Azedo Date: Wed, 30 May 2018 15:14:52 +0100 Subject: [PATCH 4/5] revert mhomed --- kamailio/local.cfg | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kamailio/local.cfg b/kamailio/local.cfg index 785d330..6b13b0d 100644 --- a/kamailio/local.cfg +++ b/kamailio/local.cfg @@ -70,6 +70,17 @@ ## E.g.: Add MTU=1472 to the /etc/sysconfig/network-scripts/XXX # udp4_raw_mtu = 1472 +################################################################################ +## BINDINGS +################################################################################ +## This parameter is OPTIONAL. +## It will try to locate outbound interface +## on multihomed host. By default forward +## requests use the incoming socket disregarding +## the destination location. When enabled Kamailio +## will select a socket that can reach the +## destination. This reduces performance. +mhomed=0 ################################################################################ ## KZ_DISABLE_REGISTRAR_PORTS From ea11537e7c374e3573b394a36b8a2ab33170ca61 Mon Sep 17 00:00:00 2001 From: Luis Azedo Date: Wed, 30 May 2018 18:22:42 +0100 Subject: [PATCH 5/5] change default example & typo --- kamailio/local.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kamailio/local.cfg b/kamailio/local.cfg index 6b13b0d..d4554bf 100644 --- a/kamailio/local.cfg +++ b/kamailio/local.cfg @@ -102,8 +102,8 @@ mhomed=0 ##!define KZ_TLS_REGISTRAR_PORT 5060 ## ## also available for udp/tcp if it works for you -##!define KZ_UDP_REGISTRAR_PORT 8000 -##!define KZ_UDP_REGISTRAR_PORT 8000 +##!define KZ_UDP_REGISTRAR_PORT 7000 +##!define KZ_TCP_REGISTRAR_PORT 7000 ## YOU SHOULD NOT HAVE TO CHANGE THESE!