将Lync 2010与外部程序集成

问题描述 投票:13回答:1

如何将Lync 2010与使用所查找信息进行数据库查找并显示小弹出窗口的程序以及带有一些选项的几个按钮进行集成。 该程序已经与其他类型的电话系统一起运行,我需要一个Lync连接器。 我不想在Lync中放置选项卡或其他UI。

c# lync lync-2010
1个回答
21
投票

你需要从Lync SDK开始。您可以将您的应用程序构建为Winforms或WPF应用程序。

登录中

要连接并登录到正在运行的Lync实例,请从SDK中查看this page。确保您保留对代表Lync的LyncClient对象的引用。这可以通过调用静态方法LyncClient.GetClient()来获得

检测来电

要检测来电,您可以收听ConversationManager.ConversationAdded事件。 ConversationManager是您的LyncClient实例上的财产。

要确定呼叫是a)音频呼叫,还是b)呼入(与用户发出的呼出呼叫相反),您可以使用以下方法:

bool IsIncomingAVCall(Conversation conversation)
{
    // Test to see if the call contains the AV modality
    bool containsAVModality = conversation.Modalities.ContainsKey(ModalityTypes.AudioVideo);

    if (containsAVModality)
    {
        // Get the state of the AV modality
        var state = conversation.Modalities[ModalityTypes.AudioVideo].State;

        // 'Notified' means the call is incoming
        if (state == ModalityState.Notified) return true;
    }

    return false;
}

ConversationAdded活动中,您应该注册Conversation.ParticipantAdded活动,这样您就可以查看来电者是谁。 EventArgs对象具有Participant属性,该属性又具有Contact属性。 Contact酒店有许多属性,包括Uri,它应该给你电话号码(如果这是你需要的)。

然后,您可以进行数据库调用并弹出信息。

编辑:我写了一篇关于屏幕弹出的博客文章更详细 - here

拨打电话

如果您的应用是WPF,允许拨打电话的最简单方法是使用StartAudioCallButton控件。否则,说明here应该有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.