[英]Do not allow incoming call Lync Api or disabling sounds for incoming call
我已經使用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 Status更改為“請勿打擾”。 這樣,您將永遠不會收到任何傳入請求(除非用戶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 {}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.