Genesys CTI User Forum > Genesys-related Development
Reporting SDK
carpio:
Hello,
Im trying to get a specific value of a statserver request
[code] StatServerProtocol stat_prot = new StatServerProtocol(new Endpoint(ip,port));
stat_prot.Open();
var obj = StatisticObject.Create("1234@switch", StatisticObjectType.RegularDN, "Environment");
var metric = StatisticMetric.Create("CurrentDNState");
var notification = Notification.Create(NotificationMode.Immediate, 1, 1);
RequestGetStatistic req = RequestGetStatistic.Create(obj, metric);
req.ReferenceId = 1;
var response = stat_prot.Request(req);
MessageBox.Show(response.ToString());[/code]
the response is showing me some values but how can I get just the specific values?
for example, I would liket to get the dn status and time.
carpio:
it would have been to nice ;D
Then I'll have to do it this way.
Thanks
hsujdik:
If I remember well, you can cast the response as an EventInfo object... I'll try to find my old codes experimenting on this to give a better response.
Edit:
I used something like this (on Java):
[code]
StatServerProtocol primaryStatServer = new StatServerProtocol(primary, primaryConnectTimeout);
primaryStatServer.setMessageHandler(statHandler);
...
...
private MessageHandler statHandler = new MessageHandler() {
@Override
public void onMessage(Message message) {
if (null == message) return;
if (message.messageName().equalsIgnoreCase("EventInfo")) {
EventInfo ev = (EventInfo) message;
metric.setLastMetricValue(ev.getIntValue());
}
}
};
[/code]
In the code above, every time I get a message of type EventInfo from StatServer, I update my own internal object "metric" with the stat value by using the .getIntValue() method.
carpio:
Thanks hsujdik, I will try it later
carpio:
I have tried ou code but the I do not know the metric function in c#
This is my code:
[code]IMessage message = ((MessageEventArgs)e).Message;
if (message.Name.Equals("EventInfo"))
{
EventInfo ev = (EventInfo)message;
Console.WriteLine(ev.StateValue.ToString());
}[/code]
I get this as result so far:
AgentId = testagent
AgentStatus = 23
Time = 1508410088
PlaceStatus = PlaceStatus = 23
Time = 1508410088
LoginId = LoggedOut
If I try code:[code]if (message.Name.Equals("EventInfo"))
{
EventInfo ev = (EventInfo)message;
Console.WriteLine(ev.IntValue.ToString());
}[/code]
I get the result 0 no matter if the agent is logged in or not.
Is it possible to get the agentStatus without to write a parse method?
Navigation
[0] Message Index
[#] Next page
Go to full version