|
|
|
@ -8,6 +8,31 @@ |
|
|
|
#!trydef REGISTRAR_NAT_PING_WORKERS 5 |
|
|
|
##### |
|
|
|
|
|
|
|
|
|
|
|
#!ifndef KZ_DISABLE_WEBSOCKETS_REGISTRAR_PORT |
|
|
|
#!trydef KZ_WEBSOCKETS_REGISTRAR_PORT 7000 |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!ifndef KZ_DISABLE_TLS_REGISTRAR_PORT |
|
|
|
#!trydef KZ_TLS_REGISTRAR_PORT 7000 |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!ifndef KZ_DISABLE_TCP_REGISTRAR_PORT |
|
|
|
#!trydef KZ_TCP_REGISTRAR_PORT 7000 |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!ifndef KZ_DISABLE_WEBSOCKETS_REGISTRAR_PROXY_PROTO |
|
|
|
#!trydef KZ_WEBSOCKETS_REGISTRAR_PROXY_PROTO "udp" |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!ifndef KZ_DISABLE_TLS_REGISTRAR_PROXY_PROTO |
|
|
|
#!trydef KZ_TLS_REGISTRAR_PROXY_PROTO "udp" |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!ifndef KZ_DISABLE_TCP_REGISTRAR_PROXY_PROTO |
|
|
|
#!trydef KZ_TCP_REGISTRAR_PROXY_PROTO "udp" |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!trydef REGISTRAR_MIN_EXPIRES 300 |
|
|
|
#!trydef REGISTRAR_MAX_EXPIRES 3600 |
|
|
|
#!trydef REGISTRAR_DEFAULT_EXPIRES 600 |
|
|
|
@ -183,10 +208,6 @@ route[HANDLE_REGISTER] |
|
|
|
|
|
|
|
routes("HANDLE_REGISTER_"); |
|
|
|
|
|
|
|
#!ifdef PUSHER_ROLE |
|
|
|
route(PUSHER_ATTEMPT_REGISTRATION); |
|
|
|
#!endif |
|
|
|
|
|
|
|
if($sel(cfg_get.kazoo.registrar_failover) == 1) { |
|
|
|
xlog("L_INFO", "$ci|registrar|register|forcing failover\n"); |
|
|
|
update_stat("registrar:force_failover", "+1"); |
|
|
|
@ -393,7 +414,79 @@ route[SAVE_LOCATION] |
|
|
|
$var(ip) = "[" + $Ri + "]"; |
|
|
|
} |
|
|
|
|
|
|
|
route(REGISTRAR_PORT); |
|
|
|
|
|
|
|
route(REGISTRAR_PROTO); |
|
|
|
|
|
|
|
$var(AdvIP) = $RAi; |
|
|
|
if(af==INET6) { |
|
|
|
$var(AdvIP) = "[" + $RAi + "]"; |
|
|
|
} |
|
|
|
|
|
|
|
#!ifdef WITH_INTERNAL_LISTENER |
|
|
|
#!ifdef WITHOUT_REGISTRAR_PROXY_PATH_PROTO |
|
|
|
$var(proxy_path) = $_s(sip:MY_IP_ADDRESS:$def(INTERNAL_PORT)); |
|
|
|
#!else |
|
|
|
$var(proxy_path) = $_s(sip:MY_IP_ADDRESS:$def(INTERNAL_PORT);transport=$def(INTERNAL_PROTO)); |
|
|
|
#!endif |
|
|
|
$var(proto) = $def(INTERNAL_PROTO); |
|
|
|
#!else |
|
|
|
#!ifdef WITHOUT_REGISTRAR_PROXY_PATH_PROTO |
|
|
|
$var(proxy_path) = $_s(sip:MY_IP_ADDRESS:$var(port)); |
|
|
|
#!else |
|
|
|
$var(proxy_path) = $_s(sip:MY_IP_ADDRESS:$var(port);transport=$var(proxy_proto)); |
|
|
|
#!endif |
|
|
|
$var(proto) = $proto; |
|
|
|
#!endif |
|
|
|
|
|
|
|
route(PUBLISH_REGISTRATION); |
|
|
|
|
|
|
|
routes("ON_REGISTRATION_"); |
|
|
|
|
|
|
|
exit; |
|
|
|
} |
|
|
|
|
|
|
|
route[REGISTRAR_PROTO] |
|
|
|
{ |
|
|
|
# allow proto redirection on registration |
|
|
|
|
|
|
|
switch($proto) |
|
|
|
{ |
|
|
|
#!ifdef KZ_WEBSOCKETS_REGISTRAR_PROXY_PROTO |
|
|
|
case "ws": |
|
|
|
case "wss": |
|
|
|
$var(proxy_proto) = KZ_WEBSOCKETS_REGISTRAR_PROXY_PROTO; |
|
|
|
break; |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!ifdef KZ_TLS_REGISTRAR_PROXY_PROTO |
|
|
|
case "tls": |
|
|
|
$var(proxy_proto) = KZ_TLS_REGISTRAR_PROXY_PROTO; |
|
|
|
break; |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!ifdef KZ_UDP_REGISTRAR_PROXY_PROTO |
|
|
|
case "udp": |
|
|
|
$var(proxy_proto) = KZ_UDP_REGISTRAR_PROXY_PROTO; |
|
|
|
break; |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!ifdef KZ_TCP_REGISTRAR_PROXY_PROTO |
|
|
|
case "tcp": |
|
|
|
$var(proxy_proto) = KZ_TCP_REGISTRAR_PROXY_PROTO; |
|
|
|
break; |
|
|
|
#!endif |
|
|
|
|
|
|
|
default: |
|
|
|
$var(proxy_proto) = $proto; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
route[REGISTRAR_PORT] |
|
|
|
{ |
|
|
|
# allow port redirection on registration |
|
|
|
|
|
|
|
switch($proto) |
|
|
|
{ |
|
|
|
#!ifdef KZ_WEBSOCKETS_REGISTRAR_PORT |
|
|
|
@ -424,39 +517,6 @@ route[SAVE_LOCATION] |
|
|
|
default: |
|
|
|
$var(port) = $Rp; |
|
|
|
} |
|
|
|
|
|
|
|
$var(AdvIP) = $RAi; |
|
|
|
if(af==INET6) { |
|
|
|
$var(AdvIP) = "[" + $RAi + "]"; |
|
|
|
} |
|
|
|
|
|
|
|
#!ifdef WITH_INTERNAL_LISTENER |
|
|
|
#!ifdef WITHOUT_REGISTRAR_PROXY_PATH_PROTO |
|
|
|
$var(proxy_path) = $_s(sip:MY_IP_ADDRESS:$def(INTERNAL_PORT)); |
|
|
|
#!else |
|
|
|
$var(proxy_path) = $_s(sip:MY_IP_ADDRESS:$def(INTERNAL_PORT);transport=$def(INTERNAL_PROTO)); |
|
|
|
#!endif |
|
|
|
$var(proto) = $def(INTERNAL_PROTO); |
|
|
|
#!else |
|
|
|
#!ifdef WITHOUT_REGISTRAR_PROXY_PATH_PROTO |
|
|
|
$var(proxy_path) = $_s(sip:MY_IP_ADDRESS:$var(port)); |
|
|
|
#!else |
|
|
|
$var(proxy_path) = $_s(sip:MY_IP_ADDRESS:$var(port);transport=$proto); |
|
|
|
#!endif |
|
|
|
$var(proto) = $proto; |
|
|
|
#!endif |
|
|
|
|
|
|
|
route(PUBLISH_REGISTRATION); |
|
|
|
|
|
|
|
#!ifdef PUSHER_ROLE |
|
|
|
route(PUSHER_ON_REGISTRATION); |
|
|
|
#!endif |
|
|
|
|
|
|
|
#!ifdef KEEPALIVE_ROLE |
|
|
|
route(KEEPALIVE_ON_REGISTRATION); |
|
|
|
#!endif |
|
|
|
|
|
|
|
exit; |
|
|
|
} |
|
|
|
|
|
|
|
route[PUBLISH_REGISTRATION] |
|
|
|
|