Genesys CTI User Forum > Genesys-related Development

Get same data as from CC Pulse

(1/3) > >>

CallMeMaybe:
Hello!

I have tried to read all the development guide and googled a bunch but I must admit defeat!

We have a CC pulse stat server running and I want to get some of the same stats as visible in CC pulse but it does not seem to work as intended.
I am using the C# SDK


I want to get total number of CallsAnswered, the stat server automatically resets this stat at midnight, so I just want to peek/get the statistic from the same server
I tried to do this:

[code]
StatServerProtocol protocol = new StatServerProtocol(new Endpoint("host", port));
protocol.Open();

// Create Request
RequestGetStatistic req = RequestGetStatistic.Create();

//Request object
StatisticObject statobj = StatisticObject.Create();
statobj.ObjectId = "agent001";
statobj.ObjectType = StatisticObjectType.Agent;
statobj.TenantName = "Resources";
statobj.TenantPassword = "";
req.StatisticObject = statobj;

// Metrics
StatisticMetric statmet = StatisticMetric.Create("CallsAnswered");
req.StatisticMetric = statmet;

var response = protocol.Request(req);
Console.WriteLine(response);
[/code]


This is the statistic defined on the server:

[CallsAnswered]
Category=TotalNumber
Description=Total number of inbound and outbound calls answered by agents.
MainMask=CallAnsweredInbound, CallAnsweredOutbound
Objects=Agent, Place, GroupAgents, GroupPlaces
Subject=DNAction

Out of our ~50 agents it only works for like 5 agents. Is my code correct? Maybe issue is on stat server? Some other statistics work fine such as (AgentExtendedStatus)

I also tried RequestGetStatisticEx with defining my own masks etc like so:

[code]
RequestGetStatisticEx reqex = RequestGetStatisticEx.create();
var mainMask = new DNActionsMask();
mainMask.SetBit(DnActions.CallAnsweredInbound);
mainMask.SetBit(DnActions.CallAnsweredOutbound);
var relmask = new DNActionsMask();
relmask.ClearAll();
reqex.StatisticObject = StatisticObject.Create();
reqex.StatisticObject.ObjectId = "agent001";
reqex.StatisticObject.ObjectType = StatisticObjectType.Agent;
reqex.StatisticObject.TenantName = "Resources";
reqex.StatisticObject.TenantPassword = "";

reqex.StatisticMetricEx = StatisticMetrixEx.Create();
reqex.StatisticMetricEx.TimeProfile = "Default";
reqex.StatisticMetrixEx.Category = StatisticCategory.TotalNumber;
reqex.StatisticMetrixEx.Subject = StatisticSubject.DNAction;
reqex.StatisticMetricEx.MainMask = mainMask;
reqex.StatisticMetricEx.RelativeMask = relmask;
regex.StatisticMetricEx.IntervalType = StatisticInterval.SinceLogin;
protocol.Send(reqex);
while(true)
{
  var response = protocol.Receive();
  Console.WriteLine(response);
}
[/code]


In both examples I get back Eventinfo but the value is incorrect.
Additional info:
We got a main server and backup server in CC pulse idk if it has any influence.

hsujdik:
I wouldn't recommend using RequestGetStatistic for cumulative statistics (TotalNumber, TotalTime, AverageNumber, etc). It works well for Current numbers, but can have some weird behavior when using with cummulative numbers.

Instead, use RequestOpenStatistic (or RequestOpenStatisticEx) and handle the EventInfo in your EventHandler function.

Take a look on this code that could be similar to your needs:
http://www.sggu.com/smf/index.php/topic,12271.msg54747.html#msg54747

CallMeMaybe:
[quote author=hsujdik link=topic=12333.msg54986#msg54986 date=1659708228]
I wouldn't recommend using RequestGetStatistic for cumulative statistics (TotalNumber, TotalTime, AverageNumber, etc). It works well for Current numbers, but can have some weird behavior when using with cummulative numbers.

Instead, use RequestOpenStatistic (or RequestOpenStatisticEx) and handle the EventInfo in your EventHandler function.

Take a look on this code that could be similar to your needs:
http://www.sggu.com/smf/index.php/topic,12271.msg54747.html#msg54747
[/quote]


Hey!

When you say cumulative, you mean TotalNumber being total inbound and outbound calls? Maybe there is another statistic I could pull? I am really only looking for the amount of inbound calls the agent has received on the day I run my application, I also don't want to periodically listen for events I just kind of want to read it and then close it.

Is there any example for Current number because I am not sure what you mean by that? (I thought Totalnumber of CallsAnswered was current number)

cavagnaro:
If you want to read and close then you are asking for Historical info, not real time.
Real time metrics are only populated by StatServer upon an application requests it to monitor such Metric. Unless you copy exactly what CCPulse is doing and requesting, you need to monitor your own Metric, which will begin to populate since the moment you request it.

hsujdik:
[quote author=CallMeMaybe link=topic=12333.msg54987#msg54987 date=1659718360]
[quote author=hsujdik link=topic=12333.msg54986#msg54986 date=1659708228]
I wouldn't recommend using RequestGetStatistic for cumulative statistics (TotalNumber, TotalTime, AverageNumber, etc). It works well for Current numbers, but can have some weird behavior when using with cummulative numbers.

Instead, use RequestOpenStatistic (or RequestOpenStatisticEx) and handle the EventInfo in your EventHandler function.

Take a look on this code that could be similar to your needs:
http://www.sggu.com/smf/index.php/topic,12271.msg54747.html#msg54747
[/quote]


Hey!

When you say cumulative, you mean TotalNumber being total inbound and outbound calls? Maybe there is another statistic I could pull? I am really only looking for the amount of inbound calls the agent has received on the day I run my application, I also don't want to periodically listen for events I just kind of want to read it and then close it.

Is there any example for Current number because I am not sure what you mean by that? (I thought Totalnumber of CallsAnswered was current number)

[/quote]

TotalNumber is a cummulative (or rather, aggregated) statistic. All the statistics that has some amount calculated over time is a cummulative/aggregated statistic. For instance - Total Number of call answered = total number since when?? Then, the TimeProfile comes into play, to let StatServer know the span which the numbers are valid. The Default time profile, for example, is a Growing profile that resets at midnight. You can have different ones, like "SinceLogin", or a Window of time (e.g. last 24 hours, last 1 hour, total within the hour, etc).

That said, for all those aggregated statistics, statserver needs to know that they will be needed and they need to be persisted. And that's where the RequestOpenStatistic comes into play.

Per the Stat Server's users guide:
[quote]
Persistent Statistics

The term persistence means that a statistic, once requested by a client, continues to be calculated even after the client disconnects. Stat Server treats all requested statistics as persistent. When a statistic that is not already available on the server side is requested, it is automatically added to the Persistent Statistic Pool. Stat Server continues to calculate the statistic even after the requesting client closes it. When the client reopens the request for this statistic, the Persistent Statistic Pool resends it with accurate values to the client. By default, a statistic becomes obsolete and is removed from this pool three days after a client last requested it.
[/quote]

Now, If somebody had opened this statistic* before within the last 3 days, you should receive the correct return either with RequestOpenStatistic or RequestGetStatistic. However, my suggestion was merely because I have seen before RequestGetStatistic not as it should sometimes, so I always take the RequestOpenStatistic approach for any cummulative/aggregated statistic. Should you really need to get with RequestGetStatistic and are getting wrong values (given that this Very Same Statitistic* has been used in the previous 3 days), you should talk to Genesys Technical Support because might be some bug.

Now, I have marked "statistic" with an * for the following reason:
An statistic means a combination of things, and if one of those things is different, it is another statistic:
Object + Statistical Type + Time Profile + Time Range(s) (when applicable) + Filter, being Statistical Type a combination of Category + Main Mask + Relative Mask + Formula

So, for example, if you have used an statistic with Time Profile "A" in the past, it is still open, and then you need the very same data for the same object, but with Time Profile "B", it will start counting from the time you first requested (and will continue for as long as Stat Server keeps it open).

Navigation

[0] Message Index

[#] Next page

Go to full version