call: reject
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
使机器人能够拒绝传入呼叫。 传入呼叫请求可以是来自组呼叫参与者的邀请或对等呼叫。 如果收到组呼叫邀请,通知将包含 chatInfo 和 meetingInfo 参数。
机器人预期在呼叫退出之前应答或拒绝呼叫。当前超时值为 15 秒。
此 API 不会结束已应答的现有调用。 使用 删除呼叫 结束呼叫。
Permissions
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
不支持
委派(个人 Microsoft 帐户)
不支持
Application
无
HTTP 请求
POST /app/calls/{id}/reject
POST /communications/calls/{id}/reject
注意: /app 路径已弃用。 今后将使用 /communications 路径。
名称
说明
Authorization
Bearer {token}。必需。
Content-type
application/json. Required.
请求正文
在请求正文中,提供具有以下参数的 JSON 对象。
参数
类型
说明
reason
String
拒绝原因。 可能的值是 、 None和 Busy``Forbidden
callbackUri
String
这允许机器人为当前呼叫提供特定的回调 URI,以接收以后的通知。 如果尚未设置此属性,将改为使用自动程序全局回调 URI。 这必须是 https。
响应
如果成功,此方法返回 202 Accepted 响应代码。它不在响应正文中返回任何内容。
示例
以下示例显示如何调用此 API。
示例 1:拒绝具有"Busy"原因的传入呼叫
请求
POST https://graph.microsoft.com/beta/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/reject
Content-Type: application/json
Content-Length: 24
{
"reason": "busy"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var reason = RejectReason.Busy;
await graphClient.Communications.Calls["{call-id}"]
.Reject(reason,null)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const reject = {
reason: 'busy'
};
await client.api('/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/reject')
.version('beta')
.post(reject);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/reject"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
MSGraphRejectReason *reason = [MSGraphRejectReason busy];
payloadDictionary[@"reason"] = reason;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
RejectReason reason = RejectReason.BUSY;
graphClient.communications().calls("57dab8b1-894c-409a-b240-bd8beae78896")
.reject(CallRejectParameterSet
.newBuilder()
.withReason(reason)
.withCallbackUri(null)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
reason := "busy"
requestBody.SetReason(&reason)
callId := "call-id"
graphClient.Communications().CallsById(&callId).Reject(call-id).Post(requestBody)
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
Reason = "busy"
}
Invoke-MgRejectCommunicationCall -CallId $callId -BodyParameter $params
响应
HTTP/1.1 202 Accepted
示例 2:拒绝具有"无"原因的传入呼叫
通知 - 传入
POST https://bot.contoso.com/api/call
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "created",
"resourceUrl": "/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"@odata.id": "/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896",
"state": "incoming",
"direction": "incoming",
"source": {
"identity": {
"user": {
"displayName": "John",
"id": "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
}
},
"region": "westus",
"languageId": "en-US"
},
"targets": [
{
"identity": {
"application": {
"displayName": "Calling Bot",
"id": "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
},
"region": "westus",
"languageId": "en-US"
}
],
"requestedModalities": [ "audio", "video" ]
}
}
]
}
请求
POST https://graph.microsoft.com/beta/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/reject
Content-Type: application/json
Content-Length: 24
{
"reason": "none"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var reason = RejectReason.None;
await graphClient.Communications.Calls["{call-id}"]
.Reject(reason,null)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const reject = {
reason: 'none'
};
await client.api('/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/reject')
.version('beta')
.post(reject);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/reject"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
MSGraphRejectReason *reason = [MSGraphRejectReason none];
payloadDictionary[@"reason"] = reason;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
RejectReason reason = RejectReason.NONE;
graphClient.communications().calls("57dab8b1-894c-409a-b240-bd8beae78896")
.reject(CallRejectParameterSet
.newBuilder()
.withReason(reason)
.withCallbackUri(null)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
reason := "none"
requestBody.SetReason(&reason)
callId := "call-id"
graphClient.Communications().CallsById(&callId).Reject(call-id).Post(requestBody)
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
Reason = "none"
}
Invoke-MgRejectCommunicationCall -CallId $callId -BodyParameter $params
响应
HTTP/1.1 202 Accepted
通知 - 已删除
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/57dab8b1-894c-409a-b240-bd8beae78896",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"@odata.id": "/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896"
}
}
]
}