Author Topic: Detect Agent already logged in other machine or terminal  (Read 11701 times)

Offline eferreyra

  • Jr. Member
  • **
  • Posts: 78
  • Karma: 0
  • Pachu
Detect Agent already logged in other machine or terminal
« on: May 28, 2007, 01:00:36 PM »
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!
« Last Edit: June 04, 2007, 11:24:23 PM by victor »

Offline mark

  • Sr. Member
  • ****
  • Posts: 415
  • Karma: 2
Re: Detect Agent already logged in other machine or terminal
« Reply #1 on: May 28, 2007, 09:51:59 PM »
if you monitor the agent in CCPulse, in extended status you can see the DN that the agent is logged into.

Mark

Offline victor

  • Administrator
  • Hero Member
  • *****
  • Posts: 1416
  • Karma: 18
Re: Detect Agent already logged in other machine or terminal
« Reply #2 on: May 29, 2007, 02:15:18 AM »
[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]

Offline eferreyra

  • Jr. Member
  • **
  • Posts: 78
  • Karma: 0
  • Pachu
Re: Detect Agent already logged in other machine or terminal
« Reply #3 on: May 29, 2007, 03:44:36 PM »
Thanks very helpfull, im going to check the user data, but still i dont see in the example how to detect (assuming already logged AgentId is the same that is loggin now) if is logged on the same machine/terminal or in other.

Im going to pay more attention to user data  ;D


Offline victor

  • Administrator
  • Hero Member
  • *****
  • Posts: 1416
  • Karma: 18
Re: Detect Agent already logged in other machine or terminal
« Reply #4 on: May 30, 2007, 06:14:47 AM »
Well, when you try to connect to TServer and send RequestRegisterAddress, the reply would tell you that somebody is already on it.

Do you mean some other way?

Offline eferreyra

  • Jr. Member
  • **
  • Posts: 78
  • Karma: 0
  • Pachu
Re: Detect Agent already logged in other machine or terminal
« Reply #5 on: June 04, 2007, 03:28:04 PM »
I cant find RequestRegisterAddress, i dont send this and dont see how...

sorry my ignorance...

Offline victor

  • Administrator
  • Hero Member
  • *****
  • Posts: 1416
  • Karma: 18
Re: Detect Agent already logged in other machine or terminal
« Reply #6 on: June 04, 2007, 11:23:47 PM »
Hi, Eferreyra,

do you mean you need the full sample of how to do it?
Sure, let me put something together for you :)

Best regards,
Vic

Offline sy278

  • Jr. Member
  • **
  • Posts: 72
  • Karma: 1
Re: Detect Agent already logged in other machine or terminal
« Reply #7 on: October 12, 2007, 09:04:55 AM »
Where would you use this code? I mean how would you run it, is it in ccPulse or the toolkit?

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Detect Agent already logged in other machine or terminal
« Reply #8 on: October 12, 2007, 05:21:06 PM »
In the toolkit, those agentstatus (1,2,3,4,5) are pretty usefull. :D
No remember where i saw the exact meaning of each on of them, something like:

1= Logged In and Ready
2= Logged In and Not Ready

....

Any ideas?

ChrisKo

  • Guest
Re: Detect Agent already logged in other machine or terminal
« Reply #9 on: October 12, 2007, 06:19:35 PM »
[quote author=cavagnaro link=topic=2258.msg9623#msg9623 date=1192209666]
In the toolkit, those agentstatus (1,2,3,4,5) are pretty usefull. :D
No remember where i saw the exact meaning of each on of them, something like:

1= Logged In and Ready
2= Logged In and Not Ready

....

Any ideas?
[/quote]

I just happened to be digging through the .NET GAD toolkit for 7.2, so I pulled these out for your reference. I'm still VERY new to Genesys, so this might not even be what you're looking for, so I apologize ahead of time if this isn't helpful. But this was found by digging through the .NET Multimedia Sample application and looking at how they reference the AgentStatus property.

public enum AgentMediaAction
{
LOGIN = 0,
LOGOUT = 1,
READY = 2,
NOT_READY = 3,
CREATE_INTERACTION = 4,
}

public enum MediaState
{
UNKNOWN = -1,
OUT_OF_SERVICE = 0,
LOGGED_OUT = 1,
NOT_READY = 2,
BUSY_NOT_READY = 3,
READY = 4,
BUSY_READY = 5,
}

public enum MediaType
{
VOICE = -2,
UNKNOWN = 0,
CHAT = 1,
EMAIL = 2,
}

Offline davidabaron

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Detect Agent already logged in other machine or terminal
« Reply #10 on: May 02, 2008, 09:34:14 PM »
???

This is a GAD issue, logoff and on.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Detect Agent already logged in other machine or terminal
« Reply #11 on: May 02, 2008, 09:56:29 PM »
what? What is a GAD issue?