【问题标题】:How to point UCMA code to a dedicated Skype for Business ID如何将 UCMA 代码指向专用 Skype for Business ID
【发布时间】:2017-07-28 08:37:25
【问题描述】:

我是 UCMA Bot 开发的新手。我从 UCMA 5.0 SDK(名为 BuildaBot)中给出的示例应用程序开始我的工作。我无法设置application endpoint。我为此 Bot 创建了一个专用的 SkypeforBusiness ID。这是在我的组织云中创建的。我已经在我们的本地服务器中部署了代码。 我将如何为这个 Skype ID 集成我的代码。

我在 UCMA 5.0 SDK 的其他 QuickSamples 中发现,他们使用的是 Userendpoint。我可以在 App.config 中使用 Skype ID(用于 Bot 的 ID),并且应用程序在本地运行。在生产场景中,Bot 针对许多用户,是否可以使用 Userendpoint?

【问题讨论】:

    标签: asp.net configuration skype-for-business ucma


    【解决方案1】:

    首先您需要了解可以使用 UCMA 编写的应用程序类型:

    1. Trusted Server Applications
    2. Client Applications

    可信服务器应用程序

    这种类型的 UCMA 应用程序功能最强大,您可以使用 ApplicationEndpoints 或 UserEndpoints(通过模拟)。它们仅限于在特定的预设置机器(应用程序池)上运行。因此,运行受信任的服务器应用程序的设置比客户端应用程序要高得多,也更困难。受信任的服务器应用程序不需要任何用户名或密码,它们是使用数字证书设置的(可能发生的另一个设置问题是整理出正确的证书)。这意味着在运行后使用 UserEndpoints 来模拟用户非常容易。

    客户端应用程序

    UCMA 客户端应用程序只能使用 UserEndpoint。对于使用用户端点的客户端应用程序,它必须知道他们希望使用的用户的用户名/密码详细信息。它们也不像受信任的服务器应用程序 UserEndpoint 那样“受信任”(尽管您可能永远不需要额外的权限)。

    两种应用程序类型都可以做同样的事情,所以主要归结为运行需求。

    接下来你需要了解这两种端点是什么:

    应用程序端点

    应用程序端点只能由受信任的服务器应用程序使用。应用程序端点(客户端访问许可证)也没有 CAL 要求。不需要 CAL 可能是走这条路的主要原因。

    用户端点

    用户端点是通过 AD 集成进行的标准 Lync 用户设置,因此每个 AD 用户通常有一个 UserEndpoint。 UserEndpoint 需要分配某种类型的 CAL。 “免费” CAL 许可证或不同级别的付费 CAL 许可证,具体取决于所需的功能。

    这两种端点类型都只是 SIP 端点,您可以使用它们做同样的事情。因此,您可以使用其中任何一个编写机器人。我的猜测是使用 ApplicationEndpoint 的受信任的应用程序,因为您不需要在应用程序端点上支付 CAL 成本,并且您可以根据需要创建/使用任意数量的应用程序。此外,创建应用程序端点(我发现)也比创建 AD 用户更容易。

    【讨论】:

    • 嗨@ShanePowell,感谢您的回复。我想将客户端应用程序与 UserEndPoint 一起使用。所以我会在 app.config 中提供我的 Bot 的 ID。你能帮我理解这段代码如何知道一个人何时向机器人发出 ping 指令吗?这个初始消息实例如何?我是 Bot 编码新手,在控制台应用程序结构方面没有经验。
    • UCMA 是一个 SIP 端点库。因此,所有交互都包含在“SIP”消息传递层中。该 API 公开了各种更高级别的构造,例如 Presence、Calls 等。您需要查找“ping”所指的任何示例。没有“ping”之类的东西......我不知道你想让你的“机器人”做什么。您可以接听电话并给出 IVR 类型的响应……您可以拨打电话并进行自动类型的事情。您可以像 B2BUA 一样使用 B2BCall 支持,您可以支持 IM 消息。所有这些事情都是不同的......所以你需要更具体。
    • 嗨@Shane。抱歉,我评论不清楚。为了开始我的开发,我想要的只是,如果有人向我的 Bot ID 发送“嗨”消息,我希望我的 Bot 回复。你能帮我提供一些示例代码吗?
    • 是的。这里 targetUri 是硬编码的。我怎样才能让它像任何人都可以 ping 到我的 BOT id 一样。此外,例如,最初的消息来自 Bot。我希望 Bot 仅在消息到达该 ID 时回复。
    【解决方案2】:

    它不太可能在互联网上为 UCMA 找到现成的代码。经过大量工作,我想出了问题的答案。 供其他人参考,我在这里更新它。

    如何创建 UCMA 用户端点

    1. 获取专用的 SFB Id(如 abc@domain.com),它将作为 Bot 工作。
    2. 在 App.config 中,提供示例运行所需的此 Bot 参数(值)。

      <appSettings>
      Provide the FQDN of the Microsoft Lync Server-->    
      <add key="ServerFQDN" value="" />
      
      <!--The user name of the user(BOT) that the sample logs in as -->
      <add key="UserName" value="" /> 
      
      <!--The user domain of the user(BOT) that the sample logs in as -->
      <add key="UserDomain" value="" />
      
      <!--The user URI of the user(BOT) that the sample logs in as, in the format sip:user@host-->
      <add key="UserURI" value="sip:abc@domain.com" />
      
      <!--The user URI of the user(BOT) that the sample logs in as-->
      <add key="UserPwd" value="" />
      
      </appSettings>
      
    3. 在 Program.cs 中,放置以下代码。这将建立用户端点。这意味着,您已将 BOT id 映射到应用程序,现在您的应用程序将适用于该 Bot id。

      using System.Configuration;
      using System.Collections.Concurrent;
      using Microsoft.Rtc.Collaboration;
      using Microsoft.Rtc.Signaling;
      
      namespace Bot
      {
      public class Program
      {
      private static string sipaddress = ConfigurationManager.AppSettings["UserURI"];
      private static string username = ConfigurationManager.AppSettings["UserName"];
      private static string password = ConfigurationManager.AppSettings["UserPwd"];
      private static string domain = ConfigurationManager.AppSettings["UserDomain"];
      
      CollaborationPlatform _platform;
      UserEndpoint _endpoint;
      
      static void Main(string[] args)
      {
      var platformSettings = new ClientPlatformSettings(userAgent, SipTransportType.Tls);
          _platform = new CollaborationPlatform(platformSettings);
      
          UserEndpointSettings settings = new UserEndpointSettings(sipaddress);
          settings.Credential = new System.Net.NetworkCredential(username, password, domain);
          settings.AutomaticPresencePublicationEnabled = true;
      
          _endpoint = new UserEndpoint(_platform, settings);
          }}}
      

    您还必须编写代码,以便接收消息并回复消息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-21
      • 2017-03-09
      • 2020-10-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多