使用服务器端技术(UCMA或MSPL)检索Lync客户端的呼叫转移规则 [英] Retrieve call forwarding rules of a Lync client with server-side technologies (UCMA or MSPL)

查看:72
本文介绍了使用服务器端技术(UCMA或MSPL)检索Lync客户端的呼叫转移规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How can I retrieve the call forwarding rules (routing) of a Lync client in a Managed SIP Application (serverside technologies like MSPL or UCMA)? The only thing I found is an Article on how you can do it clientside with the Lync SDK.

此答案

Also this Answer and this MSDN Article and this Question seem to indicate that it does work but I need this setting at a specific moment (if the User is online or not) and not as soon as he logs into his Lync account and publishes his presence info, as seen in link #1. Also it is necessary to get this for any client without creating an UserEndpoint first. So it would be best if this is possible with an ApplicationEndpoint (or another method).

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

As far as I found out, it should be possible to retrieve the forwarding settings from the presence metadata, but I do not get this information.

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

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

推荐答案

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

You cannot do it with an ApplicationEndpoint. You must have an UserEndpoint. However, you can create a UserEndpoint who just need the CollaborationPlateform and the SipUser and not any passwords.

对于我的应用程序,我反编译了 SEFAUtil.exe ="nofollow"> ILSpy 了解他们在程序中的工作方式.我建议你看看它.

For my application, I decompiled SEFAUtil.exe via ILSpy to understand how they did in their programs. I advise you to take a look at it.

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

This is my technique to make it works:

1/创建UserEndPoint

1/ Creation of the UserEndPoint

在创建用户端点时,您必须订阅此状态以获取信息,即使未连接

When creating the user endpoint you have to subscribe for this presence to get the information even if is not connected

userEndpoint.LocalOwnerPresence.BeginSubscribe(null, null);

2/订阅PresenceNotificationReceived事件

2/ Subscribe to PresenceNotificationReceived Event

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");
            }

这篇关于使用服务器端技术(UCMA或MSPL)检索Lync客户端的呼叫转移规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆