调用:重定向
命名空间:microsoft.graph
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
重定向尚未 接听 或 拒绝 的传入呼叫。 术语“重定向”和“转发”呼叫可互换使用。
机器人应在呼叫超时之前重定向呼叫。当前超时值为 15 秒。
此 API 可用于以下国家级云部署。
全局服务 | 美国政府 L4 | 美国政府 L5 (DOD) | 由世纪互联运营的中国 |
---|---|---|---|
✅ | ❌ | ❌ | ❌ |
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 | 最低特权权限 | 更高特权权限 |
---|---|---|
委派(工作或学校帐户) | 不支持。 | 不支持。 |
委派(个人 Microsoft 帐户) | 不支持。 | 不支持。 |
应用程序 | Calls.Initiate.All | 不可用。 |
HTTP 请求
POST /app/calls/{id}/redirect
POST /communications/calls/{id}/redirect
注意:
/app
路径已弃用。 今后将使用/communications
路径。
请求标头
名称 | 说明 |
---|---|
Authorization | 持有者 {token}。 必填。 详细了解 身份验证和授权。 |
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
参数 | 类型 | 说明 |
---|---|---|
targets | invitationParticipantInfo 集合 | 重定向操作的目标参与者。 如果指定了多个目标,则为同时响铃调用。 这意味着将同时调用所有目标,并且仅连接了第一个拾取的目标。 同时环最多支持 25 个目标。 |
targetDisposition | String | (已弃用) 可能的值为: default 、 simultaneousRing 、 forward 。 此参数已弃用。 系统根据提供的目标数自动识别是前向呼叫还是同时响铃呼叫。 |
timeout | Int32 | 重定向操作) 超时 (秒。 超时值的范围介于 15 到 90 秒(含)之间。 对于 1 个目标,默认超时值为 55 秒,对于多个目标,默认超时值为 60 秒, (可能会) 更改。 |
maskCallee | 布尔值 | 指示是否要对调用方隐藏被调用方。 如果为 true,则被调用方标识为机器人标识。 默认值:False。 |
maskCaller | 布尔值 | 指示调用方是否对被调用方隐藏。 如果为 true,则调用方标识为机器人标识。 默认值:False。 |
callbackUri | String | 允许机器人为当前调用提供特定的回调 URI,以接收以后的通知。 如果未设置此属性,则改用机器人的全局回调 URI。 URI 必须为 https 。 |
响应
如果成功,此方法返回 202 Accepted
响应代码。
示例
这些示例介绍了传入呼叫通知的工作流以及如何重定向该呼叫。
注意: 为了提高可读性,可能会缩短此处显示的响应对象。 所有属性都是从实际调用返回的。
示例 1:将呼叫转接到目标
通知 - 传入
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "created",
"resourceUrl": "/communications/calls/491f0b00-ffff-4bc9-a43e-b226498ec22a",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "incoming",
"direction": "incoming",
"callbackUri": "https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "8d1e6ab6-26c5-4e22-a1bc-06ea7343958e",
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f"
}
},
"region": "amer",
},
"targets": [
{
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "test bot",
"id": "24701998-1a73-4d42-8085-bf46ed0ae039"
}
}
}
],
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f",
"myParticipantId": "c339cede-4bd6-4f20-ab9f-3a13e65f6d00",
"id": "491f0b00-ffff-4bc9-a43e-b226498ec22a"
}
}
]
}
请求
POST https://graph.microsoft.com/beta/communications/calls/491f0b00-ffff-4bc9-a43e-b226498ec22a/redirect
Content-Type: application/json
{
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "test bot 2",
"id": "22bfd41f-550e-477d-8789-f6f7bd2a5e8b"
}
}
}
],
"callbackUri": "https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039"
}
响应
以下示例显示了相应的响应。
HTTP/1.1 202 Accepted
通知 - 已终止
POST https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "deleted",
"resourceUrl": "/communications/calls/491f0b00-ffff-4bc9-a43e-b226498ec22a",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "terminated",
"direction": "incoming",
"callbackUri": "https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "8d1e6ab6-26c5-4e22-a1bc-06ea7343958e",
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f"
}
},
"region": "amer",
},
"targets": [
{
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "test bot",
"id": "24701998-1a73-4d42-8085-bf46ed0ae039"
}
}
}
],
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f",
"myParticipantId": "c339cede-4bd6-4f20-ab9f-3a13e65f6d00",
"id": "491f0b00-ffff-4bc9-a43e-b226498ec22a"
}
}
]
}
示例 2:使用同时响铃将呼叫转发到多个目标
通知 - 传入
POST https://bot.contoso.com/api/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "created",
"resourceUrl": "/communications/calls/481f0b00-ffff-4ca1-8c67-a5f1e31e8e82",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "incoming",
"direction": "incoming",
"callbackUri": "https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "ec040873-8235-45fd-a403-c7259a5a548e",
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f"
}
},
"region": "amer"
},
"targets": [
{
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "test bot",
"id": "24701998-1a73-4d42-8085-bf46ed0ae039"
}
}
}
],
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f",
"myParticipantId": "f540f1b6-994b-4866-be95-8aad34c4f4dc",
"id": "481f0b00-ffff-4ca1-8c67-a5f1e31e8e82"
}
}
]
}
请求
以下示例显示了一个请求。
POST https://graph.microsoft.com/beta/communications/calls/481f0b00-ffff-4ca1-8c67-a5f1e31e8e82/redirect
Content-Type: application/json
{
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "test user",
"id": "98da8a1a-1b87-452c-a713-65d3f10b1253"
}
}
},
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "test user 2",
"id": "bf5aae9a-d11d-47a8-93b1-782504c9c3f3"
}
}
}
],
"routingPolicies": [
"disableForwarding"
],
"callbackUri": "https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039"
}
响应
以下示例显示了相应的响应。
HTTP/1.1 202 Accepted
通知 - 已终止
POST https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "deleted",
"resourceUrl": "/communications/calls/491f0b00-ffff-4bc9-a43e-b226498ec22a",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "terminated",
"direction": "incoming",
"callbackUri": "https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "ec040873-8235-45fd-a403-c7259a5a548e",
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f"
}
},
"region": "amer"
},
"targets": [
{
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "test bot",
"id": "24701998-1a73-4d42-8085-bf46ed0ae039"
}
}
}
],
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f",
"myParticipantId": "f540f1b6-994b-4866-be95-8aad34c4f4dc",
"id": "481f0b00-ffff-4ca1-8c67-a5f1e31e8e82"
}
}
]
}
示例 3:将呼叫转接到 PSTN 号码
此调用需要分配了 PSTN 号码的应用程序实例。 有关详细信息,请参阅 为机器人分配电话号码。
注意: 电话 ID 是 E.164 格式的电话号码。
通知 - 传入
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "created",
"resourceUrl": "/communications/calls/491f0b00-ffff-4bc9-a43e-b226498ec22a",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "incoming",
"direction": "incoming",
"callbackUri": "https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "8d1e6ab6-26c5-4e22-a1bc-06ea7343958e",
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f"
}
},
"region": "amer",
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"applicationInstance": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "PstnAppInstance",
"id": "7629bdce-046c-4903-86b4-a8f718277e1a",
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f"
}
},
"endpointType": "default",
"id": "c339cede-4bd6-4f20-ab9f-3a13e65f6d00",
"region": "amer",
"languageId": null
}
],
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f",
"myParticipantId": "c339cede-4bd6-4f20-ab9f-3a13e65f6d00",
"id": "491f0b00-ffff-4bc9-a43e-b226498ec22a"
}
}
]
}
请求
以下示例显示了一个请求。
POST https://graph.microsoft.com/beta/communications/calls/491f0b00-ffff-4bc9-a43e-b226498ec22a/redirect
Content-Type: application/json
{
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"phone": {
"@odata.type": "#microsoft.graph.identity",
"id": "+12345678901"
}
}
}
],
"callbackUri": "https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039"
}
响应
以下示例显示了相应的响应。
HTTP/1.1 202 Accepted
通知 - 已终止
POST https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "deleted",
"resourceUrl": "/communications/calls/491f0b00-ffff-4bc9-a43e-b226498ec22a",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "terminated",
"direction": "incoming",
"callbackUri": "https://bot.contoso.com/api/calls/24701998-1a73-4d42-8085-bf46ed0ae039",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "8d1e6ab6-26c5-4e22-a1bc-06ea7343958e",
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f"
}
},
"region": "amer",
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"applicationInstance": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "PstnAppInstance",
"id": "7629bdce-046c-4903-86b4-a8f718277e1a",
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f"
}
},
"endpointType": "default",
"id": "c339cede-4bd6-4f20-ab9f-3a13e65f6d00",
"region": "amer",
"languageId": null
}
],
"answeredBy": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"encrypted": {
"@odata.type": "#microsoft.graph.identity",
"id": "1xt4uextl99sdzwdxuvdxrvgrv8gehcq7jdgf9yhzeto"
}
},
"endpointType": "default"
},
"tenantId": "632899f8-2ea1-4604-8413-27bd2892079f",
"myParticipantId": "c339cede-4bd6-4f20-ab9f-3a13e65f6d00",
"id": "491f0b00-ffff-4bc9-a43e-b226498ec22a"
}
}
]
}