VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
nathan at robotics.net Guest
|
Posted: Wed Feb 03, 2021 6:38 am Post subject: [Freeswitch-users] 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 |
|
Back to top |
|
|
heedfeld at gmail.com Guest
|
Posted: Wed Feb 03, 2021 8:51 am Post subject: [Freeswitch-users] callcenter logout on no registration |
|
|
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
|
|
Back to top |
|
|
david.villasmil.work a... Guest
|
Posted: Wed Feb 03, 2021 2:51 pm Post subject: [Freeswitch-users] callcenter logout on no registration |
|
|
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
_________________________________________________________________________
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
|
|
Back to top |
|
|
avi at avimarcus.net Guest
|
|
Back to top |
|
|
heedfeld at gmail.com Guest
|
Posted: Wed Feb 03, 2021 4:44 pm Post subject: [Freeswitch-users] callcenter logout on no registration |
|
|
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
_________________________________________________________________________ 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 |
|
|
|
|
|
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
|