cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Registering to the OnSkillGroupStatisticsUpdated() How????

32
Views
0
Helpful
0
Comments
This document was generated from CDN thread

Created by: Voiceops SSC on 03-03-2010 04:06:58 AM
Hi,
I'm trying to write a Monitor-Mode application to monitor Skill Group stats (mainly Calls on Q).
I've follow the developers guide and I've gotten as far as Registering to the OnSkillGroupStatisticsUpdated()
I'm stuck!!  How do register to that event?  The samples provided are in Java, I;m using VB 6 (we're running ICM 6).  My application is connecting and all the objects/code seems to be in order, I can login in and I get no errors but I don't undertand how to register to this event and retrieve for example the CallsQNow stats.
 
The guide says that I have to:
"Registering to the OnSkillGroupStatisticsUpdated() (C++, COM, and V
To register to receive skill group statistics, you must include the OnSkillGroupStatisticsUpdated() event in the message filter.
For more information on message filters, see page 4-37."

 
Does this mean I have to create another filter?
Does a Monitor-Mode application requires a login?
 
 
thanks
 
 

Subject: RE: New Message from Voiceops SSC in Computer Telephony Integration Object
Replied by: David Lender on 03-03-2010 06:58:58 PM
For Java Cil, add the eOnNewSkillGroupStatisticsEvent
<file:///C:/Program%20Files/Cisco%20Systems/CTIOS%20Client/CTIOS%20Toolk
it/Java%20CIL/javadoc/com/cisco/cti/ctios/cil/CtiOs_Enums.EventID.html#e
OnNewSkillGroupStatisticsEvent>  = 536871027 event to your filter. 
Same For VB (COM Cil)  use eOnNewSkillGroupStatisticsEvent

Please let us know if this works.  Looks like the developer's guide may
be in error.

You say you can login.  Monitor mode applications do not log in.  Did
you mean connect?

Subject: RE: New Message from Voiceops SSC in Computer Telephony Integration Object
Replied by: Voiceops SSC on 03-03-2010 08:16:59 PM
Yes, I meant connect!!
 
I still don't get the part about the filter.  This is my code so far (below) Is connecting but how do I listen (or engage or register or apply) to the OnNewSkillGroupStatisticsEvent or the OnSkillGroupStatisticsUpdated()?
 
After Step 6 c (below) the Developers guide says: Once the application is set up to
receive skill group statistics, as described in the preceding section,
you access skill group statistics through an event handler. The name of
the event depends on the language of the application:

¿ In Java, eOnNewSkillGroupStatisticsEvent()

¿ In C++, COM, or VB, OnSkillGroupStatisticsUpdated()

 
In my case is OnSkillGroupStatisticsUpdated()
Are you saying that the OnSkillGroupStatisticsUpdated() is wrong that it should be OnNewSkillGroupStatisticsEvent?
how would I do it, like so:
Private Sub m_session_OnSkillGroupStatisticsUpdated(ByVal pIArguments As CTIOSCLIENTLib.IArguments)

    LogEvent "OnSkillGroupStatisticsUpdated", pIArguments

End Sub

 
Thanks for your help
 
 
This is my code (VB6):
 
Option Explicit

Dim WithEvents m_session As CTIOSCLIENTLib.Session

' the sessionresolver is needed to retrieve the session pointer
Dim m_sessionresolver As CTIOSSESSIONRESOLVERLib.SessionResolver


Dim GlobalSettingsArgs As New CTIOSARGUMENTSLib.Arguments

' flag used to keep track of connection status
Dim m_bConnected As Boolean

Private Sub Form_Load()

    ' instantiate the sessionresolver
    Set m_sessionresolver = New CTIOSSESSIONRESOLVERLib.SessionResolver
   
    ' get the session pointer and hold on to it
    Set m_session = m_sessionresolver.GetSession("")
 
    m_bConnected = False

    connectionstatus.Text = "Not Connected"
    
    Log "SKILL GROUPS STATS VER 2"
    Log " "
    Log "To start connect"
   
    check_details = 1
   
End Sub

 
Private Sub Command1_Click()

'Step 5 Set the message filter as described on page 4-35.

'a. Create a String for the filter using the keyword S_FILTERTARGET as the name
'and the keyword CTIOS_SKILLGROUPSTATISTICS as the value.

    Dim sFilter As String
    sFilter = S_FILTERTARGET + "=" + CTIOS_SKILLGROUPSTATISTICS

'b. Create an instance of the Arguments class.
    Dim m_Args As New Arguments

'c. Set the value in the filter for the CTIOS_FILTER keyword to the String
'created in Step a.

'This step here I don't understand, it says to use this instance of the Arguments class on my session instance (step d) but SetMessageFilter only accepts Strings so it thors an error if I use : m_session.SetMessageFilter m_Args on step d (below)
    m_Args.SetValue CTIOS_FILTER, sFilter
    
'd. Use the SetMessageFilter() method in the Session class to set the filter for the
'session, using the Arguments instance you created in Step b as a parameter.

    m_session.SetMessageFilter sFilter

'Step 6 Enable individual statistics as needed.
'a. Create an instance of the Arguments class.

    Dim Skills As New Arguments

'b. Set values in the Arguments instance. You must provide the skill group
'number and the peripheral number for each skill group for which you want to
'receive statistics. Use the SetValue(keyword, int) method signature.
'For example: use SetValue(CTIOS_SKILLGROUPNUMBER, sgNumber)
'where sgNumber is an integer for the skill group for which you want to
'receive statistics, and SetValue(CTIOS_PERIPHERALID,
'peripheralNumber) where sgNumber is an integer for the skill group for
'which you want to receive statistics.

    Skills.SetValue CTIOS_SKILLGROUPNUMBER, 5138
    Skills.SetValue CTIOS_PERIPHERALID, 1

'c. Use the Arguments instance as a parameter for the session¿s
'EnableSkillGroupStatistics() method.

    m_session.EnableSkillGroupStatistics Skills


End Sub

Private Sub Connect_Click()
    Log "Connect Button Clicked"
   
    If m_bConnected = True Then
        Log "Already connected"
    Else
        ' Not connected so pull values from dialog and use to make connection attempt
        Dim m_Args As New Arguments
        m_Args.AddItem "CtiosA", hostA.Text
   
        Dim pA As Long
        pA = Val(portA.Text)
        m_Args.AddItem "portA", pA
       
        m_Args.AddItem "CtiosB", hostB.Text
       
        Dim pB As Long
        pB = Val(portB.Text)
        m_Args.AddItem "portB", pB
       
        Dim hb As Long
        hb = Val(heartbeats.Text)
        m_Args.AddItem "heartbeat", hb
       
        Dim nRetVal As Long
        nRetVal = m_session.Connect(m_Args)
       
        Log "Sending Connect request"
        
    End If

End Sub


Private Sub m_session_OnSkillGroupStatisticsUpdated(ByVal pIArguments As CTIOSCLIENTLib.IArguments)
    LogEvent "OnSkillGroupStatisticsUpdated", pIArguments
End Sub


' Handle the OnConnection event - Connection attempt success

Private Sub m_session_OnConnection(ByVal pIArguments As CTIOSCLIENTLib.IArguments)

    ' Retrieve CurrentPort value and display on dialog
    Dim P As Long
    P = pIArguments.GetValueInt("CurrentPort")
    Log "Connected to port " + Str(P)

    LogEvent "OnConnection", pIArguments
   
    connectionstatus.Text = "Connected"
    m_bConnected = True
   
   
End Sub

' Handle the OnConnectionClosed event - Connection has been closed

Private Sub m_session_OnConnectionClosed(ByVal pIArguments As CTIOSCLIENTLib.IArguments)
    LogEvent "OnConnectionClosed", pIArguments
    connectionstatus.Text = "Not Connected"
    m_bConnected = False
   
End Sub

' Handle the OnConnectionFailure event - Connection attempt has failed

Private Sub m_session_OnConnectionFailure(ByVal pIArguments As CTIOSCLIENTLib.IArguments)
    LogEvent "OnConnectionFailure", pIArguments
   
    connectionstatus.Text = "Not Connected"
   
    m_bConnected = False
   
   
End Sub

Private Sub m_session_OnCtiOsFailure(ByVal pIArguments As CTIOSCLIENTLib.IArguments)
    LogEvent "OnCtiOsFailure", pIArguments
End Sub


Private Sub m_session_OnControlFailureConf(ByVal pIArguments As CTIOSCLIENTLib.IArguments)
   
    LogEvent "ControlFailureConf", pIArguments
  
    Dim popup As New ScreenPop
    popup.Caption = "CTI Warning"
    popup.Label1.Caption = pIArguments.DumpArgs
    popup.Show
   
    'do a reconnect in the case of a control failure or login failure
    'in order to reset the agent filtertarget on the cti server correctly
    'the agent will be able to login again after this
    Dim failcode As Integer
    failcode = pIArguments.GetValueInt("FailureCode")
    If failcode = 256 Then
       bResetingConnection = True
       Disconnect_Click
    End If
  
End Sub

Private Sub m_session_OnFailureEvent(ByVal pIArguments As CTIOSCLIENTLib.IArguments)
    LogEvent "OnFailure", pIArguments
End Sub

Private Sub m_session_OnHeartbeat(ByVal pIArguments As CTIOSCLIENTLib.IArguments)
    LogEvent "OnHeartbeat", pIArguments
End Sub

Private Sub m_session_OnMissingHeartbeat(ByVal pIArguments As CTIOSCLIENTLib.IArguments)
    LogEvent "OnMissingHaertbeat", pIArguments
End Sub

' Format and display an events contents to the log window
'
Private Sub LogEvent(txt As String, ByVal pIArguments As CTIOSCLIENTLib.IArguments)
    ' logs the event and its arguments to the logwindow
    Dim m_txt As String
    m_txt = txt + " Event received"
    Log m_txt
   
    Dim S As String
    If 1 = check_details Then
        ' Call the event objects DumpArgs function to format the event data
        S = "   " + pIArguments.DumpArgs
        Log S
    End If
End Sub

' this routine is a helper function that writes a log entry to the logwindow
'
Private Sub Log(txt As String)
    ' write logentry with carriage return (13) linefeed (10)
    logwindow.Text = logwindow.Text + Chr(13) + Chr(10) + txt
   
    ' set selection to the end so the window scrolls down
    logwindow.SelStart = Len(logwindow.Text)

End Sub

' Clear the text from the log window
'
Private Sub clearlog_Click()
    logwindow.Text = ""
End Sub

 

Subject: RE: New Message from Voiceops SSC in Computer Telephony Integration Object
Replied by: David Lender on 03-03-2010 08:35:10 PM
Yes, the documentation is confusing.

For SetMessageFilter:

C++:int SetMessageFilter(string filter)

COM:HRESULT SetMessageFilter(/*{in]*/ BSTR filter, /*[out, retval]*/
int* errorcode)

VB:SetMessageFilter (filter As String, retVal As Long)

Java:int SetMessageFilter(Arguments messageFilter)

.NET:CilError SetMessageFilter(Arguments rArgs)


notice in Java and .NET you use an Arguments array and in C++, COM and
VB you use a string.

the sample code in the developer's guide is for Java

From Chapter 4 Building Your Application section on Working with Skill
Group Statistics:



The following example demonstrates this task in Java:

/* 1. Create session.*/

CtiOsSession rSession = new CtiOsSession();

/* 2. Add event listener.*/

rSession.AddEventListener(this,

CtiOs_Enums.SubscriberList.eSessionList);

rSession.AddEventListener(this,

CtiOs_Enums.SubscriberList.eSkillGroupList);

/* 3. Set Connection values.*/

Arguments rArgs = new Arguments();

rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_CTIOSA, "CTIOSServerA");

rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_PORTA, 42408);

rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_CTIOSB, "CTIOSServerB");

rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_PORTB, 42408);

rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_HEARTBEAT, 100);

/*4. Connect to server.*.

int returnCode = session.Connect(rArgs);

/*5. Set the message filter. */

String filter = S_FILTERTARGET + "=" + "SkillGroupStats";

rArgs = new Arguments();

rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_FILTER, filter);

returnCode = session.SetMessageFilter(rArgs);

/*6. Enable statistics. */

rArgs = new Arguments();

rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_SKILLGROUPNUMBER, sgNumber);

rArgs.SetValue(CtiOs_IKeywordIDs.CTIOS_PERIPHERALID, peripheralID);

rSession.EnableSkillGroupStatistics(rArgs);

Subject: RE: New Message from Voiceops SSC in Computer Telephony Integration Object
Replied by: Voiceops SSC on 03-03-2010 08:54:15 PM
Right, so the guide is wrong?
 
'a. Create a String for the filter using the keyword S_FILTERTARGET as the name
'and the keyword CTIOS_SKILLGROUPSTATISTICS as the value.

    Dim sFilter As String
    sFilter = "S_FILTERTARGET" + "=" + "CTIOS_SKILLGROUPSTATISTICS"

'b. Create an instance of the Arguments class.
    Dim m_ArgsFilter As New Arguments

'c. Set the value in the filter for the CTIOS_FILTER keyword to the String
'created in Step a.

    m_ArgsFilter.SetValue "CTIOS_FILTER", sFilter
     
'd. Use the SetMessageFilter() method in the Session class to set the filter for the
'session, using the Arguments instance you created in Step b as a parameter.

    m_session.SetMessageFilter sFilter             <---- so use this??
    'm_session.SetMessageFilter m_ArgsFilter   <---- not this??!!

Subject: RE: New Message from Voiceops SSC in Computer Telephony Integration Object
Replied by: David Lender on 04-03-2010 02:02:10 PM
No the guide is not wrong it is just for Java and .NET.  It gives you
the steps and then shows the code in Java.  In VB (and COM or C++) the
code is a little different.  See the SetMessageFilter method description
which lists the differences in syntax.  Perhaps the developer's guide
should be updated with a warning in the section on setting up Skill
Group Statistics about the differences in the syntax for
SetMessageFilter for the different CILs (COM, C++, .NET and Java).
CreatePlease to create content