I´ve managed to obtain the desired result using janisk´s stat definition with a RequestOpenStatisticEx.
The only problem is that I´m using the deprecated DnActionMask class, is there any alternative to it?
Thank you all
Code:
RequestOpenStatisticEx request =
RequestOpenStatisticEx.create();
StatisticObject object = StatisticObject.create();
object.setObjectId("MCR_Agent0");
object.setObjectType(StatisticObjectType.Agent);
object.setTenantName("Environment");
object.setTenantPassword("");
Notification notification = Notification.create();
notification.setMode(NotificationMode.Periodical);
notification.setFrequency(2);
DnActionMask mainMask = ActionsMask.createDNActionsMask();
mainMask.setBit(DnActions.WaitForNextCall);
mainMask.setBit(DnActions.CallDialing);
mainMask.setBit(DnActions.CallRinging);
mainMask.setBit(DnActions.NotReadyForNextCall);
mainMask.setBit(DnActions.CallOnHold);
mainMask.setBit(DnActions.CallUnknown);
mainMask.setBit(DnActions.CallConsult);
mainMask.setBit(DnActions.CallInternal);
mainMask.setBit(DnActions.CallOutbound);
mainMask.setBit(DnActions.CallInbound);
mainMask.setBit(DnActions.LoggedOut);
DnActionMask relMask = ActionsMask.createDNActionsMask();
StatisticMetricEx metric = StatisticMetricEx.create();
metric.setCategory(StatisticCategory.CurrentState);
metric.setMainMask(mainMask);
metric.setRelativeMask(relMask);
metric.setSubject(StatisticSubject.DNAction);
metric.setTimeProfile("Default");
metric.setIntervalType(StatisticInterval.GrowingWindow);
request.setStatisticMetricEx(metric);
request.setNotification(notification);
request.setStatisticObject(object);
RESULT:
[INFO,StatServerProtocol,2015-02-03 13:17:07,077] - com.genesyslab.PCT.invoker:149 - 'EventInfo' (2) attributes:
VOID_VALUE [object] = ObjectValue: AgentStatus {
AgentId = MCR_Agent0
LoginId = 7003
Status = 4
Time = 1230848819
Place = PlaceStatus {
PlaceId = SIP_Server_Place9
PlaceStatus = 4
Time = 1230848819
DnStatuses = DnStatusesCollection (size=3) [
[0] DnStatus {
DN Id = 7009
SwitchId = SIP_Switch
GSW DN TYPES = 1
DN Status = 4
Time = 1230848428
Actions = DnActionCollection (size=1) [
[0] DnAction {
Action = WaitForNextCall
Time = 1230848428
ActionDataType = CallData
ConnectionId = 0000000000000000
DNIS = null
ANI = null
UserData = null
}
]
}
[1] DnStatus {
DN Id = chat
SwitchId = null
GSW DN TYPES = 0
DN Status = 4
Time = 1230848819
Actions = DnActionCollection (size=1) [
[0] DnAction {
Action = WaitForNextCall
Time = 1230848819
ActionDataType = CallData
ConnectionId = 0000000000000000
DNIS = null
ANI = null
UserData = KVList:
'MediaType' [str] = "chat"
}
]
}
[2] DnStatus {
DN Id = email
SwitchId = null
GSW DN TYPES = 0
DN Status = 8
Time = 1230848814
Actions = DnActionCollection (size=1) [
[0] DnAction {
Action = NotReadyForNextCall
Time = 1230848814
ActionDataType = CallData
ConnectionId = 0000000000000000
DNIS = null
ANI = null
UserData = KVList:
'MediaType' [str] = "email"
'ReasonCode' [str] = "Break"
}
]
}
]
}
}