Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: JP on July 19, 2007, 10:07:10 PM

Title: Finding open phone calls with the ActiveX toolkit
Post by: JP on July 19, 2007, 10:07:10 PM
I am developing an activex softphone application using the ActiveX Toolkit/TLib SDK, referring to the VB6 starter app as an example.

A limitation I have noticed in both my application and the activex starter app, is that if the application closes in the middle of a call, and is then reopened, the softphone(s) after re-opening no longer realizes that the agent was/is on a call. Even if after selecting line 1, I can't release the call or do anything with that line without it throwing an error.

Via a TEventsLog control I can see what looks to be the call information (with a key of "conn-1") in the Extensions collection of the EventRegistered event. Our previous softphone solution was able to be closed in the middle of a call, then reopened, and return to the state it was in (or recognizing the lines that were open.)

How do I implement this functionality? Is there any way to restore the line objects to the state they were in before the app closed?
Title: Re: Finding open phone calls with the ActiveX toolkit
Post by: victor on July 20, 2007, 05:21:33 AM
Hi, JP,

there is a source code in developer forum that includes part that is needed to identify the existing calls on the dn.
It uses conn-1 and status fields to determine the current state of DN and then you cat set your phone accordingly.

I do not fully recall the name of application but it had to do with attaching data to the outbound call and it is also written in VB using ActiveX so it should be easy.


Title: Re: Finding open phone calls with the ActiveX toolkit
Post by: victor on July 20, 2007, 05:25:43 AM
Here are the important parts:

When you load extension, do NOT forget SetRestoreCallState!
[code]
Load Me.TExtension1(i)
        Me.TExtension1(i).TDN = txtAdd.Text
        Me.TExtension1(i).TQueue = 0
        Me.TExtension1(i).TExtensionType = TypeDN
        Me.TExtension1(i).TAutoRegister = True
        Me.TExtension1(i).SetRestoreCallState (True)
[/code]

Here is the eventRegistered function that processes the existing state of DN
(it is rough since I wrote it in about 15 minutes or less...)
[code]
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
         
    End If
   
    End If

End If





Next


End Sub
[/code]

This should take care of your worries :P

Happy hunting and if you have more questions, please feel free to post them!!!

Best regards,
Vic
Title: Re: Finding open phone calls with the ActiveX toolkit
Post by: JP on July 24, 2007, 08:40:47 PM
Thank you! That got me very close to where I want to be. SetRestoreCallState(true), coupled with a TLine.TQueryCall(TCallInfoType.CallInfoStatusQuery), allows me to recover the DNIS of open calls and redisplay them in the phone. However...

The problem I am facing now is that when the application is reopened and the call DNIS info is restored, the TLine.TStatus is not being updated (it's 0/Unknown when it should be 3/Establish or 4/Held etc). When I place a line on hold or retrieve that line, while I can do it, the TStatus never changes, always remaining as 0/Unknown. This makes it impossible for me to determine if I should use THold() or TRetrieve() because I don't know the current state of the line..

Any ideas why it would be doing this? It only happens if I close the application in the middle of call(s) and reopen it.