gigaduck
gigaduck

Reputation: 1547

UCMA 4.0 Determine if Lync chat timedout or customer closed Lync window

I am not able to determine whether a customer using the Lync client left a conversation due to a timeout or if the person closed the window. I am using the following event handler to check. After looking through the data in the variables, I still have the question :

Is there a way in UCMA to check whether the customer timed out?

void ImCall_StateChanged(object sender, CallStateChangedEventArgs e)
{
    if (e.State == CallState.Terminating || e.State == CallState.Terminated)
    {
       //Program Logic .....
    }
}

Upvotes: 0

Views: 658

Answers (2)

ExpressDesk
ExpressDesk

Reputation: 21

The answer from Ankit tells you how to determine when a user left, but not why. There is a way to determine if the user closed the window or if something else happened using the Ms-client-Diagnostics header from the SIP message.

    // Called when the instant messaging session changes state
    void instantMessagingCall_StateChanged(object sender, CallStateChangedEventArgs e)
    {
        string diagnostics = "";
        foreach (SignalingHeader header in e.MessageData.SignalingHeaders)
        {
           // Capture all flavors of diagnostic headers
                        if (header.Name.Equals("ms-diagnostics", StringComparison.InvariantCultureIgnoreCase))
                        {
                            diagnostics = diagnostics + header.GetValue() + ";";
                        }

                        if (header.Name.Equals("ms-diagnostics-public", StringComparison.InvariantCultureIgnoreCase)) // These are the public diagnostics in case you go over edge 
                        {
                            diagnostics = diagnostics + header.GetValue() + ";";
                        }

                        if (header.Name.Equals("Ms-client-diagnostics", StringComparison.InvariantCultureIgnoreCase)) // These are the client diagnostics
                        {
                            diagnostics = diagnostics + header.GetValue() + ";";
                            break;
                        }
        }

        if (diagnostics.Contains("51004") || diagnostics.Contains("Action initiated by user"))
        { 
               // handle the case where the Action is initiated by the user, which is when the user closes the chat using the cross button
        }
        if (diagnostics.Contains("52094") || diagnostics.Contains("Instant Messaging conversation terminated on user inactivity")) 
        {
               // the user left the window inactive for more than 10 minutes
        }
        if (diagnostics.Contains("52107") || diagnostics.Contains("Call terminated on signout") ) 
        {
                // the user signed out of Lync/Skype while the conversation is still active
        }
        if (diagnostics.Contains("52082") || diagnostics.Contains("Session is detached from conversation"))
        {
                // when the user clicks on "Deny" after receving the invite
        }

You can view the full list of diagnostic header values here : https://lyncforbusiness.wordpress.com/2015/10/15/lync-diagnostic-codes/ and here : https://msdn.microsoft.com/en-us/library/gg132446(v=office.12).aspx

Upvotes: 2

Ankit Vijay
Ankit Vijay

Reputation: 4078

Try ParticipantEndpointAttendanceChanged event like below:

this.conversation.ConferenceSession.InstantMessagingMcuSession
.ParticipantEndpointAttendanceChanged +=
             this.McuSessionParticipantEndpointAttendanceChanged;


private void InstantMessagingMcuSessionParticipantEndpointAttendanceChanged(
        object sender,
        ParticipantEndpointAttendanceChangedEventArgs<InstantMessagingMcuParticipantEndpointProperties> e)
    {
        foreach (var joiningParticipant in e.Joined)
        {
            // check if the customer has joined
        }

        foreach (var departingParticipant in e.Left)
        {
             // Verify if the customer has left
        }
    }

Upvotes: 0

Related Questions