Enterprise Instant Messaging (Microsoft Unified Communications , IBM Sametime, Jabber)

Comprehensive Instant Messaging information resource for enterprise IT professionals
posts - 94, comments - 0, trackbacks - 0

IM Sessions unleashed using RTC API 1.3 (VB.NET)

IM sessions support multi parties. This article demonstrates the process of creating an IM session and adding participants to the IM session.

Step1: Add reference to RTC 1.3 API to the project

Step2: Login to the LCS server using RTC API. For step by step process refer the article: Login process using RTC 1.3 API (VB.NET)

Step3: Add the following function to create chat session
Public Sub StartChatSession(ByVal ParticipantSipUri As String)
    'Start Chat Session
    Dim IRTCSession As IRTCSession2
    Dim IRTCParticipant As IRTCParticipant

    Set IRTCSession = _IRTCClient2.CreateSession(RTCST_MULTIPARTY_IM, vbNullString, _IRTCProfile2, _lngFlag)
    Set IRTCParticipant = IRTCSession.AddParticipant(ParticipantSipUri, vbNullString)
End Sub

Step4: After adding the participant in the session wait for event type RTCSS_CONNECTED before performing any other operation on the IM session

Step5: Sending message in IM Session
    IRTCSession2.SendMessage("text/plain", Message, _lngFlag)

Step6: Sending Typing status in IM Session

Step7: Receiving typing status/message from other participants
To receive typing status/message in an IM session watch for event type RTCE_MESSAGING. Add the following function to process data received in messaging event.
Private Sub MessagingEvent(ByVal pEvent As RTCCORELib.IRTCMessagingEvent)
    'Called when a message arrives or when a user is typing message
    Dim IRTCParticipant As IRTCParticipant
    Dim ParticipantSipUri As String
    If _IRTCSession2 Is pEvent.Session Then
        ParticipantSipUri = pEvent.Participant.UserURI()
        Select Case pEvent.EventType
                'Message received from participant (pEvent.Message)
                Select Case pEvent.UserStatus
                        'User is not typing
                        'User is typing
                End Select
        End Select
    End If
End Sub

Print | posted on Tuesday, June 05, 2007 6:50 PM |