Pages Menu
TwitterRss

Posted by on Jul 31, 2012 in Microsoft® Lync® | 0 comments

Detecting Modality change on Existing Conversations

Recently I blogged about how to accept an incoming AV call using the Lync Client SDK.

At the time I skirted a different issue with the throwaway comment:

Because of the way that events are fired at the beginning of a Conversation, and the way that a Conversation can contain multiple Calls, if a conversation starts on IM and is then upscaled to AV, this event won’t fire and the call won’t be picked up. You’ll have to use an alternative method to detect the change in modality/state and react accordingly. (this may become another blog post)

Someone (also called Tom) called me out on this, and wanted to know how to identify changes such as adding AV or Application Sharing to an existing conversation.

This is quite different. Everything from the last post was based on the assumption that there is a new, incoming conversation which you can choose to accept. Once a conversation is already in place, adding extra features, such as AV or Application Sharing is adding new modalities to the conversation, and you catch this behavior differently.

To do this, as soon as you have a handle on the Conversation object, subscribe to the ModalityStateChanged event, for the modality you are interested in. For instance, to know about conversations that get Audio/Video added:

 _conversation.Modalities[ModalityTypes.AudioVideo].ModalityStateChanged += AVModality_StateChanged;

In the code for this event, you can call .Accept just as you would for an incoming conversation.

So far so easy…

Gotcha! Application Sharing…

Unfortunately, Application Sharing isn’t listed as a ModalityType in the list of enums you can use with the Lync Client SDK. This is annoying, because it means that you can’t subscribe to modality state changes for application sharing. You could look at an new, incoming, conversation and infer that if there was no InstantMessage modality and no AudioVideo modality, then it’s probably an Application Sharing request, but that’s dodgy at best!

However… This is changing! (yay! :D)

In Lync 2013, support for application sharing in the client SDK has been vastly improved and should allow for granular application sharing control. Of particular interest here is that the new ApplicationSharingModality class inherits from Modality, so will have a ModalityStateChanged event.

Compare the existing MSDN entry for ModalityType here
with the new (prelim) 2013 documentation for the same page here 

I’ve just noticed that ContentSharing is also listed as a separate modality. It’s on my list to look at, but I have high hopes this will make file sharing possible via the client SDK.

Everything I’ve said so far has been for the Lync Client SDK. The UCMA SDK also doesn’t have native support for Application Sharing, but you can extend it to support application sharing requests. There’s an excellent post on doing this by Michael Greenlee which describes this in detail: Handling application sharing calls in UCMA.

Post a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>