<syntaxhighlight lang="lua"> -- General modules require("Core")

-- Third-party libraries -- http://dkolf.de/src/dkjson-lua.fsl/home local json = require("dkjson")

-- Interval in seconds of exclusive access to group -- This parameter should be defined before require("Generic") interval = 15

-- Network modules require("Generic")

function handleEvent(domain, object, message)

  1. --[[
  1. *** This function called when core produces some events
  2. Note: it is strongly recommended to not use this function for purposes that differ from call routing in real-time
  1. Parameters:
  2. domain - domain of event, see EVENT_DOMAIN_*
  3. object - reference to sender object
  4. message - JSON encoded message
  1. ]]--
  1. if domain == EVENT_DOMAIN_SESSION
  2. then
  3. local data = json.decode(message)
  4. if (data["Event"] == "Session-Update") or
  5. (data["Event"] == "Session-Start") or
  6. (data["Event"] == "Session-Stop")
  7. then
  8. local flavor = tonumber(data["SessionType"])
  9. if (bit.band(flavor, SESSION_TYPE_FLAG_VOICE) ~= 0) and
  10. (bit.band(flavor, SESSION_TYPE_FLAG_GROUP) ~= 0)
  11. then
  12. setHandOffLock(data, object, 600, 15)
  13. end
  14. end
  15. end

end </syntaxhighlight>

<syntaxhighlight lang="lua"> -- General modules require("Core")

-- Third-party libraries -- http://dkolf.de/src/dkjson-lua.fsl/home local json = require("dkjson")

-- Interval in seconds of exclusive access to group -- This parameter should be defined before require("Generic") interval = 15

-- Network modules require("Generic")

function handleEvent(domain, object, message)

  1. --[[
  1. *** This function called when core produces some events
  2. Note: it is strongly recommended to not use this function for purposes that differ from call routing in real-time
  1. Parameters:
  2. domain - domain of event, see EVENT_DOMAIN_*
  3. object - reference to sender object
  4. message - JSON encoded message
  1. ]]--
  1. if domain == EVENT_DOMAIN_SESSION
  2. then
  3. local data = json.decode(message)
  4. if (data["Event"] == "Session-Update") or
  5. (data["Event"] == "Session-Start") or
  6. (data["Event"] == "Session-Stop")
  7. then
  8. local flavor = tonumber(data["SessionType"])
  9. if (bit.band(flavor, SESSION_TYPE_FLAG_VOICE) ~= 0) and
  10. (bit.band(flavor, SESSION_TYPE_FLAG_GROUP) ~= 0)
  11. then
  12. setHandOffLock(data, object, 600, 15)
  13. end
  14. end
  15. end

end </syntaxhighlight>