Is it possible to set call forwarding via the Lync SDK (2013 or other)?

后端 未结 1 480
心在旅途
心在旅途 2021-01-15 18:39

I work for an IS department in a large institution. The Lync servers that handle our telephones are handled by another department, and any solution that requires cooperation

相关标签:
1条回答
  • 2021-01-15 19:34

    You need to publish your routing information to the Lync server. This contains your simultaneous-ring and forwarding settings, amongst others.

    If you're OK with creating a .Net solution, try the following:

    When you need to program against the Lync server and cannot get any elevated privileges, try using UCMA and create a UserEndpoint. Since you know your Lync server address and have login details, you can create and authenticate a UserEndpoint without cooperation from the other department.

    Example (not mine): Creating UCMA Applications with a UserApplication instance.

    Once you get your endpoint set up, you're basically home free. With the ability to publish presence, you can publish routing settings. For Lync, "presence" is a container which contains everything like availability, routing, contact details, custom locations, etc.

    On your UserEndpoint, subscribe to LocalOwnerPresence.PresenceNotificationReceived MSDN.

    After you sign in with your endpoint, this event will fire and give you your current settings. In the event argument LocalPresentityNotificationEventArgs, grab the AllCategories collection, and look for the PresenceCategoryWithMetaData with the name "routing". Create a new instance of the Routing container with this data. The routing container is the class Microsoft.Rtc.Internal.Collaboration.Routing in Microsoft.Rtc.Collaboration.dll.

    private void OnLocalPresenceNotificationReceived(
        object sender, 
        LocalPresentityNotificationEventArgs e) 
    {
        var container = (from c in e.AllCategories
                         where string.Equals(c.Name, "routing", StringComparison.OrdinalIgnoreCase)
                         orderby c.PublishTime descending
                         select c).FirstOrDefault();
    
        if (container != null)
        {
            var routing = new Microsoft.Rtc.Internal.Collaboration.Routing(container);
    
            // You can access the routing data here...
        }
    }
    

    If you do not receive any routing container, you can create a new instance. Take care though that publishing a new instance will override all your current routing settings instead of allowing you to update the current settings.

    In the Routing class you can write to the following property:

    routing.CallForwardToTargetsEnabled = true;
    routing.CallForwardTo.Clear();
    routing.CallForwardTo.Add("sip or tel number");
    routing.UserOnlyWaitTime = TimeSpan.FromSeconds(...);
    

    And finally, publish the new routing settings:

    endpoint.LocalOwnerPresence.PublishPresenceAsync(new PresenceCategory[] { 
        routing 
    });
    

    It is also possible to publish presence by getting your current Lync instance with the GetClient() method in the Lync SDK. I'm not sure however if this can be used to publish routing settings. You could try though, I found many undocumented options while playing around with Lync. Look at the following two resources:

    How to: Publish enhanced presence information and Self.BeginPublishContactInformation

    0 讨论(0)
提交回复
热议问题