callcenter logout on no registration
I am playing around with call center, and noticed many times that users will disconnect (stop registering) but be stuck in queue because they did not log out. How hard would it be to have something that runs every minute and log out all agents that are not registered?
<> nathan stratton
Hi, you can create a hook for this: <configuration name="v8.conf" description="Google V8 JavaScript Plug-Ins"> <settings> <hook event="CUSTOM" subclass="sofia::register" script="event_hook.js"/> <hook event="CUSTOM" subclass="sofia::unregister" script="event_hook.js"/> </settings> <modules> </modules> </configuration> event_hook.js: var fromUser = event.getHeader("from-user"); var fromHost = event.getHeader("from-host"); var fromUri = event.getHeader("from-user") + "@" + event.getHeader("from-host"); var addFifo = "add callqueue" + "@" + fromHost + " user/" + fromUri + " 1 20 0"; var delFifo = "del callqueue" + "@" + fromHost + " user/" + fromUri; var rc; var regType; if (event.getHeader("Event-Subclass") == "sofia::register") { regType = "Register"; } else if (event.getHeader("Event-Subclass") == "sofia::unregister") { regType = "Unregister"; } if (fromUser >= 1001 && fromUser <= 1008) { console_log('info', 'USER ' + fromUri + " " + regType); if (regType == "Register") { rc = apiExecute("fifo_member", addFifo); } else if (regType == "Unregister") { rc = apiExecute("fifo_member", delFifo); } console_log(regType + " " + fromUri + " (User Agent: " + event.getHeader("user-agent") + ")"); rc = apiExecute("fifo", "count callqueue@" + fromHost); console_log("FIFO status: " + rc); } This is based on a JS hook, but it will work with Lua, too. My script does a login / logout for FIFO member if a user between 1001 and 1008 does a SIP login or logout. You have to adapt the commands for mod_callcenter. hth Henning
Am 03.02.2021 um 12:29 schrieb Nathan Stratton <nathan@robotics.net>:
I am playing around with call center, and noticed many times that users will disconnect (stop registering) but be stuck in queue because they did not log out. How hard would it be to have something that runs every minute and log out all agents that are not registered?
<> nathan stratton
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
Where would this file be located and what module loads it? On Wed, 3 Feb 2021 at 13:08, Henning Heedfeld <heedfeld@gmail.com> wrote:
Hi,
you can create a hook for this:
<configuration name="v8.conf" description="Google V8 JavaScript Plug-Ins"> <settings> <hook event="CUSTOM" subclass="sofia::register" script="event_hook.js"/> <hook event="CUSTOM" subclass="sofia::unregister" script="event_hook.js"/> </settings> <modules> </modules> </configuration>
event_hook.js:
var fromUser = event.getHeader("from-user"); var fromHost = event.getHeader("from-host"); var fromUri = event.getHeader("from-user") + "@" + event.getHeader("from-host"); var addFifo = "add callqueue" + "@" + fromHost + " user/" + fromUri + " 1 20 0"; var delFifo = "del callqueue" + "@" + fromHost + " user/" + fromUri; var rc; var regType;
if (event.getHeader("Event-Subclass") == "sofia::register") { regType = "Register"; } else if (event.getHeader("Event-Subclass") == "sofia::unregister") { regType = "Unregister"; }
if (fromUser >= 1001 && fromUser <= 1008) { console_log('info', 'USER ' + fromUri + " " + regType); if (regType == "Register") { rc = apiExecute("fifo_member", addFifo); } else if (regType == "Unregister") { rc = apiExecute("fifo_member", delFifo); } console_log(regType + " " + fromUri + " (User Agent: " + event.getHeader("user-agent") + ")"); rc = apiExecute("fifo", "count callqueue@" + fromHost); console_log("FIFO status: " + rc); }
This is based on a JS hook, but it will work with Lua, too.
My script does a login / logout for FIFO member if a user between 1001 and 1008 does a SIP login or logout. You have to adapt the commands for mod_callcenter.
hth Henning
Am 03.02.2021 um 12:29 schrieb Nathan Stratton <nathan@robotics.net>:
I am playing around with call center, and noticed many times that users will disconnect (stop registering) but be stuck in queue because they did not log out. How hard would it be to have something that runs every minute and log out all agents that are not registered?
<> nathan stratton
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
_________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
-- Regards, David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
At conf/autoload_configs/v8.conf.xml See: https://github.com/signalwire/freeswitch/blob/master/conf/vanilla/autoload_c... I didn't know you could set a startup script there or trigger on events... really cool.
Very cool indeed! On Wed, 3 Feb 2021 at 20:14, Avi Marcus <avi@avimarcus.net> wrote:
At conf/autoload_configs/v8.conf.xml
See: https://github.com/signalwire/freeswitch/blob/master/conf/vanilla/autoload_c...
I didn't know you could set a startup script there or trigger on events... really cool.
_________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
-- Regards, David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
The script is located in your FS script directory, check the path in fs_cli: eval ${script_dir} mod_v8 does the job in this case.
Am 03.02.2021 um 20:31 schrieb David Villasmil <david.villasmil.work@gmail.com>:
Where would this file be located and what module loads it?
On Wed, 3 Feb 2021 at 13:08, Henning Heedfeld <heedfeld@gmail.com <mailto:heedfeld@gmail.com>> wrote: Hi,
you can create a hook for this:
<configuration name="v8.conf" description="Google V8 JavaScript Plug-Ins"> <settings> <hook event="CUSTOM" subclass="sofia::register" script="event_hook.js"/> <hook event="CUSTOM" subclass="sofia::unregister" script="event_hook.js"/> </settings> <modules> </modules> </configuration>
event_hook.js:
var fromUser = event.getHeader("from-user"); var fromHost = event.getHeader("from-host"); var fromUri = event.getHeader("from-user") + "@" + event.getHeader("from-host"); var addFifo = "add callqueue" + "@" + fromHost + " user/" + fromUri + " 1 20 0"; var delFifo = "del callqueue" + "@" + fromHost + " user/" + fromUri; var rc; var regType;
if (event.getHeader("Event-Subclass") == "sofia::register") { regType = "Register"; } else if (event.getHeader("Event-Subclass") == "sofia::unregister") { regType = "Unregister"; }
if (fromUser >= 1001 && fromUser <= 1008) { console_log('info', 'USER ' + fromUri + " " + regType); if (regType == "Register") { rc = apiExecute("fifo_member", addFifo); } else if (regType == "Unregister") { rc = apiExecute("fifo_member", delFifo); } console_log(regType + " " + fromUri + " (User Agent: " + event.getHeader("user-agent") + ")"); rc = apiExecute("fifo", "count callqueue@" + fromHost); console_log("FIFO status: " + rc); }
This is based on a JS hook, but it will work with Lua, too.
My script does a login / logout for FIFO member if a user between 1001 and 1008 does a SIP login or logout. You have to adapt the commands for mod_callcenter.
hth Henning
Am 03.02.2021 um 12:29 schrieb Nathan Stratton <nathan@robotics.net <mailto:nathan@robotics.net>>:
I am playing around with call center, and noticed many times that users will disconnect (stop registering) but be stuck in queue because they did not log out. How hard would it be to have something that runs every minute and log out all agents that are not registered?
<> nathan stratton
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com <https://signalwire.com/> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community <https://signalwire.community/>
Professional FreeSWITCH Services sales@freeswitch.com <mailto:sales@freeswitch.com> https://freeswitch.com <https://freeswitch.com/>
Official FreeSWITCH Sites https://freeswitch.com/oss <https://freeswitch.com/oss> https://freeswitch.org/confluence <https://freeswitch.org/confluence> https://cluecon.com <https://cluecon.com/>
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users> https://freeswitch.com <https://freeswitch.com/>
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com <https://signalwire.com/> Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community <https://signalwire.community/>
Professional FreeSWITCH Services sales@freeswitch.com <mailto:sales@freeswitch.com> https://freeswitch.com <https://freeswitch.com/>
Official FreeSWITCH Sites https://freeswitch.com/oss <https://freeswitch.com/oss> https://freeswitch.org/confluence <https://freeswitch.org/confluence> https://cluecon.com <https://cluecon.com/>
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users> https://freeswitch.com <https://freeswitch.com/>-- Regards,
David Villasmil email: david.villasmil.work@gmail.com <mailto:david.villasmil.work@gmail.com> phone: +34669448337 _________________________________________________________________________
The FreeSWITCH project is sponsored by SignalWire https://signalwire.com Enhance your FreeSWITCH install with disruptive priced SMS and PSTN services. Build your next product on our scalable cloud platform.
Join our online community to chat in real time https://signalwire.community
Professional FreeSWITCH Services sales@freeswitch.com https://freeswitch.com
Official FreeSWITCH Sites https://freeswitch.com/oss https://freeswitch.org/confluence https://cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users https://freeswitch.com
participants (4)
-
Avi Marcus
-
David Villasmil
-
Henning Heedfeld
-
Nathan Stratton