2014-11-05 68 views
2

如何檢索受管SIP應用程序(服務器端技術,如MSPL或UCMA)中的Lync客戶端的呼叫轉移規則(路由)?我發現的唯一一條關於如何使用Lync SDK在客戶端執行此操作的文章。使用服務器端技術(UCMA或MSPL)檢索Lync客戶端的呼叫轉移規則

而且this Answerthis MSDN Articlethis Question似乎表明,它的工作,但我需要在特定時刻此設置(如果用戶是否在線),而不是當他登錄到他的Lync帳戶,並發表了他的存在info,如鏈接#1所示。此外,有必要先爲任何客戶端獲取此信息,而無需先創建UserEndpoint。所以最好的情況是使用ApplicationEndpoint(或其他方法)。

據我所知,應該可以從呈現元數據中檢索轉發設置,但我沒有得到這些信息。

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

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

回答

1

你不能用一個ApplicationEndpoint做到這一點。您必須有用戶終端。 但是,您可以創建僅需要CollaborationPlateformSipUser而不是任何密碼的用戶終端

對於我的應用程序,我通過ILSpy反編譯SEFAUtil.exe以瞭解他們在他們的程序中的表現。我建議你看看它。

這是我的技術,使其工作:

1 /的UserEndPoint

創建在創建你必須認購該存在的用戶終端來獲取信息,即使是沒有連接

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"); 
      } 
相關問題