0

我无法确定使用 Lync 客户端的客户是否由于超时而离开了对话,或者该人是否关闭了窗口。我正在使用以下事件处理程序进行检查。在查看了变量中的数据后,我仍然有一个问题:

UCMA 有没有办法检查客户是否超时?

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

2 回答 2

2

Ankit 的答案告诉您如何确定用户何时离开,但不告诉您为什么。有一种方法可以确定用户是否关闭了窗口,或者使用 SIP 消息中的 Ms-client-Diagnostics 标头是否发生了其他事情。

    // 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
        }

您可以在此处查看诊断标头值的完整列表: https://lyncforbusiness.wordpress.com/2015/10/15/lync-diagnostic-codes/ 和此处: https : //msdn.microsoft.com/en-us /library/gg132446(v=office.12).aspx

于 2018-12-05T10:25:43.390 回答
0

尝试 ParticipantEndpointAttendanceChanged 事件,如下所示:

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
        }
    }
于 2015-03-01T07:23:15.263 回答