简体   繁体   English

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

[英]How to detect Type/Modality of Lync Conversation?

I need to check whether the conversation is an audio call or a chat. 我需要检查对话是音频通话还是聊天。 The check needs to happen at the moment the ConversationManager_ConversationAdded Event is triggered. 检查需要在触发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; 
        }

Here i would like to check what kind of Conversation it is to handle future actions. 在这里,我想检查处理未来行动的是什么样的对话。

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

Question: How can i distinguish whether the conversation is an Audio/Video call or a Chat conversation? 问题:如何区分对话是音频/视频通话还是聊天对话?

I have found a solution that works. 我找到了一个有效的解决方案。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM