|
|
|
@ -19,7 +19,7 @@ |
|
|
|
#!trydef REGISTRAR_HANDLE_LOST_TCP 1 |
|
|
|
#!trydef REGISTRAR_CLOSE_EXPIRED_TCP 1 |
|
|
|
#!trydef REGISTRAR_HANDLE_EXPIRED_TCP 1 |
|
|
|
#!trydef REGISTRAR_HANDLE_EXPIRED_UDP 0 |
|
|
|
#!trydef REGISTRAR_HANDLE_EXPIRED_UDP 1 |
|
|
|
#!trydef REGISTRAR_HANDLE_EXPIRED_TLS 1 |
|
|
|
#!trydef REGISTRAR_HANDLE_EXPIRED_WS 1 |
|
|
|
#!trydef REGISTRAR_FORCE_QUERY 0 |
|
|
|
@ -35,6 +35,7 @@ |
|
|
|
#!trydef REGISTRAR_DB_REMOVE_EXPIRED_DELAY 0 |
|
|
|
#!trydef REGISTRAR_SYNC_TIMER_INTERVAL 5 |
|
|
|
#!trydef REGISTRAR_SYNC_TIMER_PROCS 1 |
|
|
|
#!trydef KZ_REGISTRAR_PUBLISH_REG_ONCE 0 |
|
|
|
|
|
|
|
|
|
|
|
#!ifdef REGISTRAR_WARM_CACHE |
|
|
|
@ -143,6 +144,7 @@ kazoo.registrar_force_query = REGISTRAR_FORCE_QUERY descr "force query if 1" |
|
|
|
kazoo.registrar_check_amqp_availability = REGISTRAR_CHECK_AMQP_AVAILABILITY descr "checks if amqp connection is available before querying registrar" |
|
|
|
kazoo.registrar_keepalive_udp_only = KZ_REGISTRAR_KEEPALIVE_UDP_ONLY descr "should we keepalive nat phones for udp only" |
|
|
|
kazoo.registrar_send_100 = REGISTRAR_SEND_100 descr "should we send 100 reply while doing directory search" |
|
|
|
kazoo.registrar_publish_reg_once = KZ_REGISTRAR_PUBLISH_REG_ONCE descr "should publish only new registrations" |
|
|
|
|
|
|
|
####### Registrar Logic ######## |
|
|
|
|
|
|
|
@ -297,8 +299,12 @@ onreply_route[KZ_AUTHORIZATION_REPLY] |
|
|
|
exit; |
|
|
|
} else if( $(kzR{kz.json,Event-Name}) == "authn_resp" ) { |
|
|
|
update_stat("registrar:authn_resp", "+1"); |
|
|
|
xlog("L_INFO", "$ci|log|authenticating $Au via $(kzR{kz.json,App-Name})-$(kzR{kz.json,App-Version}) response\n"); |
|
|
|
route(CHECK_AUTHORIZATION); |
|
|
|
if( $(kzR{kz.json,Trusted-Auth}) == "true" ) { |
|
|
|
route(SUCCESS_AUTHORIZATION); |
|
|
|
} else { |
|
|
|
xlog("L_INFO", "$ci|log|authenticating $Au via $(kzR{kz.json,App-Name})-$(kzR{kz.json,App-Version}) response\n"); |
|
|
|
route(CHECK_AUTHORIZATION); |
|
|
|
} |
|
|
|
} else { |
|
|
|
update_stat("registrar:authn_unknown", "+1"); |
|
|
|
update_stat("registrar:drops", "+1"); |
|
|
|
@ -325,6 +331,11 @@ route[CHECK_AUTHORIZATION] |
|
|
|
route(ANTIFLOOD_SUCCESSFUL_AUTH); |
|
|
|
#!endif |
|
|
|
|
|
|
|
route(SUCCESS_AUTHORIZATION); |
|
|
|
} |
|
|
|
|
|
|
|
route[SUCCESS_AUTHORIZATION] |
|
|
|
{ |
|
|
|
# user authenticated - remove auth header |
|
|
|
consume_credentials(); |
|
|
|
|
|
|
|
@ -421,12 +432,7 @@ route[SAVE_LOCATION] |
|
|
|
$var(proto) = $proto; |
|
|
|
#!endif |
|
|
|
|
|
|
|
$var(amqp_payload_request) = $_s({"Event-Category" : "directory", "Event-Name" : "reg_success", "Status" : "$var(Status)", "Event-Timestamp" : $TS, "Expires" : $(var(expires){s.int}), "First-Registration" : $var(new_reg), "Contact" : "$(ct{s.escape.common}{s.replace,\','}{s.replace,$$,})", "Call-ID" : "$ci", "Realm" : "$fd", "Username" : "$fU", "From-User" : "$fU", "From-Host" : "$fd", "To-User" : "$tU", "To-Host" : "$td", "User-Agent" : "$(ua{s.escape.common}{s.replace,\','}{s.replace,$$,})" , "Custom-Channel-Vars" : $xavp(ulattrs=>custom_channel_vars), "Proxy-Path" : "$var(proxy_path)", "Proxy-Protocol" : "$var(proto)", "Proxy-IP" : "$var(AdvIP)", "Proxy-Port" : "$RAp", "Source-IP": "$si", "Source-Port": "$sp" }); |
|
|
|
$var(amqp_routing_key) = "registration.success." + $(fd{kz.encode}) + "." + $(fU{kz.encode}); |
|
|
|
if(kazoo_publish("registrar", $var(amqp_routing_key), $var(amqp_payload_request), "$def(REGISTRAR_AMQP_FLAGS)") == 1) { |
|
|
|
xlog("L_INFO", "$ci|end|successful $(var(Status){s.tolower}) with contact : $ct : $var(expires)\n"); |
|
|
|
} |
|
|
|
|
|
|
|
route(PUBLISH_REGISTRATION); |
|
|
|
|
|
|
|
#!ifdef PUSHER_ROLE |
|
|
|
route(PUSHER_ON_REGISTRATION); |
|
|
|
@ -439,6 +445,17 @@ route[SAVE_LOCATION] |
|
|
|
exit; |
|
|
|
} |
|
|
|
|
|
|
|
route[PUBLISH_REGISTRATION] |
|
|
|
{ |
|
|
|
if($sel(cfg_get.kazoo.registrar_publish_reg_once) == 0 || $var(new_reg) == "true") { |
|
|
|
$var(amqp_payload_request) = $_s({"Event-Category" : "directory", "Event-Name" : "reg_success", "Status" : "$var(Status)", "Event-Timestamp" : $TS, "Expires" : $(var(expires){s.int}), "First-Registration" : $var(new_reg), "Contact" : "$(ct{s.escape.common}{s.replace,\','}{s.replace,$$,})", "Call-ID" : "$ci", "Realm" : "$fd", "Username" : "$fU", "From-User" : "$fU", "From-Host" : "$fd", "To-User" : "$tU", "To-Host" : "$td", "User-Agent" : "$(ua{s.escape.common}{s.replace,\','}{s.replace,$$,})" , "Custom-Channel-Vars" : $xavp(ulattrs=>custom_channel_vars), "Proxy-Path" : "$var(proxy_path)", "Proxy-Protocol" : "$var(proto)", "Proxy-IP" : "$var(AdvIP)", "Proxy-Port" : "$RAp", "Source-IP": "$si", "Source-Port": "$sp" }); |
|
|
|
$var(amqp_routing_key) = "registration.success." + $(fd{kz.encode}) + "." + $(fU{kz.encode}); |
|
|
|
if(kazoo_publish("registrar", $var(amqp_routing_key), $var(amqp_payload_request), "$def(REGISTRAR_AMQP_FLAGS)") == 1) { |
|
|
|
xlog("L_INFO", "$ci|end|successful $(var(Status){s.tolower}) with contact : $ct : $var(expires)\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
## kazoo event route , {"directory", "reg_flush") => reg-flush by kamailio limitations |
|
|
|
## when a Event-Category or Event-Name has a underscore (_) we need to declare it with a dash (-) |
|
|
|
event_route[kazoo:consumer-event-directory-reg-flush] |
|
|
|
|