[Freeswitch-users] callcenter logout on no registration
Henning Heedfeld
heedfeld at gmail.com
Wed Feb 3 13:07:37 UTC 2021
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 at 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 at 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 at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> https://freeswitch.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20210203/dc6f2b1c/attachment.html>
More information about the FreeSWITCH-users
mailing list