Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] callcenter logout on no registration


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
nathan at robotics.net
Guest





PostPosted: Wed Feb 03, 2021 6:38 am    Post subject: [Freeswitch-users] callcenter logout on no registration Reply with quote

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?
Quote:
<>
nathan stratton
Back to top
heedfeld at gmail.com
Guest





PostPosted: Wed Feb 03, 2021 8:51 am    Post subject: [Freeswitch-users] callcenter logout on no registration Reply with quote

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



Quote:
Am 03.02.2021 um 12:29 schrieb Nathan Stratton <nathan@robotics.net (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 sales@freeswitch.com (sales@freeswitch.com)https://freeswitch.comOfficial FreeSWITCH Siteshttps://freeswitch.com/osshttps://freeswitch.org/confluencehttps://cluecon.comFreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-usersUNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttps://freeswitch.com
Back to top
david.villasmil.work a...
Guest





PostPosted: Wed Feb 03, 2021 2:51 pm    Post subject: [Freeswitch-users] callcenter logout on no registration Reply with quote

Where would this file be located and what module loads it?

On Wed, 3 Feb 2021 at 13:08, Henning Heedfeld <heedfeld@gmail.com (heedfeld@gmail.com)> wrote:

Quote:
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







Quote:
Am 03.02.2021 um 12:29 schrieb Nathan Stratton <nathan@robotics.net (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?
Quote:
<>
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 (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 (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 (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 (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 Villasmilemail: david.villasmil.work@gmail.com (david.villasmil.work@gmail.com)
phone: +34669448337
Back to top
david.villasmil.work a...
Guest





PostPosted: Wed Feb 03, 2021 3:36 pm    Post subject: [Freeswitch-users] callcenter logout on no registration Reply with quote

Very cool indeed!

On Wed, 3 Feb 2021 at 20:14, Avi Marcus <avi@avimarcus.net (avi@avimarcus.net)> wrote:

Quote:
At conf/autoload_configs/v8.conf.xml

See: https://github.com/signalwire/freeswitch/blob/master/conf/vanilla/autoload_configs/v8.conf.xml


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 (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 (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 Villasmilemail: david.villasmil.work@gmail.com (david.villasmil.work@gmail.com)
phone: +34669448337
Back to top
avi at avimarcus.net
Guest





PostPosted: Wed Feb 03, 2021 4:03 pm    Post subject: [Freeswitch-users] callcenter logout on no registration Reply with quote

At conf/autoload_configs/v8.conf.xml

See: https://github.com/signalwire/freeswitch/blob/master/conf/vanilla/autoload_configs/v8.conf.xml


I didn't know you could set a startup script there or trigger on events... really cool.
Back to top
heedfeld at gmail.com
Guest





PostPosted: Wed Feb 03, 2021 4:44 pm    Post subject: [Freeswitch-users] callcenter logout on no registration Reply with quote

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.


Quote:
Am 03.02.2021 um 20:31 schrieb David Villasmil <david.villasmil.work@gmail.com (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 (heedfeld@gmail.com)> wrote:
Quote:
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



Quote:
Am 03.02.2021 um 12:29 schrieb Nathan Stratton <nathan@robotics.net (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 sales@freeswitch.com (sales@freeswitch.com)FreeSWITCH-users@lists.freeswitch.org (FreeSWITCH-users@lists.freeswitch.org)http://lists.freeswitch.org/mailman/listinfo/freeswitch-usersUNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttps://freeswitch.com



_________________________________________________________________________ The FreeSWITCH project is sponsored by SignalWire sales@freeswitch.com (sales@freeswitch.com) FreeSWITCH-users@lists.freeswitch.org (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 Villasmilemail: david.villasmil.work@gmail.com (david.villasmil.work@gmail.com)
phone: +34669448337


_________________________________________________________________________The FreeSWITCH project is sponsored by SignalWire sales@freeswitch.com (sales@freeswitch.com)https://freeswitch.comOfficial FreeSWITCH Siteshttps://freeswitch.com/osshttps://freeswitch.org/confluencehttps://cluecon.comFreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-usersUNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttps://freeswitch.com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services