SOLVED ringotel-change-blf-status-based-on-agent-available-logged-out

Status
Not open for further replies.

Hemant Chaudhari

New Member
Apr 12, 2022
2
1
3
29
Hello Guys,

If you are guys looking for BLF settings for Agent status with FusionPBX then i have done something to do this, I hope this will help you :).

In Ringotel you can configure BLF like below in features > Speed Dial Numbers & Features BLF Indicators.

agent+<Agent Name>

And do changes like below
in agent_status/index.lua

-- Include files
--general functions

require "resources.functions.trim";
local presence_in = require "resources.functions.presence_in"



-------- START-----------
--set the presence to terminated - turn the lamp off:
if (action == "logout") then
freeswitch.consoleLog("info", "[EVENT] [LogOUT]");
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("state", "Active (1 waiting)");
event:addHeader("from", agent_name.."@"..domain_name);
event:addHeader("login", agent_name.."@"..domain_name);
event:addHeader("unique-id", user_uuid);
event:addHeader("answer-state", "terminated");
event:fire();
end

--set presence in - turn lamp on
if (action == "login") then
freeswitch.consoleLog("info", "[EVENT] [LOGIN]");
event = freeswitch.Event("PRESENCE_IN");
event:addHeader("proto", "sip");
event:addHeader("login", agent_name.."@"..domain_name);
event:addHeader("from", agent_name.."@"..domain_name);
event:addHeader("status", "Active (1 waiting)");
event:addHeader("rpid", "unknown");
event:addHeader("event_type", "presence");
event:addHeader("alt_event_type", "dialog");
event:addHeader("event_count", "1");
event:addHeader("unique-id", user_uuid);
event:addHeader("Presence-Call-Direction", "outbound");
event:addHeader("answer-state", "confirmed");
event:fire();
end

if (action == "login") then
blf_status="true"

if string.find(agent_name, 'agent+', nil, true) ~= 1 then
presence_in.turn_lamp( blf_status,
'agent+'..agent_name.."@"..domain_name,user_uuid
);
end
elseif (action == "logout") then
blf_status="false"

if string.find(agent_name, 'agent+', nil, true) ~= 1 then
presence_in.turn_lamp( blf_status,
'agent+'..agent_name.."@"..domain_name
);
end
end
----------END----------------
 

hfoster

Active Member
Jan 28, 2019
684
81
28
34
You can also enable the agent support for BLF subscribes in the /etc/freeswitch/autoload_configs/lua.conf.xml by uncommenting the startup-script:

<!-- FusionPBX: Support BLF for Call Center Agents -->
<!--<param name="startup-script" value="blf_subscribe.lua agent"/>-->

Restart FreeSwitch then you can use 'agent+<AGENT NAME>' as the BLF.
 
Status
Not open for further replies.