PureConnect

 View Only

Discussion Thread View
  • 1.  ISO: Complete working sample code

    Posted 01-24-2018 19:40
    Can someone provide a simple, complete example of .NET code that gets any statistic? I'm beating myself up trying to get something off the ground, and I cannot get anything working. Specifically I am trying to get the number of active calls in a workgroup. The examples installed with IceLib are too convoluted because they just enumerate everything on the system and it's a series of listboxes, trees, etc. The documentation doesn't really contain complete samples, just snippets of code. I can connect to the server, and enumerate the statistics catalog, but when I try to get any statistic, I just hit a wall. Any help is appreciated, as I am sure it will help others as well. Thanks in advance, Jeff


  • 2.  RE: ISO: Complete working sample code

    Posted 01-25-2018 17:05
    Here is some code that I quickly put together. If anyone has an easier method to get a statistic identifier (especially when we know exactly what we want), I am all ears. I took a lot of liberties here in that I knew the category that the stat resides in (ININ.Workgroup) stat (ININ.Workgroup:InteractionsConnected), and the workgroup (US Hotel Guest Reservations) I wanted to watch. The API is nice that it allows you to query the catalog for the stats you can build (nice for a front end implementation), but it is tedious to generate the same information when you know you want a specific stat with specific parameters. This differs to the ICWS implementation where you can just build your stat key without querying first. There may be better ways to do this, but below is basically what I have done for any stats I need. private static Session _session { get; set; } = new Session(); private static StatisticsManager _sm; private static string stat = "ININ.Workgroup:InteractionsConnected"; private static string wg = "US Hotel Guest Reservations"; private static ParameterValueKeyedCollection parameters = new ParameterValueKeyedCollection(); private static StatisticKey[] statKeys; static void Main(string[] args) { //method that gets a session _session = GetSession(); //get an instance of statistics manager _sm = StatisticsManager.GetInstance(_session); //get an instance of the stats catalog StatisticCatalog catalog = new StatisticCatalog(_sm); //start watching the catalog catalog.StartWatching(); //get the definitions for workgroups //this is required to get a Statistic Identifer ReadOnlyCollection<StatisticDefinition> definitions = catalog.GetStatisticDefinitions("ININ.Workgroup"); //add our parameters //we know these because we've hardcoded them parameters.Add(new ParameterValue(new ParameterTypeId("ININ.People.WorkgroupStats:Workgroup"), wg)); //loop through the definitions to get our StatisticIdentifier foreach (StatisticDefinition definition in definitions) { if(definition.Id.Uri == stat) { //add our statkey to the array of statkeys for the listener statKeys = new StatisticKey[] { new StatisticKey(definition.Id, parameters)}; break; } } //get an instance of the listener. Required to get the value. StatisticListener _listener = new StatisticListener(_sm); //start watching for out statkeys _listener.StartWatching(statKeys); //retrieve the statkey value from the listener StatisticValue sv = _listener[statKeys[0]]; //write the value out. Console.WriteLine(sv.GetDisplayString()); //this method just disconnects the session //should have added StopListening methods to catalog, listener Done(); Console.ReadLine(); }


  • 3.  RE: ISO: Complete working sample code

    Posted 01-25-2018 23:52
    Originally posted by Seanatron;36642
    Here is some code that I quickly put together. If anyone has an easier method to get a statistic identifier (especially when we know exactly what we want), I am all ears. I took a lot of liberties here in that I knew the category that the stat resides in (ININ.Workgroup) stat (ININ.Workgroup:InteractionsConnected), and the workgroup (US Hotel Guest Reservations) I wanted to watch. The API is nice that it allows you to query the catalog for the stats you can build (nice for a front end implementation), but it is tedious to generate the same information when you know you want a specific stat with specific parameters. This differs to the ICWS implementation where you can just build your stat key without querying first. There may be better ways to do this, but below is basically what I have done for any stats I need.
    Thanks for the incredible sample! I'm going to fool with it and see what I can make of it. Initially when I try to get InteractionsConnected, I am getting "N/A". Any idea why? I am able to get some of the other statistics by using the proper statistic names in the "TutorialExample" that came with IceLib. Do some of these operations require special licenses to be issued to the user ID connecting to CIC with IceLib? Jeff


  • 4.  RE: ISO: Complete working sample code

    Posted 01-26-2018 14:24
    The "N/A" could be a few things from what I have seen in the past. The first being that the workgroup does not exist, or there is a spelling error in the name (I am assuming you changed the workgroup below to something in your system). The next would be if the workgroup has never received an interaction. It appears that workgroups that have never received an interaction will display "N/A" for all stats. This is the case in ICBM as well. There are licenses required to view the stats. If you view the IceLib TR on the developer portal, and navigate to the Statistics Catalog in the Getting Started section, each category has a set of required licenses. As an example, the ININ.Workgroup category requires at least one of the following I3_ACCESS_WORKGROUP_SUPERVISOR_PLUGIN or I3_ACCESS_CLIENT license on the user that is attempting to view the stats.


  • 5.  RE: ISO: Complete working sample code

    Posted 02-04-2018 07:39
    Originally posted by Seanatron;36646
    The "N/A" could be a few things from what I have seen in the past. The first being that the workgroup does not exist, or there is a spelling error in the name (I am assuming you changed the workgroup below to something in your system). The next would be if the workgroup has never received an interaction. It appears that workgroups that have never received an interaction will display "N/A" for all stats. This is the case in ICBM as well. There are licenses required to view the stats. If you view the IceLib TR on the developer portal, and navigate to the Statistics Catalog in the Getting Started section, each category has a set of required licenses. As an example, the ININ.Workgroup category requires at least one of the following I3_ACCESS_WORKGROUP_SUPERVISOR_PLUGIN or I3_ACCESS_CLIENT license on the user that is attempting to view the stats.
    Turns out that the account I was using didn't have all of the licenses that it needed. You sir are a genius! I will happily post the code I wrote based on your example, so people who come along will not struggle nearly as hard as I did without your help. If you ever find yourself in Phoenix, the first few rounds are on me. Jeff


Need Help finding something?

Check out the Genesys Knowledge Network - your all-in-one access point for Genesys resources