Author Topic: PSDK - relating Person, Place, DN... How?  (Read 3362 times)

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
PSDK - relating Person, Place, DN... How?
« on: January 16, 2017, 05:07:39 PM »
Hi guys,

I have a use case where I would like to start with a person, determine what Place the person is currently logged into, then determine what DN(s) are in that place.

There are many useful PSDK methods such as CfgQueryPerson, CfgQueryPlace, CfgQueryDN, CfgPerson, CfgPlace, CfgDN.

However upon looking at the API docs, I can't seem to find the bits of information I would need to relate the three types of objects.

For example, CfgPerson:
- There is a nice AgentInfo reference on a CfgPerson
- AgentInfo does have a Place property, however the description of the property notes, "...identifier of the CfgPlace assigned to the agent by default".  Well, in my particular use case the agents dont have default places...  They type their places in on their own.  This property is always null unless I have a default place assigned.

CfgPlaceQuery:
- Looks like I can query a place by its dbid, a dn dbid (dn that is assigned to this particular place), PersonDbid (however PersonDbid is only populated if there is a default place assigned to the person).

CfgDNQuery:
- I can plug in a PlaceDbid in the query, cool - I can finally start with an extension and get the places the extension is added to

So, it appears I can relate a DN to a Place.  However I have not been able to locate a way to associate a Person with either a Place or DN unless there is a default place associated with the person.

Anyone have ideas or thoughts on this?

Regards,
Andrew


Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 123
  • Karma: 2
Re: PSDK - relating Person, Place, DN... How?
« Reply #1 on: January 17, 2017, 03:04:50 AM »
The PSDK your using is querying config data. There is no link between a person and a place/dn other than the default place.

Any user can login with any DN/place as long as they know it.

Sounds like what you might actually be after is reporting data, not SDK API calls.

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: PSDK - relating Person, Place, DN... How?
« Reply #2 on: January 17, 2017, 10:29:33 AM »
Hi Andrew,

Unless the person has a default Place assigned in CME there is no link in CME between a Person and and Place or DN.

There are two options, you could connect to TServer and monitor every Extension DN on TServer to determine when an Agent logs onto a DN or the preferred way would be to to use the reporting SDK to get the stat that will give you the status of an Agent.

The stat should be configured similar to:
Category: CurrentState
MainMask: *
Objects:Agent
Subject: DNStatus

Which will provide an EventInfo event that looks like below, from that you can get the Place and DN the Agent is logged onto:

{17:01:17; 10:25:36.782} DEBUG [w I/O worker #4] [commons.protocol.DuplexChannel]  Handling message: 'EventInfo' (2) attributes:
TM_LENGTH [int] = 0
REQ_ID [int] = 118
VOID_VALUE [object] = ObjectValue: AgentStatus {
  AgentId = MCR_Agent0
  LoginId = 5000
  Status = 4
  Time = 1484648737
  Place = PlaceStatus {
    PlaceId = SIP_Server_Place3
    PlaceStatus = 4
    Time = 1484648737
    DnStatuses = DnStatusesCollection (size=4) [
      [0] DnStatus {
        DN Id = chat
        SwitchId = null
        GSW DN TYPES = 0
        DN Status = 4
        Time = 1484648736
        Actions = DnActionCollection (size=0) [
        ]
      }
      [1] DnStatus {
        DN Id = email
        SwitchId = null
        GSW DN TYPES = 0
        DN Status = 4
        Time = 1484648737
        Actions = DnActionCollection (size=0) [
        ]
      }
      [2] DnStatus {
        DN Id = facebooksession
        SwitchId = null
        GSW DN TYPES = 0
        DN Status = 4
        Time = 1484648737
        Actions = DnActionCollection (size=0) [
        ]
      }
      [3] DnStatus {
        DN Id = 7003
        SwitchId = SIP_Switch
        GSW DN TYPES = 1
        DN Status = 4
        Time = 1484648736
        Actions = DnActionCollection (size=0) [
        ]
      }
    ]
  }
}

Hope this helps,

Pete.

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: PSDK - relating Person, Place, DN... How?
« Reply #3 on: January 17, 2017, 02:52:44 PM »
Thanks to both of you.  Seems the reporting SDK would be the most appropriate route as Pete suggests.  I will run with that.  Thanks again!

Regards,
Andrew