Advertisement
Borik

Untitled

Feb 17th, 2020
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. local event = event
  2. local freeswitch = freeswitch
  3. freeswitch.consoleLog("info", event:serialize())
  4. local api = freeswitch.API()
  5.  
  6. local function haveValue (a)
  7.         return a and a ~= ""
  8. end
  9.  
  10. local function getValueByUuid(uuid, var)
  11.         local val = api:executeString("uuid_getvar " .. uuid .. " " .. var)
  12.         freeswitch.consoleLog("info", uuid..": "..var.."="..val.."\n")
  13.         return val
  14. end
  15.  
  16. local function viaExternal(uuid)
  17.         return getValueByUuid(uuid, "sofia_profile_name") == "external"
  18. end
  19.  
  20. local other_uuid = event:getHeader("Other-Leg-Unique-ID")
  21. local uuid = event:getHeader("Unique-ID")
  22. if haveValue(uuid) and haveValue(other_uuid) and viaExternal(uuid) and viaExternal(other_uuid) then
  23.         api:executeString("uuid_broadcast " .. uuid .. " stop_record_session::all both")
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement