cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
952
Views
1
Helpful
1
Replies

vb.net CTIOS Agent and Manager Montioring

cahafad01
Level 1
Level 1

Hi,

I created a quick simple vb.net program to test a login that successfully connects to the hosts and logs in the agent (successfully); however the manager tool still has the state of that ext as LogOut; but if i do queryagentstate, it shows logged in

This is a quick test of code to see if what I need can be done in this method

    Dim _session As New CTIOSCLIENTLib.Session
    Dim ext As String = "1234"

  Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
        If _session.Connect(getSessionArgs) = 1 Then
            Dim _agt As New CTIOSCLIENTLib.Agent
            _agt.SetValue("AgentID", ext)
            _agt.SetValue("PeripheralID", ext)
            _agt.SetValue("AutoLodgin", "1")
            _session.SetAgent(_agt)
            If _agt.Login(getLoginArgs) = 1 Then
                _agt.SetAgentState(getAgentStateLoginArgs)
                lblerr.Text = "Done"
            Else
                lblerr.Text = "Login Failed"
            End If
        Else
            lblerr.Text = "Failed to Connect to IPC Hosts"
        End If
    End Sub

    Function getSessionArgs() As CTIOSCLIENTLib.Arguments
        Dim _args As New CTIOSCLIENTLib.Arguments
        _args.SetValue("CtiosA", "HostA")
        _args.SetValue("PortA", 42028)
        _args.SetValue("CtiosB", "HostB")
        _args.SetValue("PortB", 42028)
        Return _args
    End Function

    Function getLoginArgs() As CTIOSCLIENTLib.Arguments
        Dim _args As New CTIOSCLIENTLib.Arguments
        _args.SetValue("AgentID", ext)
        _args.SetValue("AgentPassword", ext)
        _args.SetValue("AgentInstrument", ext)
        _args.SetValue("PeripheralID", ext)
        _args.SetValue("AutoLodgin", "1")
        Return _args
    End Function

    Function getAgentStateLoginArgs() As CTIOSCLIENTLib.Arguments
        Dim _args As New CTIOSCLIENTLib.Arguments
        _args = getLoginArgs()
        _args.SetValue("AgentState", 1)        
        Return _args
    End Function

Is there something I'm fundamentally missing?

Thanks

A

1 Reply 1

cahafad01
Level 1
Level 1

Anyone have any ideas on this ? Here is my updated code

  Dim _session As New CTIOSCLIENTLib.Session
    Dim ext As String = "12345"

  Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
        If _session.Connect(getSessionArgs) = 1 Then

            Dim _agt As New CTIOSCLIENTLib.Agent
            _agt.SetValue("AgentID", ext)
            _agt.SetValue("AgentPassword", ext)
            _agt.SetValue("AgentInstrument", ext)
            _agt.SetValue("PeripheralID", ext)
            _agt.SetValue("AutoLogin", "1")

            _session.SetAgent(_agt)
            Threading.Thread.Sleep(5000)
            If _agt.Login(getLoginArgs) = 1 Then
                _agt.SetAgentState(getSetAgentStateArgs)
                lblerr.Text = "Done.  Agent State = " & _agt.GetAgentState.ToString
            Else
                lblerr.Text = "Login Failed"
            End If

        Else
            lblerr.Text = "Failed to Connect to IPC Hosts"
        End If

    End Sub


    Function getSessionArgs() As CTIOSCLIENTLib.Arguments
        Dim _args As New CTIOSCLIENTLib.Arguments
        _args.AddItem("CtiosA", "HOSTA")
        _args.AddItem("PortA", 42028)
        _args.AddItem("CtiosB", "HOSTB")
        _args.AddItem("PortB", 42028)
        Return _args
    End Function

    Function getLoginArgs() As CTIOSCLIENTLib.Arguments
        Dim _args As New CTIOSCLIENTLib.Arguments
        _args.SetValue("AgentID", ext)
        _args.SetValue("AgentPassword", ext)
        _args.SetValue("AgentInstrument", ext)
        _args.SetValue("AutoLogin", "1")
        Return _args
    End Function

    Function getSetAgentStateArgs() As CTIOSCLIENTLib.Arguments
        Dim _args As New CTIOSCLIENTLib.Arguments
        _args.SetValue("AgentState", 2)
        _args.SetValue("AgentID", ext)
        _args.SetValue("AgentInstrument", ext)
        _args.SetValue("AgentPassword", ext)
        Return _args
    End Function

I know the server gets connected and  two things I notice from here

1 - it appears all logins are valid, even with invalid password

2 - if i set agentstate,, and then do getagentstate, its 0

Thanks

A

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: