【问题标题】:UCMA 4.0 Determine if Lync chat timedout or customer closed Lync windowUCMA 4.0 确定 Lync 聊天超时或客户是否关闭了 Lync 窗口
【发布时间】:2015-02-21 21:11:06
【问题描述】:

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

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

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

【问题讨论】:

    标签: c# lync-2013 ucma


    【解决方案1】:

    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

    【讨论】:

      【解决方案2】:

      尝试如下所示的 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
              }
          }
      

      【讨论】:

        猜你喜欢
        • 2012-12-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多