Script intended to be able to filter calls

require("Core")
 
-- Third-party libraries
-- https://github.com/silentbicycle/lua-memcached
local client = require("memcached")
local cache = client.connect()
 
function filterCallSession(kind, name, number, slot, flavor, source, destination)
  -- Simple rule to drop D-STAR loop sessions
  if name == "D-Extra Link"
  then
    local key = "Filter-" .. source
    local count = tonumber(cache:get(key) or 0)
    cache:set(key, count + 1, 2)
    if count >= 3
    then
      return true
    end
  end
 
  -- Put filter rules here
 
  -- Accept all calls by default
  return false