gpt4 book ai didi

c# - 使用服务器端技术(UCMA 或 MSPL)检索 Lync 客户端的调用转移规则

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

如何在托管 SIP 应用程序(服务器端技术,如 MSPL 或 UCMA)中检索 Lync 客户端的调用转发规则(路由)?我唯一找到的是一篇关于如何使用 Lync SDK 在客户端执行此操作的文章。

还有 this Answerthis MSDN Articlethis Question似乎表明它确实有效,但我需要在特定时刻(如果用户在线或不在线)进行此设置,而不是在他登录到他的 Lync 帐户并发布他的状态信息后立即进行设置,如链接 #1 中所示。此外,有必要在不先创建 UserEndpoint 的情况下为任何客户端获取此信息。因此,最好使用 ApplicationEndpoint(或其他方法)实现这一点。

据我所知,应该可以从状态元数据中检索转发设置,但我没有得到此信息。

 var categories = new string[] {
"state",
//"routing" // ?
};

var asyncresult = presenceSvc.BeginPresenceQuery(sips, categories, null, null, null);
var result = presenceSvc.EndPresenceQuery(asyncresult).ToList();

最佳答案

你不能用 ApplicationEndpoint 来做。您必须有一个 UserEndpoint。但是,您可以创建一个只需要 CollaborationPlateformSipUser 而不需要任何密码的 UserEndpoint

对于我的应用程序,我反编译了SEFAUtil.exe通过ILSpy了解他们在程序中的表现。我建议你看一看。

这是我实现它的技巧:

1/创建用户端点

创建用户端点时,即使未连接

,您也必须订阅此状态才能获取信息
userEndpoint.LocalOwnerPresence.BeginSubscribe(null, null);

2/订阅PresenceNotificationReceived事件

userEndpoint.LocalOwnerPresence.PresenceNotificationReceived += OnCategoryNotificationReceived;

private static void OnCategoryNotificationReceived(object sender, LocalPresentityNotificationEventArgs e)
{
// Here you get the PresenceCategory and all the data of the user
foreach (PresenceCategoryWithMetaData current in e.AllCategories)
{
if (current.Name == "routing" && current.ContainerId == 0 && current.InstanceId == 0L)
// Creation of your Routing, I stock it in a Property
_routingCategory = new Routing(current);
}
// I set my event to continue my main thread
_routingCategoryUpdated.Set();
}

3/显示你想要的信息

 // Wait until you get the information of the user
if (!_routingCategoryUpdated.WaitOne(10000))
{
Console.WriteLine("TimeOut Getting Informations");
return;
}
// Just display all the data you can need
else
{
Console.WriteLine($"User Aor: {userEndPointTarget.OwnerUri}");
Console.WriteLine($"Display Name: {userEndPointTarget.OwnerDisplayName}");
Console.WriteLine($"UM Enabled: {userEndPointTarget.UmEnabled}");
Console.WriteLine($"Simulring enabled: {_routingCategory.SimultaneousRingEnabled}");

if (_routingCategory.SimultaneousRingEnabled && _routingCategory.SimultaneousRing != null)
{
foreach (string time in _routingCategory.SimultaneousRing)
{
Console.WriteLine($"Simul_Ringing to: {time}");
}
}
if (_routingCategory.DelegateRingEnabled)
{
if (_routingCategory.SkipPrimaryEnabled)
{
Console.Out.Write("Forwarding calls to Delegates: ");
}
else if (_routingCategory.UserWaitTimebeforeTeamOrDelegates.TotalSeconds > 0.0)
{
Console.Out.Write($"Delay Ringing Delegates (delay:{ _routingCategory.UserWaitTimebeforeTeamOrDelegates.TotalSeconds} seconds): ");
}
else
{
Console.Out.Write("Simultaneously Ringing Delegates: ");
}
foreach (string delegateCurrent in _routingCategory.Delegates)
{
Console.Out.Write($"{delegateCurrent} ");
}
Console.Out.WriteLine();
}
else if (_routingCategory.TeamRingEnabled)
{
if (_routingCategory.UserWaitTimebeforeTeamOrDelegates.TotalSeconds > 0.0)
{
Console.Out.Write($"Delay Ringing Team (delay:{_routingCategory.UserWaitTimebeforeTeamOrDelegates.TotalSeconds} seconds). Team: ");
}
else
{
Console.Out.Write("Team ringing enabled. Team: ");
}
foreach (string currentTeam in _routingCategory.Team)
{
Console.Out.Write($"{currentTeam} ");
}
Console.Out.WriteLine();
}
else if (_routingCategory.CallForwardToTargetsEnabled)
{
if (_routingCategory.CallForwardingEnabled)
{
Console.Out.WriteLine($"Forward immediate to: {_routingCategory.CallForwardTo}");
}
else
{
Console.Out.WriteLine($"User Ring time: {_routingCategory.UserOnlyWaitTime}");
Console.Out.WriteLine($"Call Forward No Answer to: {_routingCategory.CallForwardTo[0]}");
}
}
else if (userEndPointTarget.UmEnabled)
{
Console.Out.WriteLine($"User Ring time: {_routingCategory.UserOnlyWaitTime}");
Console.Out.WriteLine("Call Forward No Answer to: voicemail");
}
else
{
Console.Out.WriteLine("CallForwarding Enabled: false");
}

关于c# - 使用服务器端技术(UCMA 或 MSPL)检索 Lync 客户端的调用转移规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26752709/

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