[quote author=eferreyra link=topic=2258.msg8187#msg8187 date=1180357236]
Hi, there is any way of detect if an Agent is already logged in a T-Seerver from other machine ?
I know when i receive event registered if AgentID is set then already have an agent logged in the DN, i receive error as well, but this happens if is logged from the same machine (other application) and from other machine, there is any way to detec each case ?
Thanks!
[/quote]
Hi,
there are many way to detect it. Do you want to do it programatically (how do you spell it???!) or via visual inspection? If you are trying to do it programatically (or whatever way you are trying to spell it), all you need to do is look at the user-data passed along EventRegistered: it will tell you if agent is already registered into this DN or not. It will also tell you which agent registered as well.
Here is a sample code of how to detect agent logged in and also as a bonus, connid of the call as well
It is a bit messy, but it works just fine
Feel free to play with it and make things better!
[color=green][size=8pt]Private Sub TExtension1_TEventRegistered(Index As Integer, EventInfo As DesktopToolkitX.TEventInfo)
'first let's check if agent is logged in or not
Dim count, count2 As Integer
Dim total_count As Integer
Dim userList As DesktopToolkitX.CTKVList
Dim userPair As DesktopToolkitX.CTKVPair
Dim agentStatus As Integer
Dim line As DesktopToolkitX.TLine
Set userList = EventInfo.Extensions
total_count = userList.GetCount
For count = 0 To total_count - 1
Set userPair = userList.Get(count)
If userPair.Key = "AgentStatus" Then
agentStatus = userPair.NumValue
' let's see if we need to log someone out!
If (Me.chkForcedLogout) Then
Select Case agentStatus
'logged out
Case 0:
'logged in
Case 1, 2, 3, 4, 5:
'agent is logged in
gAgentLoginID = EventInfo.AgentID
'check if user checked logout checkmark
' we need to logout this agent
For count2 = 0 To DN_Count - 1
If (Me.TExtension1(count2).TDN = EventInfo.ThisDN) Then
Me.TExtension1(count2).TLogout
End If
Next count2
End Select
End If
Else
If userPair.Key = "conn-1" Then
'let's get the connid
gConnID = userPair.StringValue
If Me.chkForcedRelease.Value = 1 Then
For count2 = 0 To DN_Count - 1
If (Me.TExtension1(count2).TDN = EventInfo.ThisDN) Then
'let's try to release this call
Me.TExtension1(count2).TGetActiveCallObj.THangUp
End If
Next count2
' line.ExtensionName = Me.TExtension1(2).Name
' line.THangUp
End If
End If
End If
[/size][/color]