如何检测Lync会话的类型/模式

本文关键字:会话 类型 模式 Lync 何检测 检测 | 更新日期: 2023-09-27 18:09:37

我需要检查对话是音频通话还是聊天。检查需要在ConversationManager_ConversationAdded事件被触发的那一刻发生。

        private void InitialisiereLyncClient()
        {
            //(Running Lync instance)
            m_LyncClient = LyncClient.GetClient();
            ConversationManager m_ConversationManager = m_LyncClient.ConversationManager;

            m_ConversationManager.ConversationAdded += M_ConversationManager_ConversationAdded;
            m_ConversationManager.ConversationRemoved += M_ConversationManager_ConversationRemoved; 
        }

这里我想检查处理未来动作的会话类型。

        //Eigenschaften der Conversation
        IDictionary<ConversationProperty, object> m_properties = e.Conversation.Properties;
        //Informationen der Person, die das Event ausgelöst hat
        Contact m_caller = e.Conversation.Properties[ConversationProperty.Inviter] as Contact;

问题:如何区分通话是音频/视频通话还是聊天?

如何检测Lync会话的类型/模式

我已经找到了一个有效的解决方案。

        bool hasAVModality = e.Conversation.Modalities.ContainsKey(ModalityTypes.AudioVideo);
        if (hasAVModality)
        {
            //State of AV modality
            var state = e.Conversation.Modalities[ModalityTypes.AudioVideo].State;
            //Notified = Incoming
            if (state == ModalityState.Notified)
            {
                //Do Something with the call
            }
        }