<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)
- --[[
- *** This function called when core produces some events
- Note: it is strongly recommended to not use this function for purposes that differ from call routing in real-time
- Parameters:
- domain - domain of event, see EVENT_DOMAIN_*
- object - reference to sender object
- message - JSON encoded message
- ]]--
- if domain == EVENT_DOMAIN_SESSION
- then
- local data = json.decode(message)
- if (data["Event"] == "Session-Update") or
- (data["Event"] == "Session-Start") or
- (data["Event"] == "Session-Stop")
- then
- local flavor = tonumber(data["SessionType"])
- if (bit.band(flavor, SESSION_TYPE_FLAG_VOICE) ~= 0) and
- (bit.band(flavor, SESSION_TYPE_FLAG_GROUP) ~= 0)
- then
- setHandOffLock(data, object, 600, 15)
- end
- end
- 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)
- --[[
- *** This function called when core produces some events
- Note: it is strongly recommended to not use this function for purposes that differ from call routing in real-time
- Parameters:
- domain - domain of event, see EVENT_DOMAIN_*
- object - reference to sender object
- message - JSON encoded message
- ]]--
- if domain == EVENT_DOMAIN_SESSION
- then
- local data = json.decode(message)
- if (data["Event"] == "Session-Update") or
- (data["Event"] == "Session-Start") or
- (data["Event"] == "Session-Stop")
- then
- local flavor = tonumber(data["SessionType"])
- if (bit.band(flavor, SESSION_TYPE_FLAG_VOICE) ~= 0) and
- (bit.band(flavor, SESSION_TYPE_FLAG_GROUP) ~= 0)
- then
- setHandOffLock(data, object, 600, 15)
- end
- end
- end
end </syntaxhighlight>