Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local event = event
- local freeswitch = freeswitch
- freeswitch.consoleLog("info", event:serialize())
- local api = freeswitch.API()
- local function haveValue (a)
- return a and a ~= ""
- end
- local function getValueByUuid(uuid, var)
- local val = api:executeString("uuid_getvar " .. uuid .. " " .. var)
- freeswitch.consoleLog("info", uuid..": "..var.."="..val.."\n")
- return val
- end
- local function viaExternal(uuid)
- return getValueByUuid(uuid, "sofia_profile_name") == "external"
- end
- local other_uuid = tostring(event:getHeader("Other-Leg-Unique-ID"))
- local uuid = tostring(event:getHeader("Unique-ID"))
- if haveValue(uuid) and haveValue(other_uuid) then
- local recording_file_name = getValueByUuid(uuid, "record_file_name")
- if haveValue(recording_file_name) and viaExternal(uuid) and viaExternal(other_uuid) then
- api:executeString("uuid_broadcast " .. uuid .. " stop_record_session::" .. recording_file_name)
- end
- local other_recording_file_name = getValueByUuid(other_uuid, "record_file_name")
- if haveValue(other_recording_file_name) and viaExternal(uuid) and viaExternal(other_uuid) then
- api:executeString("uuid_broadcast " .. other_uuid .. " stop_record_session::" .. other_recording_file_name)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement