diff --git a/kamailio/defs.cfg b/kamailio/defs.cfg index d0991e4..3648826 100644 --- a/kamailio/defs.cfg +++ b/kamailio/defs.cfg @@ -7,11 +7,11 @@ #!substdef "!MY_HOSTNAME!$HN(f)!g" #!endif -#!ifndef MY_HOSTNAME +#!ifndef MY_IP_ADDRESS #!substdef "!MY_IP_ADDRESS!$HN(i)!g" #!endif -#!ifndef MY_HOSTNAME +#!ifndef MY_WEBSOCKET_DOMAIN #!substdef "!MY_WEBSOCKET_DOMAIN!$HN(d)!g" #!endif @@ -74,6 +74,7 @@ ## Defs related to SIP_TRACE_ROLE ## #!ifdef SIP_TRACE_ROLE + #!trydef KZ_TRACE 0 #!trydef KZ_TRACE_INTERNAL 1 #!trydef KZ_TRACE_EXTERNAL 1 @@ -83,7 +84,8 @@ #!trydef KZ_TRACE_EXTERNAL_OUTGOING 1 #!trydef SIP_TRACE_URI "sip:127.0.0.1:9060" #!trydef HEP_CAPTURE_ID 1 -#!endif + + #!endif #!ifndef KZ_DISABLE_WEBSOCKETS_REGISTRAR_PORT @@ -104,7 +106,7 @@ #!trydef KZ_TLS_REGISTRAR_PORT 7000 #!endif -#!trydef KZ_FAST_PICKUP_COOKIES 1 -#!trydef KZ_FAST_PICKUP_REALTIME 1 +#!trydef KZ_PRESENCE_FAST_PICKUP_COOKIES 1 +#!trydef KZ_PRESENCE_FAST_PICKUP_REALTIME 1 # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab diff --git a/kamailio/dispatcher-role.cfg b/kamailio/dispatcher-role.cfg index 7be99c0..14b9ecc 100644 --- a/kamailio/dispatcher-role.cfg +++ b/kamailio/dispatcher-role.cfg @@ -109,8 +109,8 @@ route[DISPATCHER_FIND_ROUTES] } #!endif - #!ifdef FAST_PICKUP_ROLE - route(FAST_PICKUP_ATTEMPT); + #!ifdef PRESENCE_ROLE + route(PRESENCE_FAST_PICKUP_ATTEMPT); #!endif #!import_file "dispatcher-network-find.cfg" diff --git a/kamailio/local.cfg b/kamailio/local.cfg index 24ea1a2..7d51dfc 100644 --- a/kamailio/local.cfg +++ b/kamailio/local.cfg @@ -8,8 +8,6 @@ #!trydef PRESENCE_ROLE #!trydef RESPONDER_ROLE #!trydef NODES_ROLE -#!trydef FAST_PICKUP_ROLE -#!trydef PRESENCE_QUERY_ROLE ## Disabled Roles - remove all but the last '#' to enable # # #!trydef TRAFFIC_FILTER_ROLE @@ -39,7 +37,7 @@ ## CHANGE "kazoo://guest:guest@127.0.0.1:5672" TO THE AMQP URL ## This should be the primary RabbitMQ server ## in the zone that this server will service. -#!substdef "!MY_AMQP_URL!kazoo://guest:guest@127.0.0.1:5672!g" +#!substdef "!MY_AMQP_URL!amqp://guest:guest@127.0.0.1:5672!g" ## This parameter is only required if you are using websockets ## This value must be present in the HTTP diff --git a/kamailio/nodes-role.cfg b/kamailio/nodes-role.cfg index c03afbf..76f7598 100644 --- a/kamailio/nodes-role.cfg +++ b/kamailio/nodes-role.cfg @@ -177,8 +177,8 @@ route[MEDIA_SERVER_UP] route(DISPATCHER_CHECK_MEDIA_SERVER); #!endif -#!ifdef FAST_PICKUP_ROLE - route(FAST_PICKUP_START); +#!ifdef PRESENCE_ROLE + route(PRESENCE_FAST_PICKUP_START); #!endif } diff --git a/kamailio/fast-pickup-role.cfg b/kamailio/presence-fast-pickup.cfg similarity index 86% rename from kamailio/fast-pickup-role.cfg rename to kamailio/presence-fast-pickup.cfg index bfe00bd..af9f263 100644 --- a/kamailio/fast-pickup-role.cfg +++ b/kamailio/presence-fast-pickup.cfg @@ -2,20 +2,20 @@ modparam("htable", "htable", "park=>size=16;autoexpire=600") modparam("htable", "htable", "fp=>size=8"); -#!trydef KZ_FAST_PICKUP_COOKIES 1 -#!trydef KZ_FAST_PICKUP_REALTIME 1 -#!trydef KZ_FAST_PICKUP_STAR_5 1 +#!trydef KZ_PRESENCE_FAST_PICKUP_COOKIES 1 +#!trydef KZ_PRESENCE_FAST_PICKUP_REALTIME 1 +#!trydef KZ_PRESENCE_FAST_PICKUP_STAR_5 1 -kazoo.fast_pickup_cookies = KZ_FAST_PICKUP_COOKIES descr "maintains a hash table for correlating call-ids with media servers" -kazoo.fast_pickup_realtime = KZ_FAST_PICKUP_REALTIME descr "queries channels api for realtime status of call-id" -kazoo.fast_pickup_star_5 = KZ_FAST_PICKUP_STAR_5 descr "treats *5 as park pickup, queries state of *3" +kazoo.presence_fast_pickup_cookies = KZ_PRESENCE_FAST_PICKUP_COOKIES descr "maintains a hash table for correlating call-ids with media servers" +kazoo.presence_fast_pickup_realtime = KZ_PRESENCE_FAST_PICKUP_REALTIME descr "queries channels api for realtime status of call-id" +kazoo.presence_fast_pickup_star_5 = KZ_PRESENCE_FAST_PICKUP_STAR_5 descr "treats *5 as park pickup, queries state of *3" -route[FAST_PICKUP_START] +route[PRESENCE_FAST_PICKUP_START] { $sht(fp=>count) = 0; } -route[FAST_PICKUP_LOAD] +route[PRESENCE_FAST_PICKUP_LOAD] { sht_reset("fp"); xlog("L_INFO", "$ci|log|fast|initializing fastpick hash table from dispatcher\n"); @@ -36,7 +36,7 @@ route[FAST_PICKUP_LOAD] } } -route[FAST_PICKUP_ATTEMPT] +route[PRESENCE_FAST_PICKUP_ATTEMPT] { if (!is_method("INVITE")) { return; @@ -50,14 +50,14 @@ route[FAST_PICKUP_ATTEMPT] if($var(replaced_call_id) =~ "kfp+") { if($shtinc(fp=>count) == 1) { - route(FAST_PICKUP_LOAD); + route(PRESENCE_FAST_PICKUP_LOAD); } remove_hf_re("^Replaces"); $var(PickupOptions) = $(var(replaced_call_id){re.subst,/^kfp\+(.{2})([^@]*)@(.*)/\1/}{s.decode.hexa}); $var(md5) = $(var(replaced_call_id){re.subst,/^kfp\+(.{2})([^@]*)@(.*)/\2/}); $var(replaced_call_id) = $(var(replaced_call_id){re.subst,/^kfp\+(.{2})([^@]*)@(.*)/\3/}); if( $sht(fp=>$var(md5)) != $null) { - route(FAST_PICKUP_OPTION); + route(PRESENCE_FAST_PICKUP_OPTION); $du = $sht(fp=>$var(md5)); append_hf("Replaces: $var(replaced_call_id)$var(Pickup)\r\n"); xlog("L_INFO", "$ci|log|fast|found shortcut for call-id $var(replaced_call_id) , redirecting ($(ru{uri.user})) to $du\n"); @@ -69,7 +69,7 @@ route[FAST_PICKUP_ATTEMPT] } } - if($sel(cfg_get.kazoo.fast_pickup_realtime) == 1) { + if($sel(cfg_get.kazoo.presence_fast_pickup_realtime) == 1) { if($var(replaced_call_id) != "none") { xlog("L_INFO", "$ci|log|request has replaces call-id $var(replaced_call_id)\n"); $var(amqp_payload_request) = '{"Event-Category" : "call_event" , "Event-Name" : "channel_status_req", "Call-ID" : "' + $var(replaced_call_id) + '", "Active-Only" : true }'; @@ -103,7 +103,7 @@ route[FAST_PICKUP_ATTEMPT] ##### CALL-PARK #### ##### STAR 5 CHECK #### - if($sel(cfg_get.kazoo.fast_pickup_star_5) == 1) { + if($sel(cfg_get.kazoo.presence_fast_pickup_star_5) == 1) { if($(ru{uri.user}) =~ "\*5") { $var(park) = $_s(*3$(ru{uri.user}{s.substr,2,0})@$(ru{uri.domain})); if($sht(park=>$var(park)) != $null) { @@ -124,7 +124,7 @@ route[FAST_PICKUP_ATTEMPT] ##### CALL-PARK IN KAZOO #### $var(park_extension) = "\*3"; - if($sel(cfg_get.kazoo.fast_pickup_star_5) == 1) { + if($sel(cfg_get.kazoo.presence_fast_pickup_star_5) == 1) { $var(park_extension) = "\*[3,5]"; } if($(ru{uri.user}) =~ $var(park_extension) && !($rd =~ "[0-9]{1,3}\.[0-9]{1,3}.[0-9]{1,3}\.[0-9]{1,3}") ) { @@ -142,7 +142,7 @@ route[FAST_PICKUP_ATTEMPT] } } -route[FAST_PICKUP_OPTION] +route[PRESENCE_FAST_PICKUP_OPTION] { $var(Pickup) = ""; switch($var(PickupOptions)) @@ -158,7 +158,7 @@ route[FAST_PICKUP_OPTION] } } -route[FAST_PICKUP_INIT] +route[PRESENCE_FAST_PICKUP_INIT] { $var(AppName) = $(kzE{kz.json,App-Name}); @@ -172,7 +172,7 @@ route[FAST_PICKUP_INIT] } ## fast pickup with cookies - if($sel(cfg_get.kazoo.fast_pickup_cookies) == 1) { + if($sel(cfg_get.kazoo.presence_fast_pickup_cookies) == 1) { if($var(AppName) == "park") { $var(Pickup) = 1; #";a-leg=true"; } else { diff --git a/kamailio/presence-role.cfg b/kamailio/presence-role.cfg index 093e760..0987747 100644 --- a/kamailio/presence-role.cfg +++ b/kamailio/presence-role.cfg @@ -67,13 +67,10 @@ kazoo.presence_request_resubscribe_probe = KZ_PRESENCE_REQUEST_RESUBSCRIBE_PROBE kazoo.presence_ignore_status_probe_resp = KZ_PRESENCE_IGNORE_STATUS_PROBE_RESP descr "ignore online/offline probe replies" kazoo.presence_max_call_per_presentity = KZ_PRESENCE_MAX_CALL_PER_PRESENTITY descr "max number of calls per presentity" -#!ifdef FAST_PICKUP_ROLE -#!include_file "fast-pickup-role.cfg" -#!endif - #!include_file "presence-query.cfg" #!include_file "presence-notify.cfg" #!include_file "presence-reset.cfg" +#!include_file "presence-fast-pickup.cfg" ####### Presence Logic ######## @@ -345,9 +342,7 @@ event_route[kazoo:consumer-event-presence-dialog-update] 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"); $var(JObj) = $kzE; - #!ifdef FAST_PICKUP_ROLE - route(FAST_PICKUP_INIT); - #!endif + route(PRESENCE_FAST_PICKUP_INIT); $var(presentity) = $(kzE{kz.json,From}); $var(payload) = $kzE; @@ -505,9 +500,7 @@ route[PRESENCE_BINDINGS] route(PRESENCE_API_BINDINGS); - #!ifdef FAST_PICKUP_ROLE - route(FAST_PICKUP_START); - #!endif + route(PRESENCE_FAST_PICKUP_START); } diff --git a/kamailio/websockets-role.cfg b/kamailio/websockets-role.cfg index ca18f0e..0dcc48b 100644 --- a/kamailio/websockets-role.cfg +++ b/kamailio/websockets-role.cfg @@ -80,7 +80,7 @@ event_route[xhttp:request] #!ifdef MY_WEBSOCKET_DOMAIN if (!($hdr(Origin) =~ "MY_WEBSOCKET_DOMAIN")) { - xlog("L_INFO", "websocket|log|rejecting HTTP request with unknown origin $hdr(Origin) from $si:$sp\n"); + xlog("L_INFO", "websocket|log|rejecting HTTP request with unauthorized origin $hdr(Origin) from $si:$sp, allowed origin is MY_WEBSOCKET_DOMAIN\n"); xhttp_reply("400", "Bad Request", "", ""); exit; }