[Freeswitch-users] callcenter logout on no registration

Henning Heedfeld heedfeld at gmail.com
Wed Feb 3 20:56:20 UTC 2021


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 at gmail.com>:
> 
> Where would this file be located and what module loads it?
> 
> On Wed, 3 Feb 2021 at 13:08, Henning Heedfeld <heedfeld at gmail.com <mailto:heedfeld at 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 at robotics.net <mailto: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 <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 at freeswitch.com <mailto:sales at 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 at lists.freeswitch.org <mailto:FreeSWITCH-users at 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 at freeswitch.com <mailto:sales at 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 at lists.freeswitch.org <mailto:FreeSWITCH-users at 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 at gmail.com <mailto:david.villasmil.work at 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 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/a3d4339f/attachment-0001.html>


More information about the FreeSWITCH-users mailing list