Guy Passy
Guy Passy

Reputation: 782

Keep Lync MeetNow conversation alive from Client SDK

I have an application which relies on a dedicated Lync client sitting on a server to manage ad-hoc MeetNow rooms.

Lync automatically closes the conversation after 15 minutes of inactivity. I found a blog describing a way to surreptitiously keep the conversation alive by sending a "cancel transfer" message, but that solution uses UCMA and I only have the 2013 Lync Client SDK available.
The way it's done there is (basically):

var contentType = new System.Net.Mime.ContentType("text/x-msmsgsinvite");
var s = @"Application-Name: File Transfer\r\nInvitation-Command: CANCEL\r\nInvitation-Cookie: 12345\r\n");
byte[] htmlBytes = Encoding.UTF8.GetBytes(s);
Flow.BeginSendInstantMessage(contentType, htmlBytes, EndSendInstantMessage, Flow);

But, again, this is using UCMA. The Lync Client SDK doesn't work exactly the same.
I need to use a Modality of the Conversation to send a message, and I can't set the content type to text/x-msmsgsinvite because it uses InstantMessageContentType, an Enum where the only content types available are: Invalid, PlainText, Html, RichText, Gif, Ink, Unknown.

Attempts I've made using the 2013 Client SDK:

(first, I make sure the Modality.State is connected - it is).

I would very much like to avoid sending an actual message that displays in the MeetNow room (even if all it shows is the Applicative User's name).

Any ideas?

Upvotes: 0

Views: 586

Answers (2)

Roshan Parmar
Roshan Parmar

Reputation: 3712

Add this in your ConversationAdded event as suggested in above answer.

            e.Conversation.BeginSetProperty(ConversationProperty.AutoTerminateOnIdle, true, null, null);

This will always keep your conversation alive even after 1 2 hours of inactivity.

Click to view Google Book Reference

Upvotes: 0

Guy Passy
Guy Passy

Reputation: 782

&tldr; : Set the AutoTerminateOnIdle property to true. This will keep the conversation from terminating!


Full disclosure:
It seems the answer was hiding somewhere else entirely.
I found some interesting information in Google Books in a book titled "Professional Unified Communications Development with Microsoft Lync Server 2010" By George Durzi, Michael Greenlee.

On the subject of the Conversation's property AutoTerminateOnIdle it states:

[...] Setting the AutoTerminateOnIdle property of the conversation to false when in UI Suppression mode ensures that the application can still access the conversation and its properties after the Audio Video modality is no longer active. This allows the application to reastart the audio or video channels of the modality because the conversation i not in a terminated state. If a conversation contains both the InstantMessage and Audio Video modalities, it will only terminate when both modalities become inactive. Setting the AutoTerminateOnIdle property to true ensures that the underlying conversation never enters a terminated state, allowing the application to connect to either modality again as needed. [...]

Is it just me or is the part marked in bold THE EXACT OPPISITE OF WHAT ONE WOULD EXPECT FROM THE PROPERTY NAME?!?! If true, never enter a terminated state?! WTF?

Either way, I tested it - left a room simply sitting there for, like, half an hour not doing anything. The client even went into "away" status => conversation stayed open. Huzzah!

Upvotes: 1

Related Questions