Files
fusionpbx/resources/install/scripts/resources/functions/presence_in.lua
Alexey Melnichuk 5cf2e9acd0 Fix small bags and clear code in call_flow.
Move code to turn on/off BLF to separate function.
```Lua
presence_in.turn_lamp( toggle == "false",
  call_flow_feature_code.."@"..domain_name,
  call_flow_uuid
);
```

Close temp file in call_flow_monitor because on Windows it prevent to remove it.
Connect/release to database inside call_flow_monitor loop.
Check successful connection to database in call_flow_monitor loop so monitor did not crash
if connection temporary lost.
2015-10-02 14:02:13 +04:00

23 lines
673 B
Lua

local function turn_lamp(on, user, uuid)
local event = freeswitch.Event("PRESENCE_IN");
event:addHeader("proto", "sip");
event:addHeader("event_type", "presence");
event:addHeader("alt_event_type", "dialog");
event:addHeader("Presence-Call-Direction", "outbound");
event:addHeader("from", user);
event:addHeader("login", user);
event:addHeader("unique-id", uuid);
event:addHeader("status", "Active (1 waiting)");
if on then
event:addHeader("answer-state", "confirmed");
event:addHeader("rpid", "unknown");
event:addHeader("event_count", "1");
else
event:addHeader("answer-state", "terminated");
end
event:fire();
end
return {
turn_lamp = turn_lamp;
}