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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With