Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: Elango on June 26, 2015, 09:00:59 AM

Title: Current Agent State
Post by: Elango on June 26, 2015, 09:00:59 AM
Hi Professionals, This is my first topic in this porum so I would like to ask apologise to everyone, if anything given is wrong.

I would like to get a particular agent "Current State" along with the "Time". Is it possible ? If yes can you guys help me with it...

Title: Re: Current Agent State
Post by: Kubig on June 26, 2015, 09:12:43 AM
What type of application - CCP+, any custom app? For historical or real-time reporting purposes?
Title: Re: Current Agent State
Post by: Elango on June 26, 2015, 09:29:31 AM
Hi Kubig,
Its a custom app, for real-time reporting purpose.
Title: Re: Current Agent State
Post by: Kubig on June 26, 2015, 11:05:44 AM
use following stat configuration:

[list]
[li]Category = CurrentState[/li]
[li]MainMask = *[/li]
[li]Objects = Agent[/li]
[li]Subject = AgentStatus[/li]
[/list]
Title: Re: Current Agent State
Post by: Elango on June 26, 2015, 11:57:48 AM
Hi Kubig,

I used ur configurations and got the below response bt still there is no exact time value.

[b]Agent Id      : xxxxx
Login Id      : yyyyy
Object Type : Agent
Place            :
      Place ID          : zzzzz
      Place Status  : 23
      Time              : 1435367705
Place Count  : 1
Status          : 23
Time            : 1435367705
[/b]

The time value which I got is about 100 days (even I restart the server).
Title: Re: Current Agent State
Post by: cavagnaro on June 26, 2015, 12:47:16 PM
Weird because the metric begins to be collected only the first time StatServer is requested for it. What I mean is, if you created this today, Yesterday StatServer was not collecting any information about this agent as had no clue of that metric...so, how can it be 100 days?
From where are those "logs" you show?

Enviado de meu C6602 usando Tapatalk

Title: Re: Current Agent State
Post by: Elango on June 26, 2015, 01:12:30 PM
Hi cavagnaro,

What does

[b]Time            : 1435367705[/b]

meant to be, in the above ? Is it the time duration of agent state : 23 ?
Title: Re: Current Agent State
Post by: Kubig on June 26, 2015, 01:29:02 PM
I think it should be time, when the current state has started. The number 23 is type of the current status.
Title: Re: Current Agent State
Post by: Elango on June 26, 2015, 01:50:59 PM
Yeah,
that is, when iam converting this [b]1435367705[/b] seconds to Time Format it shows me nearly 100 Days...
Title: Re: Current Agent State
Post by: Kubig on June 26, 2015, 01:55:44 PM
Are you sure that the value is in seconds and not the unix time format?
Title: Re: Current Agent State
Post by: Elango on June 26, 2015, 01:59:01 PM
Yeah Sure, I have tried all kinds of possible conversions...But everything is resulted in more than 50 Days.
Title: Re: Current Agent State
Post by: cavagnaro on June 26, 2015, 02:00:00 PM
Ok, and this metric is new at all?
again, from where are these logs?
Show StatServer answer, not your app one
Title: Re: Current Agent State
Post by: Kubig on June 26, 2015, 02:11:22 PM
Do not what conversion did you try, but I tried the UNIX time and it is equals or greater than 50 or 100 days.
Title: Re: Current Agent State
Post by: Elango on June 26, 2015, 02:58:28 PM
Take a look at the Server Log :


23:36:43.978 Trc 04541 Message NewAPIOpenStat received from 632 ( 'MyApp')
2015-06-26 23:36:43> Client: Message from MyApp(632) received
2015-06-26 23:36:43> Client: Message 'NewAPIOpenStat'
'TM_NOTIFICATION_FREQ' 1
'NOTIFICATION_MODE' 'TimeBasedNotification' (1)
'INSENS_PERCENTAGE' 1
'VOID_VALUE' TKVList Length 28
'Insens' 1
'Filter' ''
'USER_REQ_ID' 1
'TENANT_ID' 'Resources'
'OBJECT' 'Agent' (0)
'OBJECT_ID' 'P02'
[b]'STAT_TYPE' 'CurrentAgentState'[/b]
'REQ_ID' 1
2015-06-26 23:36:43> Client: Message 'OpenStat'
'CREATE_SUSPENDED' 'no'
'FILTER' ''
'DistByConnID' 0
'TM_NOTIFICATION_FREQ' 1
'NOTIFICATION_MODE' 'TimeBasedNotification' (1)
'INSENS_PERCENTAGE' 1
'STAT_TYPE' 'CurrentAgentState'
'USER_REQ_ID' 1
'REQ_ID' 1
'SUBJECT' 'AgentStatus' (2)
'CATEGORY' 'CurrentState' (10)
'TENANT_ID' 'Resources'
'OBJECT_ID' 'P02'
'OBJECT' 'Agent' (0)
'VOID_VALUE' TKVList Length 28
'Insens' 1
'Filter' ''
'MainMask' all statuses set
'RelMask' all statuses clear
2015-06-26 23:36:43> Client: Sending message to MyApp(632)
2015-06-26 23:36:43> Client: Message 'StatOpened' [stats:0x4bdfba0]
'LONG_VALUE' 0
'TM_LENGTH' 0
'TM_SERVER' 1435376203
'USER_REQ_ID' 1
'REQ_ID' 1
2015-06-26 23:36:44> Client: Sending message to MyApp(632)
2015-06-26 23:36:44> Client: Message 'Info' [stats:0x4bdfba0]
'LONG_VALUE' 0
'TM_LENGTH' 0
'TM_SERVER' 1435376204
'USER_REQ_ID' 1
'REQ_ID' 1
Title: Re: Current Agent State
Post by: cavagnaro on June 26, 2015, 03:19:39 PM
Ok, main mask should be
*, ~NotMonitored, ~Monitored

Try that

Enviado de meu C6602 usando Tapatalk

Title: Re: Current Agent State
Post by: Elango on June 26, 2015, 03:24:42 PM
No Change, result is same as it
Title: Re: Current Agent State
Post by: cavagnaro on June 26, 2015, 03:26:44 PM
Add ~LoggedOut

Enviado de meu C6602 usando Tapatalk

Title: Re: Current Agent State
Post by: Adam G on June 26, 2015, 03:33:10 PM
Hope this helps:

The "Time" you are referring to [i]IS [/i]the UNIX EPOCH:

1435376204 = GMT: Sat, 27 Jun 2015 03:36:44 GMT

Conversion utilities exist on the web and other Posts on the Forum explain how to convert this to a standard time format.  Basically, add 1435376204 [i]seconds [/i]to 00:00:00 01/01/1970...
Title: Re: Current Agent State
Post by: Elango on June 26, 2015, 03:38:41 PM
[b]cavagnaro[/b], still the result is same....
[b]adamgill[/b], I can understand what it was, bt how it wil help in getting the time value for current agent state ?
Title: Re: Current Agent State
Post by: Adam G on June 26, 2015, 03:58:46 PM
I think you are building a real-time interface, yes?

The TIME you can see allocated is the [i]exact [/i]time/date that the STATUS of the Agent Object was reported by the StatServer.  If you are building an App (and this is [i]not [/i]CCP+), then you need to apply a local calculation within the App which counts the amount of time that has past, since the last STATUS update TIME from the StatServer.  You will also need to send a regular request to the StatServer, to get regular STATUS updates.  Or, if your App is 3rd party registered (as an Application in CIM), then that should be easy enough to set up as a regular (poll) request to a StatServer.

CCP+ does all of these things by design and I think you will need to find a way to emulate;

The TIME conversion to your local time zone.
The time that has elapsed since the last TIME update of the STATUS from the StatServer.
Regular polling of Updates from the StatServer to your App - or register the App with the StatServer to enable you to specify a polling interval.
Title: Re: Current Agent State
Post by: Elango on June 29, 2015, 10:51:50 AM
Hi all...
  Very much thanks to everyone, I got the solution by the following calculation


[b]DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0);
DateTime istdate = TimeZoneInfo.ConvertTimeFromUtc(origin.AddSeconds(Convert.ToDouble(1435376204)),TimeZoneInfo.FindSystemTimeZoneById("India Standard Time")); [/b]  -----> This will convert the starting time for the agent's current status to GMT+5.30.

[b]DateTime curetime=TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById("India Standard Time"));[/b]  -----> This will convert the current time to GMT+5.30

[b]TimeSpan diff = curetime - istdate;[/b] ------> This will get the exact duration of the agent's current state(in seconds).
Title: Re: Current Agent State
Post by: Kubig on June 29, 2015, 11:02:33 AM
I said you that the time is in Unix format :) :D ;D
Title: Re: Current Agent State
Post by: Elango on June 29, 2015, 11:03:43 AM
Yeah Thanks Kubig...
:D :D :D
Title: Re: Current Agent State
Post by: Adam G on June 29, 2015, 03:44:13 PM
::)