* do not handle authorization from internal sources
* do not remove authorization from internal sources
* when connecting to external from internal, a 401/407 may be returned
and we relay that info back to media server, which will issue a new request
with authorization, and we need to pass that info to external
(cherry picked from commit 69df3e373d)
* ensure REMOVE_RESERVED_HEADERS is called for internal replies
* NAT_MANAGE is relocated to ensure its called with failures
(cherry picked from commit 722af98e26)
* use wildcard for amqp bindings
* kazoo custom headers
adds route REMOVE_RESERVED_HEADERS
adds external configurable setting for cleaning sip headers before sending to exterrnal
* use wildcard for AUTHORIZATION_CHECK
* add KAZOO_DB_LOCATION to defs
allows overriding the locaction of db_kazoo database
* add prometheus
creates http.cfg for handling xhttp:request
decouple websockets from xhttp:request
* add flags
* remove k-cid handling from fastpickup
* rework default listeners
adds oob definitions
* add support for internal tcp proto
* use wildcard for for local request routes
* use wildcard for deferred init
* rework websocket listeners
* add trace_init_mode
and a way to ignore tracing for configured ports
* remove local request in presence
* pusher record-route
* update dispatcher next route
* allow alg selection from other routes
other routes may set alg and then call DISPATCHER_SELECT_ROUTES
* support media check with tcp proto
* classify with X-FS-Core-UUID
support for tcp without changing KZ_DISPATCHER_CLASSIFY_FLAGS
* use wildcard for custom HANDLE_REGISTER
* handle proto for proxy-path
* allow relocation of tls config
adds xavp_cfg param to tls for easier selection of tls definition
* add tcpops module
* decouple websockets
* don't create transaction for in dialog
* run custom routes
* handle ruri alias
* add newline to log
* support tcp in media associations
* allow skip nat manage by flag
* allow no force send socket for internal listener
* use wildcard in route extensibility
* add route to external
* adds dispatcher for outbound
* adds custom for outbound
* include extra routes
* formatting
* more decoupling with wildcard routes
* move MWI_PRESENCE_BODY to route
* code readability
* fix import extra files
* allow external definition of websocket domain
#!trydef WEBSOCKET_DOMAIN "where.is.that"
the substdef will be created with that value
this avoids the creation of substdef expressions in local.cfg or other included scripts
* add log prefix settings
* dispatcher log formatting
* use trace_ignored_methods
* use modparamx for siptrace uri
* set loglevel to debug for group route
(cherry picked from commit c70c467dfd)
* move KZ_PERMISSIONS_CACHE from defs.cfg
* add KZ_PERMISSIONS_MAX_SUBNET
* do not reload on the same iteration as load
* log the real number of records added
* FLAG_SESSION_PROGRESS is set when
the media server sends a 180/183
which is triggered after a route reply.
if there are no endpoints to bridge
to (dnd, faulty callflow) the return code
from the media can be 480 if not set explicitly by
callflow action. in that case
we were passing it to the incoming leg
carrier/endpoint and some carriers retry
the call which we don't want.
#!substdef "!KZQ_PRESENCE_SEARCH_SUMMARY!select * from active_watchers where to_domain = \"\$var(Domain)\"!g"
#!substdef "!KZQ_PRESENCE_SEARCH_DETAIL!select a.*, b.time, b.result, b.sent_msg, b.received_msg from active_watchers a left outer join active_watchers_log b on a.presentity_uri = b.presentity_uri and a.event = b.event and a.callid = b.callid where a.presentity_uri = \"\$var(presentity_uri)\" !g"
#!substdef "!KZQ_REGISTRAR_SEARCH_SUMMARY!select username,domain from location where domain = \"\$var(Domain)\"!g"
#!substdef "!KZQ_REGISTRAR_SEARCH_DETAIL!select * from location where domain = \"\$var(Domain)\"!g"
#!substdef "!KZQ_HAS_PRESENTITY!select count(*) as count from presentity where username = \"\$subs(to_user)\" and domain = \"\$subs(to_domain)\" and event = \"\$subs(event)\"!g"
#!substdef "!KZQ_RESET_PUBLISHER_ZONE_UPDATE!INSERT INTO tmp_probe select distinct a.event, a.presentity_uri, 0 from presentities a inner join wdispatcher c on a.sender = c.destination inner join active_watchers b on a.presentity_uri = b.presentity_uri and a.event = b.event where zone = \"\$var(Zone)\" and state in('early', 'confirmed', 'onthephone', 'busy', 'ringing')!g"
#!substdef "!KZQ_PRESENCE_ZONE_RESET!delete from presentity where id in(select a.id from presentities a join wdispatcher c on a.sender = c.destination where zone = \"\$var(Zone)\")!g"
#!substdef "!KZQ_REGISTRAR_FLUSH!select username || \"@\" || domain as aor, ruid from location where domain = \"\$var(Domain)\"!g"
#!substdef "!KZQ_RESET_PUBLISHER_UPDATE!update active_watchers set expires = \$TS where id in (select b.id from presentity a inner join active_watchers b on a.username = b.to_user and a.domain = b.to_domain and a.event = b.event where a.sender = \"\$var(MediaUrl)\")!g"
#!substdef "!KZQ_PRESENCE_SEARCH_DETAIL!select * from active_watchers_log where presentity_uri = \"\$var(presentity_uri)\"!g"
#!substdef "!KZQ_PRESENCE_SEARCH_SUMMARY!select * from active_watchers where watcher_domain = \"\$var(Domain)\"!g"
#!substdef "!KZQ_REGISTRAR_SEARCH_SUMMARY!select username,domain from location where domain = \"\$var(Domain)\"!g"
#!substdef "!KZQ_REGISTRAR_SEARCH_DETAIL!select * from location where domain = \"\$var(Domain)\"!g"
#!substdef "!KZQ_HAS_PRESENTITY!select count(*) as count from presentity where username = \"\$subs(to_user)\" and domain = \"\$subs(to_domain)\" and event = \"\$subs(event)\"!g"
#!substdef "!KZQ_PRESENCE_RESET!delete from presentity where sender = \"\$var(MediaUrl)\"!g"
#!substdef "!KZQ_RESET_PUBLISHER_UPDATE!update active_watchers set expires = \$TS where id in (select b.id from presentity a inner join active_watchers b on a.username = b.to_user and a.domain = b.to_domain and a.event = b.event where a.sender = '\$var(MediaUrl)')!g"
#!substdef "!KZQ_PRESENCE_SEARCH_DETAIL!select * from active_watchers_log where presentity_uri = '\$var(presentity_uri)'!g"
#!substdef "!KZQ_PRESENCE_SEARCH_SUMMARY!select * from active_watchers where watcher_domain = '\$var(Domain)'!g"
#!substdef "!KZQ_REGISTRAR_SEARCH_SUMMARY!select username,domain from location where domain = \"\$var(Domain)\"!g"
#!substdef "!KZQ_REGISTRAR_SEARCH_DETAIL!select * from location where domain = \"\$var(Domain)\"!g"
#!substdef "!KZQ_PRESENCE_RESET!delete from presentity where sender = '\$var(MediaUrl)'!g"
xlog("L_INFO", "$ci|default|associate traffic from $var(user_source) with media server sip:$(ruri{uri.host}):$(ruri{uri.port});transport=$sndto(sproto)\n");
xlog("L_WARNING","$(kzE{kz.json,Msg-ID})|amqp|message $(kzE{kz.json,Original-Event-Category}):$(kzE{kz.json,Original-Event-Name}) was returned by broker $(kzE{kz.json,Error-Code}) $(kzE{kz.json,Error-Reason})\n");
xlog("L_WARNING","event|bindings|$(kzE{kz.json,Msg-ID}) $(kzE{kz.json,Original-Event-Category}):$(kzE{kz.json,Original-Event-Name}) was returned by broker $(kzE{kz.json,Error-Code}) $(kzE{kz.json,Error-Reason})\n");
xlog("L_DEBUG", "$ci|log|init preparing $subs(event) notify to $subs(watcher_username)@$subs(watcher_domain) on behalf of $subs(pres_uri) : $du\n");
xlog("L_DEBUG", "$ci|notify|init preparing $subs(event) notify to $subs(watcher_username)@$subs(watcher_domain) on behalf of $subs(pres_uri) : $du\n");
xlog("L_DEBUG", "$ci|log|init|forcing socket to $(pr{s.tolower}):$(hdr(Contact){nameaddr.uri}{uri.host}):$(hdr(Contact){nameaddr.uri}{uri.port}) when sending notify to $ruri\n");
xlog("L_DEBUG", "$ci|notify|init|forcing socket to $(pr{s.tolower}):$(hdr(Contact){nameaddr.uri}{uri.host}):$(hdr(Contact){nameaddr.uri}{uri.port}) when sending notify to $ruri\n");
xlog("$(sel(cfg_get.kazoo.presence_notify_log_level){s.int})", "$ci|end|notified $subs(watcher_username)@$subs(watcher_domain) on behalf of $subs(pres_uri)\n");
xlog("$(sel(cfg_get.kazoo.presence_notify_log_level){s.int})", "event|notify|notified $subs(watcher_username)@$subs(watcher_domain) on behalf of $subs(pres_uri)\n");
} else if($subs(reason)== "timeout") {
$xavp(pres=>delete_subscription) = 1;
xlog("L_DEBUG", "$ci|end|deleting subscription $subs(pres_uri) for $subs(watcher_username)@$subs(watcher_domain) due to timeout\n");
xlog("L_DEBUG", "event|notify|deleting subscription $subs(pres_uri) for $subs(watcher_username)@$subs(watcher_domain) due to timeout\n");
xlog("L_ERROR", "$ci|warning|removing $rP watcher $subs(watcher_username)@$subs(watcher_domain) for $subs(pres_uri) with reply $notify_reply($rs)\n");
xlog("L_ERROR", "event|notify|removing $rP watcher $subs(watcher_username)@$subs(watcher_domain) for $subs(pres_uri) with reply $notify_reply($rs)\n");
xlog("L_WARNING", "$ci|error|removing $rP watcher $subs(watcher_username)@$subs(watcher_domain) for $subs(pres_uri) with reply $notify_reply($rs)\n");
xlog("L_WARNING", "event|notify|removing $rP watcher $subs(watcher_username)@$subs(watcher_domain) for $subs(pres_uri) with reply $notify_reply($rs)\n");
} else {
$var(level)=6 - $var(shtinc);
xlog("$var(level)", "$ci|error|received $notify_reply($rs) ($var(shtinc)/$sel(cfg_get.kazoo.presence_max_notify_error)) when notifying $subs(watcher_username)@$subs(watcher_domain) on behalf of $subs(pres_uri) with reply $notify_reply($rs)\n");
xlog("$var(level)", "event|notify|received $notify_reply($rs) ($var(shtinc)/$sel(cfg_get.kazoo.presence_max_notify_error)) when notifying $subs(watcher_username)@$subs(watcher_domain) on behalf of $subs(pres_uri) with reply $notify_reply($rs)\n");
}
}
} else {
$xavp(pres=>delete_subscription) = 1;
xlog("L_WARNING", "$ci|end|deleting subscription $subs(pres_uri) as $subs(watcher_username)@$subs(watcher_domain) replied with $notify_reply($rs)\n");
xlog("L_WARNING", "event|notify|deleting subscription $subs(pres_uri) as $subs(watcher_username)@$subs(watcher_domain) replied with $notify_reply($rs)\n");
xlog("L_DEBUG", "$(kzE{kz.json,Call-ID})|log|received $(kzE{kz.json,Event-Package}) update for $(kzE{kz.json,From}) state $(kzE{kz.json,State}) from $(kzE{kz.json,AMQP-Broker-Zone})=> $(kzE{kz.json,Switch-URI}) (Δ1 $(kzE{kz.json,AMQP-Elapsed-Micro}) μs , Δ2 $var(delta_to_start) μs)\n");
xlog("L_DEBUG", "event|presence|$(kzE{kz.json,Call-ID}) received $(kzE{kz.json,Event-Package}) update for $(kzE{kz.json,From}) state $(kzE{kz.json,State}) from $(kzE{kz.json,AMQP-Broker-Zone})=> $(kzE{kz.json,Switch-URI}) (Δ1 $(kzE{kz.json,AMQP-Elapsed-Micro}) μs , Δ2 $var(delta_to_start) μs)\n");
xlog("L_WARN", "$(var(payload){kz.json,Call-ID})|log|not publishing state $(var(payload){kz.json,State}) for presentity $var(presentity) with $xavp(watchers=>self) calls, policy limit of $sel(cfg_get.kazoo.presence_max_call_per_presentity) calls per presentity \n");
xlog("L_WARN", "event|presence|$(var(payload){kz.json,Call-ID}) not publishing state $(var(payload){kz.json,State}) for presentity $var(presentity) with $xavp(watchers=>self) calls, policy limit of $sel(cfg_get.kazoo.presence_max_call_per_presentity) calls per presentity \n");
xlog("L_WARN", "websocket|log|$si is at the maximum $sel(cfg_get.kazoo.ws_max_connection_per_proxy) allowable sockets per PROXY IP, rejecting request for another websocket\n");
xlog("L_WARN", "http|websocket|$si is at the maximum $sel(cfg_get.kazoo.ws_max_connection_per_proxy) allowable sockets per PROXY IP, rejecting request for another websocket\n");
xlog("L_WARN", "websocket|log|$var(ws_orig_ip) is at the maximum $sel(cfg_get.kazoo.ws_max_connection_per_ip) allowable sockets per IP, rejecting request for another websocket\n");
xlog("L_WARN", "http|websocket|$var(ws_orig_ip) is at the maximum $sel(cfg_get.kazoo.ws_max_connection_per_ip) allowable sockets per IP, rejecting request for another websocket\n");