gpt4 book ai didi

c# - 不允许来电 Lync Api 或禁用来电声音

转载 作者:太空宇宙 更新时间:2023-11-03 15:47:56 25 4
gpt4 key购买 nike

我使用 Lync api 开发了一个 Windows 应用程序。我的客户想要禁用对此应用程序的来电。所以我添加了这样的东西。我可以挂断电话,但在我挂断电话之前响铃很少

private void ClientInitialized(IAsyncResult result)
{
try
{
//registers for conversation related events
//these events will occur when new conversations are created (incoming/outgoing) and removed
client.ConversationManager.ConversationAdded += ConversationManager_ConversationAdded;
client.ConversationManager.ConversationRemoved += ConversationManager_ConversationRemoved;
}
catch (Exception ex)
{
MessageBox.Show("Problem in adding/removing conversation", "Bella IVIS", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

void ConversationManager_ConversationAdded(object sender, ConversationManagerEventArgs e)
{
try
{
var _client = client;
if (e.Conversation.State == ConversationState.Active)
{
for (int intLoop = 0; intLoop < _client.ConversationManager.Conversations.Count; intLoop++)
{
_client.ConversationManager.Conversations[intLoop].End();
}
_client = null;
return;
}
}
}

最佳答案

我不知道是否有办法在 Conversation_Added 事件之前捕获对话。但是,如果 Lync 状态与您无关,则您将 Lync 状态更改为“请勿打扰”。这样您将永远不会收到任何传入请求(除非用户 Lync 设置允许这样做)

var newInformation =new Dictionary<PublishableContactInformationType, object>();
newInformation.Add(PublishableContactInformationType.Availability, ContactAvailability.DoNotDisturb);

try
{
this.lyncClient.Self.BeginPublishContactInformation(newInformation,(result) => this.lyncClient.Self.EndPublishContactInformation(result) , null);
} catch {}

关于c# - 不允许来电 Lync Api 或禁用来电声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27292556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com