2

如何在托管 SIP 应用程序(MSPL 或 UCMA 等服务器端技术)中检索 Lync 客户端的呼叫转接规则(路由)?我发现的唯一内容是一篇关于如何在客户端使用 Lync SDK 进行操作的文章。

此外,此答案此 MSDN 文章此问题似乎表明它确实有效,但我在特定时刻(如果用户在线或不在线)需要此设置,而不是在他登录到他的 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();
4

1 回答 1

1

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

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

这是我使它起作用的技术:

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");
            }
于 2015-11-20T11:49:31.683 回答