Genesys CTI User Forum > Genesys-related Development
Cannot get count of agents on breaks using statserver CurrNumberNotReadyStatuses
merve.ugursac:
I have found "RequestPeekStatistic" to get immediate information on a statistic, but I couldn't figure out how to get response.
document link : https://docs.genesys.com/Documentation/PSDK/9.0.x/Developer/StatServer
I have added the below code
[code]
switch (response.Id)
{
case EventStatisticOpened.MessageId:
{
Console.WriteLine($"{methodName} - EventStatisticOpened - Registered statistic for object {agentGroupName} and filter {agentGroupAndFilter}");
RequestPeekStatistic req = RequestPeekStatistic.Create();
req.StatisticId = requestOpenStatistic.ReferenceId;
StatProtocol.Send(requestOpenStatistic);
CustomLogger.Instance().Info($"{methodName} - Response Peek : {requestPeek}");
}
break;
case EventError.MessageId:
Console.WriteLine($"{methodName} - Error opening statistic for object {agentGroupName} and filter {agentGroupAndFilter}");
break;
}
[/code]
But I get the empty result again. I presume to get the count here > message attributes:
2022-04-04 15:44:06,688: [ INFO] GetAgentCountPerBreak() - response : 'EventStatisticOpened' ('22')
message attributes:
REQ_ID [int] = 10002
USER_REQ_ID [int] = 0
TM_SERVER [int] = 1649076246
TM_LENGTH [int] = 0
LONG_VALUE [int] = 0
2022-04-04 15:44:06,688: [ INFO] GetAgentCountPerBreak() - response.Id : 22 - agentGroupName :TestCampaign - breakName : AUX_RC_3 - Message : EventStatisticOpened - ProtocolDescription : Reporting.StatServer
2022-04-04 15:44:06,688: [ INFO] GetAgentCountPerBreak() - Response Peek : 'RequestPeekStatistic' ('1027')
message attributes:
ASSOC_REQ_ID [int] = 10002
hsujdik:
[quote author=merve.ugursac link=topic=12271.msg54748#msg54748 date=1649058412]
Hi,
I appreciate the effort you've put in to help me! Thank you very much! I can get the count now on a sample project that represents mine.
The problem now is, I need the count in an immediate call since on protocol received I read the call count waiting on each virtual queue. Inside this function I need an immediate request-response of this agent-break counts. That was why I had tried to read the response immediately afterwards. I have adjusted my code to read both queries on statProtocol.received but the response of the agentcount is not available when I need that since its not immediate this way.
Do you think there is a way to accomplish this?
For the following :
907 is my virtual queue and result : 1 because I am on the line and the agent of this queue is on break (AUX_RC_3 which will be queried with a referanceId of 10002), so I need the count of agents who are under this virtQueue.
2022-04-04 10:26:56,579: [ INFO] OnWaitingCallsEventInfo()- result : 1 referanceId : 907
2022-04-04 10:26:56,579: [ INFO] OnWaitingCallsEventInfo()- referanceId (queue.DbId) : 907 için result : 1, queue.QueueName :VQ_TestCampaign, queue.QueueMaxAgent :0.
2022-04-04 10:26:56,583: [ INFO] GetCampaingNameFromVirtualQueueId() - QueueId : 907 , VQ_TestCampaign - virtualQueue.Switch.Name : SIPSwitch_DR , AgentGroupName Found : TestCampaign
2022-04-04 10:26:56,886: [ INFO] - OnWaitingCallsEventInfo - Agents on break : [] [b] I needed the count here [/b]
2022-04-04 10:26:56,886: [ INFO] - OnWaitingCallsEventInfo - -- ResultValues , IsCallFirstCall false , FirstCallTime: 4.04.2022 10:26:56
2022-04-04 10:26:56,886: [ INFO] OnWaitingCallsEventInfo()- result : 0 referanceId : 10000 [b] --> AUX_RC_1[/b]
2022-04-04 10:26:56,886: [ INFO] OnWaitingCallsEventInfo()- result : 0 referanceId : 10001 [b]--> AUX_RC_2[/b]
2022-04-04 10:26:56,886: [ INFO] OnWaitingCallsEventInfo()- result : 1 referanceId : 10002 [b] --> AUX_RC_3 --> but I got it here[/b]
2022-04-04 10:26:56,889: [ INFO] OnWaitingCallsEventInfo()- result : 0 referanceId : 10003 [b]--> AUX_RC_4[/b]
Long story short, I need the reponse here :
[code]
switch (response.Name)
{
case "EventStatisticOpened":
Console.WriteLine($"{methodName} - Registered statistic for object {agentGroupName} and filter {agentGroupAndFilter}"); [b]--> here [/b]
break;
case "EventError":
Console.WriteLine($"{methodName} - Error opening statistic for object {agentGroupName} and filter {agentGroupAndFilter}");
break;
default:
Console.WriteLine($"{methodName} - response.Name : {agentGroupName} and filter {agentGroupAndFilter}");
break;
}
[/code]
[/quote]
Getting the Statistic Values is always assyncronous either through Notification or through using the RequestPeekStatistic (note that you cant even use the StatServerProtocol.Request to get it synchronously).
That means that you will always receive the values on the EventInfo as part of the MessageEventArgs on the Method that you set as handler on StatServerProtocol.Received event.
When you use Immediate notification and Insensitivity = 1, you receive an assyncronous EventInfo whenever the statistical value changes.
If you need to do something in your code upon receiving the data, use that handler.
merve.ugursac:
Thank you so very much for all the information.
Sadly in these circumstances I can't accomplish my task. There had to be some way.
cavagnaro:
The way has actually been explained quite well and clearly from hsujdik. You have 2 ways to do it, it is how it works, async or sync, you need to do your effort there to close the circle.
hsujdik:
Just to correct myself:
There are actually two requests that you can get a current information assynchronously: RequestGetStatistisc and RequestGetStatisticEx
Though, I wouldn't recommend using those in your case since this will open and close statistics on Stat Server each time it is polled.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version