向 Microsoft Teams Calling Bot 语音呼叫者的发起者发送主动聊天消息

时间:2021-01-22 02:03:07

标签: microsoft-teams

我有一个团队机器人,可以接听一对一的语音电话。在通话期间,我希望机器人能够向用户发送聊天消息并能够引用用户数据(例如他们的姓名)。

尽管来电确实具有加密的源身份,但从我的实验来看,这似乎不是用于主动消息传递的有效用户 ID。

有趣的是,这在群组通话中很容易实现,因为它开始向您传递参与者列表(我以前做过),但 1 对 1 通话似乎依赖于有效地使用户保持匿名的源字段。

{
  "@odata.type": "#microsoft.graph.commsNotifications",
  "value": [
    {
      "@odata.type": "#microsoft.graph.commsNotification",
      "changeType": "created",
      "resource": "/app/calls/4a1f2c00-831f-4e4e-9d7c-1648b6dddb73",
      "resourceUrl": "/communications/calls/4a1f2c00-831f-4e4e-9d7c-1648b6dddb73",
      "resourceData": {
        "@odata.type": "#microsoft.graph.call",
        "state": "incoming",
        "direction": "incoming",
        "callbackUri": "https://...",
        "source": {
          "@odata.type": "#microsoft.graph.participantInfo",
          "id": "7684a0ea-7db6-4f3e-a339-eb46e16d57f0",
          "identity": {
            "@odata.type": "#microsoft.graph.identitySet",
            "encrypted": {
              "@odata.type": "#microsoft.graph.identity",
              "id": "1g7qrdwga2udafuebrjcyobchnq7r4xigupowjluuccfdceufmew6ush6wlx-kellf96ky2nnhsl084rn6vegqmwawiqpux0kk5aw5lqq9oydrewxe9awkrk_uh_0nxat", // <-- not a valid chat user
              "tenantId": "{tenancyId}",
              "identityProvider": "None"
            }
          },
          "endpointType": "default",
          "region": "apac",
          "languageId": "en-us"
        },
        "targets": [
          {
            "@odata.type": "#microsoft.graph.invitationParticipantInfo",
            "identity": {
              "@odata.type": "#microsoft.graph.identitySet",
              "application": {
                "@odata.type": "#microsoft.graph.identity",
                "id": "a2716ab5-9b38-4364-8869-b9b8deeff897",
                "identityProvider": "AAD"
              }
            },
            "endpointType": "default",
            "id": "023126f0-904f-4c01-a78d-03f28e77e7a7",
            "region": null,
            "languageId": null
          }
        ],
        "tenantId": "{Azure Tenancy}",
        "myParticipantId": "023126f0-904f-4c01-a78d-03f28e77e7a7",
        "callChainId": "37de77c7-54b3-4d04-9e9c-181e5f5b5773",
        "incomingContext": {
          "@odata.type": "#microsoft.graph.incomingContext",
          "sourceParticipantId": "7684a0ea-7db6-4f3e-a339-eb46e16d57f0"
        },
        "id": "4a1f2c00-831f-4e4e-9d7c-1648b6dddb73"
      }
    }
  ]
}

1 个答案:

答案 0 :(得分:0)

是的,我们可以通过从机器人创建响应者呼叫处理程序来发送聊天消息。 您能否尝试实现sample code。 在示例代码中,会有一个名为“ResponderCallHandler.cs”的类,请看。