SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Siemens HiPath ProCenter SDK Tutorials for CTI Developers using VB.NET and C-Sharp

How to get AgentKey value of an Agent using HiPath ProCenter Toolkit (SDK)


In Siemens HiPath ProCenter Applications developed for CRM telephony integration, the Agents are identified with their AgentId values. Despite the use of AgentId value on the User Interface (UI) of the HiPath ProCenter Applications, every process related to the Agents in SDK (HiPath ProCenter Toolkit) Applications are done by referencing the AgentKey vaues.

The exchange between AgentId and AgentKey in the SDK (HiPath ProCenter Toolkit) can be done by using the below funtion named "GetAgentKey"

AgentId values are set as 6 digit string values. The users actually does not work or even does not know the AgentKey values. There is a one-to-one relation between AgentId and AgentKey. But as a developer, in your CTI (Computer Telephony Integration) projects, you have to deal with the AgentKey properties of the Agent object.

The below codes are developed by using VB.NET and Visual Studio.Net (VS.NET 2003). You can easily convert the function to any other language syntax.

I assume that the necessary steps for developing Siemens HiPath ProCenter Toolkit (SDK) within the .Net environment summarized in the article named Creating CTI Applications using HiPath ProCenter Toolkit on Visual Studio .Net are applied.

In the beginning of our code we can import the HiPathProCenterLibrary namespace

Imports HiPathProCenterLibrary
Code

Then within our class, we can define shared HiPath ProCenter objects

Public Shared objHPPC As HiPathProCenterManagerbr /> Public Shared objAdmin As AdministrationManager
Public Shared objMedia As MediaManager
Public Shared objRouting As RoutingManager
Code

And after creating the HiPathProCenterManager object, initializing it and hiring the AdministrationManager object, we can refer those objects within our project when we need.

Dim objHPPC = New HiPathProCenterLibrary.HiPathProCenterManager
Call objHPPC.Initialize("RRServer", enEventModes.EventMode_IgnoreEvents, 6050)
Dim objAdmin As HiPathProCenterLibrary.AdministrationManager
objAdmin = objHPPC.HireAdministrationManager(enEventModes.EventMode_IgnoreEvents)
Code

The GetAgentKey function has a string parameter named AgentId passing the AgentId of an Agent whose AgentKey we expect to return from the function.

The code queries the objAdmin object for users. And checks the AgentId values to catch where the AgentId parameter and the User object's (HiPathProCenterLibrary.User) AgentId property equals to each other. When we catch this equality, then we can say that the Agent we are querying is the desired user and we can return the user's Key property.

Private Function GetAgentKey(ByVal AgentId As String) As Integer

Dim AgentKey As Integer

Dim user As HiPathProCenterLibrary.User

AgentKey = -1

For Each user In objAdmin.QueryUsers()
 If user.ID = AgentId Then
  AgentKey = user.Key
  Exit For
 End If
Next

user = Nothing

Return AgentKey

End Function
Code

The GetAgentKey function can be used within a complex CTI (Computer Telephony Integration) application developed for Siemens HiPath ProCenter developed with HiPath ProCenter Toolkit (SDK).


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.