Advertisement
Borik

Untitled

Jan 29th, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. local function haveValue (a)
  2.         return a and a ~= ""
  3. end
  4.  
  5. local event = event
  6. local freeswitch = freeswitch
  7. freeswitch.consoleLog("info", event:serialize())
  8. local api = freeswitch.API()
  9.  
  10. local uuid = tostring(event:getHeader("Other-Leg-Unique-ID"))
  11. if uuid and uuid ~= "" then
  12.         local recording_leg_uuid = tostring(event:getHeader("Unique-ID"))
  13.         local recording_file_name = tostring(event:getHeader("variable_record_file_name"))
  14.         local a_number = tostring(event:getHeader("Caller-Caller-ID-Number"))
  15.         local b_called_by_a = tostring(api:executeString("hash select/stop_recording_b_by_a/"..recording_leg_uuid))
  16.         local c_called_by_b = tostring(event:getHeader("Caller-Callee-ID-Number"))
  17.         local c_called_by_b_hash = tostring(api:executeString("hash select/stop_recording_c_by_b/"..b_called_by_a))
  18.         if c_called_by_b == c_called_by_b_hash and
  19.            haveValue(c_called_by_b) and
  20.            api:executeString("uuid_getvar " .. uuid .. " sofia_profile_name") == "external" then
  21.                 api:executeString("uuid_broadcast " .. recording_leg_uuid .. " stop_record_session::" .. recording_file_name)
  22.         end
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement