Tom Wellige

Longest Waiting Hunt Group

Recommended Posts

This project originates from the Open Queue project here on Swyx Forum and can also be used completely separated from that project. Because of that I decided to showcase it here, in the Open ECR Extensions project.

 

When connecting a call to a group, there are currently the following hunt groups available within SwyxWare:

  • parallel
  • sequential
  • rotary
  • random

A Longest Waiting hunt group selection is missing and therefore there was a need to develop it as a new, stand-alone GSE action. 

 

Whith this extension it is possible to connect a call to a user of a group who has been idle for the longest time of all members of the group. The extension sorts the users of the group by their longest waiting/idle time, and then tries to connect the call in that order until it is either connected or no one in the group took it (not logged in, busy or timeout).

 


 

License

 

Longest Waiting Hunt Group
v1.0.0

 

This is a Swyx Forum Open Source Project.
https://www.swyx-forum.com/forum/64-projects/

 

Copyright (c) 2007-2017 by Swyx Forum
Copyright (c) 2007-2017 by Tom Wellige
All Rights Reserved.

 

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software.

 

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


This project was originally published as part of the Open Queue project:

 

Open Queue Project

v2.x

 

Copyright © 2007-2014 by Swyx Forum

Copyright © 2007-2014 by Tom Wellige

All Rights Reserved.

 

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

 

The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software.

 

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANT-ABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 


 

Installation

 

To successfully use this project you need to follow a few steps:

 

  1. Download and extract the project file into any local folder.
     
  2. Use the "IpPbx File Explorer" (SwyxWare DVD\ Swyx\Tools\File Explorer) to upload the two files from the "ase" subfolder of the download package into the global scope of the SwyxWare database. Alternatively the upload can also be done using the SwyxWare Administration. (Scope: Global / Category: Call Routing scripts).
     
  3. Setup Call Detail Records

    As the SwyxServer does not provide the needed information about “Latest Disconnect Time” of a user directly, the Call Detail Records (CDRs) are used to get this information. So the CDRs must be written into a database. Details on setting up CDRs written into a database can be taken from the Swyx Knowledgebase:

       Write Call Details Records into a database (kb2491)

    The needed SQL script (IpPbxCDR.sql) to setup the IpPbxCDR table should be taken from the above linked article.

    Please note, that the following step expects the call details table to be named IpPbxCDR!

     

  4. Setup Longest Waiting Table and Trigger
    Once the CDRs are written into the database an additional table and a so called trigger must be configured. To do so, use the SQL script LongestWaiting_1.0.0.sql from the SQL folder of the installation package. After having executed this script the created trigger will automatically take newly written CDRs from the SwyxServer, extract the user and disconnect time from it and stores these information within the LongestWaiting table.

    Some more documentation on how to execute SQL statements on an MS SQL Server (i.e. making use of the Microsoft SQL Server Management Studio) can be found in the Open Queue Manual, chapter 3.2 Database.

    In order to get this working correctly two parameters need to be configured within the Parameters table:
       ExtensionRange - the number of digits of SwyxWare’s extension range, default: 3
       PublicLineAccess - number to be dialed for public line access, default: default: 0

    Once everything is configured correctly you can check the proper functionality by having a look into the LongestWaiting table to check if records for current timestamps/calls will be written.

     

  5. The next steps describe the usage of the Longest Waiting extension.

 


 

Usage

 

You can now use the Longest Waiting action directly within a call routing script, as a replacement for the Connect To block. The Longest Waiting action has a similar parameter and return value set so it's in fact nothing more than replacing a Connect To block by the Run GSE Action block to call the Longest Waiting action.

 

  1. Create a new GSE rule and import the rse file (SimpleLongestWaiting.rse) from the "rse" subfolder of the download package (File - Import...).

    lw1.PNG
     
  2. Double click the "Longest Waiting / Run GSE Action" block and switch to the Parameters page

    lw2.PNG

    You can now configure the parameters according your needs.
  • ProviderParam
    Connect string to the database holding the IpPBXCDR and LongestWaiting table
  • Destination
    Number of the SwyxWare usergroup containing all agents who are to handle incoming calls.
  • ConnectTimeout
    Timeout in seconds to connect a call to a certain agent (like in Connect To)
  • Connect  Alert Sound
    Caller will listen to this while call is connected to an agent. Leave it blank (i.e. = "") to use the system a l e r t sound.
  • IgnoreBusyInternal
    0 - If an agent is either internaly or externaly busy he won't get calls deliverted.
    1 - If an agent is internaly busy he will get calls delivert, if he is externaly busy he won't.
     

The Longest Waiting action has the following exits (need to be enabled on the "Links" tab in the Properties windows):

 

  • 0 - Connected
  • 1 - Not Reachable
  • 3 - Disconnected
  • 9 - Failure

 

For Longest Waiting the "Not Reachable" exit means, that for what reason ever the action wasn't able to connect the call to any of the users of the group. This could be because none of them is logged in or all of them are busy, or each connect to attempt to each of the group members ran into a timeout.

 

So in fact, the "Not Reachable" exit is used for all of the possible states (timeout, busy, not delivered), but it's not possible to differ these states afterwards as the action tries to deliver the call to every user of the group, and "Not Reachable" is just the final conclusion over all users, not just one.
 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.