Integrating Lync 2010 with an external program

℡╲_俬逩灬. 提交于 2019-11-29 17:30:37

问题


How can I integrate Lync 2010, with a program that does a DB look up and shows a small popup, with the information found, and also a few buttons with some options.
The program is already running with some other types of phone systems, I kind of need a connector for Lync.
I don't want to put a tab or other UI inside Lync.


回答1:


You'll need to start with the Lync SDK. You can build your app as a Winforms or WPF app.

Signing In

To connect and sign in to the running instance of Lync, check out this page from the SDK. Make sure you keep a reference to the LyncClient object that represents Lync. This can be got by calling the static method LyncClient.GetClient()

Detecting an incoming call

To detect an incoming call, you can listen for the ConversationManager.ConversationAdded event. ConversationManager is a property on your LyncClient instance.

To determine if the call is a) an Audio call, and b) incoming (as opposed to an outgoing call placed by the user) you can use the following method:

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

In the ConversationAdded event, you should sign up to the Conversation.ParticipantAdded event, so you can check who the caller is. The EventArgs object has a Participant property, which in turn has a Contact property. The Contact property has a number of properties including Uri, which should give you the phone number (if that's what you need).

You can then make your DB call and pop your info.

Edit: I've written a blog post about screen pops which goes into much more detail - here

Placing a call

If your app is WPF, the easiest way to allow a call to be placed is by using the StartAudioCallButton control. Otherwise, the instructions here should help.



来源:https://stackoverflow.com/questions/7144519/integrating-lync-2010-with-an-external-program

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!