简体   繁体   English

通过客户端SDK使Lync MeetNow对话保持活动状态

[英]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客户端的应用程序,用于管理临时MeetNow房间。

Lync automatically closes the conversation after 15 minutes of inactivity. 闲置15分钟后,Lync会自动关闭对话。 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. 我找到了一个博客,该博客描述了一种通过发送“取消转移”消息来秘密保持对话的方法的方法 ,但是该解决方案使用UCMA,并且我只有2013 Lync Client SDK可用。
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. 但是,这再次使用了UCMA。 The Lync Client SDK doesn't work exactly the same. Lync Client SDK不能完全相同。
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 . 我需要使用“会话形式”发送消息,并且我无法将内容类型设置为text/x-msmsgsinvite因为它使用InstantMessageContentType ,这是一个Enum ,其中唯一可用的内容类型是: Invalid, PlainText, Html, RichText, Gif, Ink, Unknown

Attempts I've made using the 2013 Client SDK: 我使用2013 Client SDK进行的尝试:

(first, I make sure the Modality.State is connected - it is). (首先,我确保Modality.State已连接-是的)。

  • I tried sending an empty message - Received an exception saying that the Value does not fall within the expected range . 我尝试发送空消息-收到一个异常消息,提示Value does not fall within the expected range I may be misunderstanding this, but I took it to mean that an empty string does not a message make. 我可能会误解这一点,但我认为它是指一个空字符串不会发出消息。

  • I tried sending just a random message with content type set to Invalid - Received an exception with the message Unknown InstantMessageContentType. Type is Invalid 我尝试仅发送内容类型设置为Invalid的随机消息-收到消息Unknown InstantMessageContentType. Type is Invalid的异常Unknown InstantMessageContentType. Type is Invalid Unknown InstantMessageContentType. Type is Invalid . Unknown InstantMessageContentType. Type is Invalid (wasn't actually expecting this one to succeed) 实际上不是期望这个成功)

  • I tried sending a message with content type set to Html , where the message contained a <div> with style="display: none;" 我尝试发送内容类型设置为Html的消息,其中消息包含<div>且其style="display: none;" - this manages to keep the conversation alive, but, of course, this displays an empty message from the Applicative User -这样可以使对话保持活动状态,但是,当然,这会显示来自应用用户的空消息

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). 我非常想避免发送显示在MeetNow房间中的实际消息(即使所显示的只是应用用户名)。

Any ideas? 有任何想法吗?

&tldr; &tldr; : Set the AutoTerminateOnIdle property to true . :将AutoTerminateOnIdle属性设置为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 . 我在Google图书的标题为“使用Microsoft Lync Server 2010进行专业统一通信开发”的一本书中的Google图书中找到了一些有趣的信息, 作者是George Durzi,Michael Greenlee

On the subject of the Conversation 's property AutoTerminateOnIdle it states: 关于Conversation属性AutoTerminateOnIdle的主题,它指出:

[...] 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. [...]在“ UI抑制”模式下,将对话的AutoTerminateOnIdle属性设置为false可以确保在不再激活“音频视频”模式后,应用程序仍可以访问对话及其属性。 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. 如果对话同时包含InstantMessage和音频视频模态,则仅当两种模态都变为非活动状态时,对话才会终止。 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. AutoTerminateOnIdle属性设置为true可确保基础对话永远不会进入终止状态,从而允许应用程序根据需要再次连接到任一模式。 [...] [...]

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?! 如果为true永不进入终止状态? WTF? 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! 好哇!

Add this in your ConversationAdded event as suggested in above answer. 按照以上答案中的建议,将其添加到您的ConversationAdded事件中。

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

This will always keep your conversation alive even after 1 2 hours of inactivity. 即使在1到2个小时不活动之后,这也将始终使您的对话保持活跃。

Click to view Google Book Reference 点击查看Google图书参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM