命名空间:microsoft.graph
取消处理任何正在进行的媒体操作。
媒体操作是指 IVR 操作 playPrompt 和 recordResponse,它们默认按顺序排队等待处理。
cancelMediaProcessing 方法将取消进程内的任何操作以及排队的操作。 例如,此方法可用于清理新媒体操作的 IVR 操作队列。 但是,它不会取消 subscribeToTone 操作,因为它独立于任何操作队列运行。
此 API 可用于以下国家级云部署。
全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
✅ |
✅ |
✅ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 |
最低特权权限 |
更高特权权限 |
委派(工作或学校帐户) |
不支持。 |
不支持。 |
委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
应用程序 |
Calls.Initiate.All |
Calls.AccessMedia.All |
注意:创建调用时,将检查权限;调用此 API 时,不会创建其他权限检查。 Calls.AccessMedia.All 仅对使用应用托管媒体的调用是必需的。
HTTP 请求
POST /communications/calls/{id}/cancelMediaProcessing
名称 |
说明 |
Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
Content-type |
application/json. 必需。 |
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
参数 |
类型 |
说明 |
clientContext |
String |
客户端上下文。 |
响应
如果成功,此方法返回 HTTP 200 OK
响应代码和 Location 标头,其中包含为此请求创建的 commsOperation 的 URI。
示例
以下示例演示如何调用此 API。
请求
下面为请求示例。
POST https://graph.microsoft.com/v1.0/communications/calls/{id}/cancelMediaProcessing
Content-Type: application/json
Content-Length: 62
{
"clientContext": "clientContext-value"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.Calls.Item.CancelMediaProcessing;
var requestBody = new CancelMediaProcessingPostRequestBody
{
ClientContext = "clientContext-value",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls["{call-id}"].CancelMediaProcessing.PostAsync(requestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
mgc communications calls cancel-media-processing post --call-id {call-id} --body '{\
"clientContext": "clientContext-value"\
}\
'
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphcommunications "github.com/microsoftgraph/msgraph-sdk-go/communications"
//other-imports
)
requestBody := graphcommunications.NewCancelMediaProcessingPostRequestBody()
clientContext := "clientContext-value"
requestBody.SetClientContext(&clientContext)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
cancelMediaProcessing, err := graphClient.Communications().Calls().ByCallId("call-id").CancelMediaProcessing().Post(context.Background(), requestBody, nil)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.communications.calls.item.cancelmediaprocessing.CancelMediaProcessingPostRequestBody cancelMediaProcessingPostRequestBody = new com.microsoft.graph.communications.calls.item.cancelmediaprocessing.CancelMediaProcessingPostRequestBody();
cancelMediaProcessingPostRequestBody.setClientContext("clientContext-value");
var result = graphClient.communications().calls().byCallId("{call-id}").cancelMediaProcessing().post(cancelMediaProcessingPostRequestBody);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
const cancelMediaProcessingOperation = {
clientContext: 'clientContext-value'
};
await client.api('/communications/calls/{id}/cancelMediaProcessing')
.post(cancelMediaProcessingOperation);
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\Calls\Item\CancelMediaProcessing\CancelMediaProcessingPostRequestBody;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CancelMediaProcessingPostRequestBody();
$requestBody->setClientContext('clientContext-value');
$result = $graphServiceClient->communications()->calls()->byCallId('call-id')->cancelMediaProcessing()->post($requestBody)->wait();
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
clientContext = "clientContext-value"
}
Stop-MgCommunicationCallMediaProcessing -CallId $callId -BodyParameter $params
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.calls.item.cancel_media_processing.cancel_media_processing_post_request_body import CancelMediaProcessingPostRequestBody
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = CancelMediaProcessingPostRequestBody(
client_context = "clientContext-value",
)
result = await graph_client.communications.calls.by_call_id('call-id').cancel_media_processing.post(request_body)
有关如何将 SDK 添加到项目并创建 authProvider 实例的详细信息,请参阅 SDK 文档。
响应
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Location: https://graph.microsoft.com/v1.0/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/operations/17e3b46c-f61d-4f4d-9635-c626ef18e6ad
Content-Type: application/json
Content-Length: 259
{
"@odata.type": "#microsoft.graph.cancelMediaProcessingOperation",
"status": "completed",
"clientContext": "d45324c1-fcb5-430a-902c-f20af696537c",
"id": "0fe0623f-d628-42ed-b4bd-8ac290072cc5"
}
通知 - 已取消记录Response 的操作
POST https://bot.contoso.com/api/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "deleted",
"resourceUrl": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896/operations/0FE0623FD62842EDB4BD8AC290072CC5",
"resourceData": {
"@odata.type": "#microsoft.graph.recordOperation",
"@odata.id": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896/operations/0FE0623FD62842EDB4BD8AC290072CC5",
"@odata.etag": "W/\"54451\"",
"id": "0fe0623f-d628-42ed-b4bd-8ac290072cc5",
"clientContext": "d45324c1-fcb5-430a-902c-f20af696537c",
"status": "failed",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 400,
"subcode": 8508,
"message": "Action failed, the operation was cancelled."
},
"recordingLocation": "",
"recordingAccessToken": "",
"completionReason": "operationCanceled"
}
}
]
}