call: redirect
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
重定向尚未应答或拒绝的传入呼叫。 呼叫的术语"重定向"和"转发"可以互换使用。
机器人预期在呼叫退出之前重定向呼叫。当前超时值为 15 秒。
Permissions
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 | 权限(从最低特权到最高特权) |
|---|---|
| 委派(工作或学校帐户) | 不支持 |
| 委派(个人 Microsoft 帐户) | 不支持 |
| Application | Calls.Initiate.All |
HTTP 请求
POST /app/calls/{id}/redirect
POST /communications/calls/{id}/redirect
注意:
/app路径已弃用。 今后将使用/communications路径。
请求标头
| 名称 | 说明 |
|---|---|
| Authorization | Bearer {token}。必需。 |
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
| 参数 | 类型 | 说明 |
|---|---|---|
| targets | invitationParticipantInfo 集合 | 重定向操作的目标参与者。 如果指定了多个目标,则这是一个同时调用。 这意味着所有目标将同时设定范围,并且只有第一个选取的目标将被连接。 我们最多支持 25 个目标用于模拟。 |
| targetDisposition | String | (弃) 可能的值是:、 default simultaneousRing 、 forward。 此参数已弃用,我们将从提供的目标数自动标识它是一个转发呼叫还是同时调用。 |
| timeout | Int32 | 超时 (重定向) 以秒表示。 超时值的范围介于 15 到 90 秒之间(包括 15 秒和 90 秒)。 一个目标的默认超时值为 55 秒,对于多个目标,默认超时值为 60 秒 (可能会) 。 |
| maskCallee | 布尔 | 指示是否向呼叫者隐藏被叫方。 如果为 true,则被叫方标识为机器人标识。 默认值:False。 |
| maskCaller | Boolean | 指示是否向被叫方隐藏呼叫者。 如果为 true,则呼叫者标识为机器人标识。 默认值:False。 |
| callbackUri | String | 这允许机器人为当前呼叫提供特定的回调 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
Notification - 已终止
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
Notification - 已终止
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
Notification - 已终止
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"
}
}
]
}
反馈
提交和查看相关反馈