如何检测Lync对话的类型/模态?

时间:2016-09-29 06:55:08

标签: c# lync lync-2013 skype-for-business

我需要检查对话是音频通话还是聊天。 检查需要在触发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;

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

1 个答案:

答案 0 :(得分:0)

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

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