Genesys CTI User Forum
Genesys CTI User Forum => Genesys-related Development => Topic started by: oceanblue on November 11, 2020, 08:38:17 PM
-
To all PSDK gurus :
I wrote a small Java PSDK(StatServer) script which prints EventInfo event generated by the StatServer reflecting Agent Place/DB info. Following is a sample output :
'EventInfo' (2) attributes:
VOID_VALUE [object] = ObjectValue: AgentStatus {
AgentId = 07008
LoginId = 07008
Status = 8
Time = 1605122633
Place = PlaceStatus {
PlaceId = Test_Agent_Place
PlaceStatus = 8
Time = 1605122633
DnStatuses = DnStatusesCollection (size=1) [
[0] DnStatus {
DN Id = 9100057
SwitchId = SIPSwitch1
GSW DN TYPES = 1
DN Status = 8
Time = 1605122633
Actions = DnActionCollection (size=1) [
[0] DnAction {
Action = NotReadyForNextCall
Time = 1605122633
ActionDataType = CallData
ConnectionId = 0000000000000000
DNIS = null
ANI = null
UserData = KVList:
'ReasonCode' [str] = "Login"
'INTERACTION_WORKSPACE' [str] = "8.5.126.7"
}
]
}
]
}
}
TM_LENGTH [int] = 0
LONG_VALUE [int] = 0
USER_REQ_ID [int] = -1
TM_SERVER [int] = 1605124112
REQ_ID [int] = 53829
My Challenge is that I couldn't find a way to extract various [b]PlaceStatus[/b] and [b]DNStatus[/b] info from the above output. I tried different permutations of casting the EventInfo/message to PlaceStatus/DnStatus objects without any success.
Could someone tell me how it can be done leveraging the current StatServer API methods?
Thank you so much for reading this and I will appreciate your input into it.
cheers,
-
Hi,
You first need to cast it to an AgentStatus, then from there you can get the PlaceStatus and from there the DN Status
I don't have an easy to ready Java example at the moment, but here is a C# example:
[code]
private void OnEventInfo(IMessage theMessage)
{
EventInfo statisticsInfo = theMessage as EventInfo;
if (statisticsInfo != null)
{
if (statisticsInfo.StateValue is AgentStatus)
{
AgentStatus status = (AgentStatus)statisticsInfo.StateValue;
PlaceStatus place_status = status.Place;
string myStatus = place_status.Status.ToString();
DnCollection dn_coll = place_status.DnStatuses;
foreach (DnStatus dn_status in dn_coll)
{
Console.WriteLine("DN IS : " + dn_status.DnId);
}
}
Console.WriteLine("EventInfo:\n" + statisticsInfo + "");
writeLog(statisticsInfo.ToString());
}
}
[/code]
It should be easy enough to convert to Java, if you have problems let me know..
Pete