将Lync 2010与外部程序集成

Mar*_*tin 13 c# lync lync-2010

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

Pau*_*ney 21

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

登录中

要连接并登录正在运行的Lync实例,请从SDK中查看此页面.确保保留对LyncClient表示Lync 的对象的引用.这可以通过调用静态方法来获得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;
}
Run Code Online (Sandbox Code Playgroud)

在这种情况ConversationAdded下,您应该注册该Conversation.ParticipantAdded活动,以便查看呼叫者是谁.EventArgs对象有一个Participant属性,该属性又具有一个Contact属性.该Contact物业有许多属性,包括Uri,应该给你电话号码(如果这是你需要的).

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

编辑:我写了一篇关于屏幕弹出的博客文章,详细介绍了 - 这里

拨打电话

如果您的应用程序是WPF,则允许调用的最简单方法是使用StartAudioCallButton控件.否则,这里的说明应该有所帮助.