Namespace: microsoft.graph
Aktivieren eines Bots zum Annehmen eines eingehenden Anrufs. Die eingehende Anrufanforderung kann eine Einladung eines Teilnehmers an einem Gruppenanruf oder einem Peer-to-Peer-Anruf sein. Wenn eine Einladung zu einem Gruppenanruf eingeht, enthält die Benachrichtigung die Parameter chatInfo und meetingInfo .
Es wird erwartet, dass der Bot den Anruf beantwortet, ablehnt oder umleitet , bevor der Anruf abläuft. Der aktuelle Timeoutwert beträgt 15 Sekunden für reguläre Szenarien und 5 Sekunden für richtlinienbasierte Aufzeichnungsszenarien.
Diese API unterstützt die folgenden PSTN-Szenarien:
- Eingehender Anruf an die PSTN-Nummer des Bots und dann Bot lädt ein weiteres PSTN ein.
- Eingehender Anruf an die PSTN-Nummer des Bots und anschließende Bot-Weiterleitung an ein anderes PSTN.
- Eingehender Anruf an die PSTN-Nummer des Bots und der Bot leitet dann an einen anderen PSTN um.
- Eingehender Aufruf an die Instanz-ID des Bots und dann Bot lädt ein weiteres PSTN ein.
- Eingehender Aufruf an die Instanz-ID des Bots und anschließende Bot-Übertragung an ein anderes PSTN.
- Eingehender Aufruf an die Instanz-ID des Bots und der Bot leitet dann an ein anderes PSTN um.
- Eingehender Anruf an den Instanzbezeichner des Bots von der geplanten Besprechung und dann der Bot lädt PSTN ein.
- Ausgehender Anruf von einem Bot (mit Instanz-ID) an ein PSTN.
- P2P-Anruf zwischen Bot und einem anderen Peer (Teams-Benutzer, PSTN), Bot lädt einen anderen PSTN ein.
- P2P-Anruf zwischen Bot und einem anderen Peer (Teams-Benutzer, PSTN), Bot lädt einen anderen Teams-Benutzer ein.
- Bot: Nehmen Sie an der geplanten Besprechung teil, und laden Sie dann PSTN ein.
API-Verfügbarkeit
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
✅ |
✅ |
❌ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
Nicht unterstützt |
Nicht unterstützt |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Application |
Calls.JoinGroupCall.All |
Calls.JoinGroupCallAsGuest.All |
Hinweis: Für einen Aufruf, der von der Anwendung gehostete Medien verwendet, benötigen Sie auch die Berechtigung Calls.AccessMedia.All. Sie müssen über mindestens eine der folgenden Berechtigungen verfügen, um sicherzustellen, dass die source Benachrichtigung über eingehende Anrufe entschlüsselt wird: Calls.AccessMedia.All, Calls.Initiate.All, Calls.InitiateGroupCall.All, Calls.JoinGroupCall.All, Calls.JoinGroupCallAsGuest.All. Dies source sind die Anruferinformationen in der Benachrichtigung über eingehende Anrufe. Ohne mindestens eine dieser Berechtigungen bleiben sie source verschlüsselt.
HTTP-Anforderung
POST /communications/calls/{id}/answer
Anforderungstext
Geben Sie im Anforderungstext ein JSON-Objekt mit den folgenden Parametern an.
| Parameter |
Typ |
Beschreibung |
| callbackUri |
Zeichenfolge |
Ermöglicht Bots, einen bestimmten Rückruf-URI für den gleichzeitigen Anruf bereitzustellen, um spätere Benachrichtigungen zu erhalten. Wenn diese Eigenschaft nicht festgelegt ist, wird stattdessen der globale Rückruf-URI des Bots verwendet. Ich muss sein https. |
| acceptedModalities |
String collection |
Die Liste der akzeptierten Modalitäten. Die möglichen Werte sind: audio, video, videoBasedScreenSharing. Erforderlich für das Annehmen eines Anrufs. |
| callOptions |
incomingCallOptions |
Die Anrufoptionen. |
| mediaConfig |
appHostedMediaConfig oder serviceHostedMediaConfig |
Die Medienkonfiguration. Erforderlich. |
| participantCapacity |
Int32 |
Die Anzahl der Teilnehmer, die die Anwendung für den Anruf verarbeiten kann, für ein richtlinienbasiertes Aufzeichnungsszenario von Teams . |
Antwort
Diese Methode gibt einen 202 Accepted Antwortcode zurück.
Beispiele
Das folgende Beispiel illustriert, wie Sie diese API aufrufen können.
Anforderung
Das folgende Beispiel zeigt die Antwort.
POST https://graph.microsoft.com/v1.0/communications/calls/{id}/answer
Content-Type: application/json
Content-Length: 211
{
"callbackUri": "callbackUri-value",
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
"blob": "<Media Session Configuration Blob>"
},
"acceptedModalities": [
"audio"
],
"callOptions": {
"@odata.type": "#microsoft.graph.incomingCallOptions",
"isContentSharingNotificationEnabled": true,
"isDeltaRosterEnabled": true,
"isInteractiveRosterEnabled": true
},
"participantCapacity": 200
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.Calls.Item.Answer;
using Microsoft.Graph.Models;
var requestBody = new AnswerPostRequestBody
{
CallbackUri = "callbackUri-value",
MediaConfig = new AppHostedMediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
Blob = "<Media Session Configuration Blob>",
},
AcceptedModalities = new List<Modality?>
{
Modality.Audio,
},
CallOptions = new IncomingCallOptions
{
OdataType = "#microsoft.graph.incomingCallOptions",
IsContentSharingNotificationEnabled = true,
IsDeltaRosterEnabled = true,
IsInteractiveRosterEnabled = true,
},
ParticipantCapacity = 200,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Communications.Calls["{call-id}"].Answer.PostAsync(requestBody);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphcommunications.NewAnswerPostRequestBody()
callbackUri := "callbackUri-value"
requestBody.SetCallbackUri(&callbackUri)
mediaConfig := graphmodels.NewAppHostedMediaConfig()
blob := "<Media Session Configuration Blob>"
mediaConfig.SetBlob(&blob)
requestBody.SetMediaConfig(mediaConfig)
acceptedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetAcceptedModalities(acceptedModalities)
callOptions := graphmodels.NewIncomingCallOptions()
isContentSharingNotificationEnabled := true
callOptions.SetIsContentSharingNotificationEnabled(&isContentSharingNotificationEnabled)
isDeltaRosterEnabled := true
callOptions.SetIsDeltaRosterEnabled(&isDeltaRosterEnabled)
isInteractiveRosterEnabled := true
callOptions.SetIsInteractiveRosterEnabled(&isInteractiveRosterEnabled)
requestBody.SetCallOptions(callOptions)
participantCapacity := int32(200)
requestBody.SetParticipantCapacity(&participantCapacity)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Communications().Calls().ByCallId("call-id").Answer().Post(context.Background(), requestBody, nil)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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.answer.AnswerPostRequestBody answerPostRequestBody = new com.microsoft.graph.communications.calls.item.answer.AnswerPostRequestBody();
answerPostRequestBody.setCallbackUri("callbackUri-value");
AppHostedMediaConfig mediaConfig = new AppHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.appHostedMediaConfig");
mediaConfig.setBlob("<Media Session Configuration Blob>");
answerPostRequestBody.setMediaConfig(mediaConfig);
LinkedList<Modality> acceptedModalities = new LinkedList<Modality>();
acceptedModalities.add(Modality.Audio);
answerPostRequestBody.setAcceptedModalities(acceptedModalities);
IncomingCallOptions callOptions = new IncomingCallOptions();
callOptions.setOdataType("#microsoft.graph.incomingCallOptions");
callOptions.setIsContentSharingNotificationEnabled(true);
callOptions.setIsDeltaRosterEnabled(true);
callOptions.setIsInteractiveRosterEnabled(true);
answerPostRequestBody.setCallOptions(callOptions);
answerPostRequestBody.setParticipantCapacity(200);
graphClient.communications().calls().byCallId("{call-id}").answer().post(answerPostRequestBody);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
const options = {
authProvider,
};
const client = Client.init(options);
const answer = {
callbackUri: 'callbackUri-value',
mediaConfig: {
'@odata.type': '#microsoft.graph.appHostedMediaConfig',
blob: '<Media Session Configuration Blob>'
},
acceptedModalities: [
'audio'
],
callOptions: {
'@odata.type': '#microsoft.graph.incomingCallOptions',
isContentSharingNotificationEnabled: true,
isDeltaRosterEnabled: true,
isInteractiveRosterEnabled: true
},
participantCapacity: 200
};
await client.api('/communications/calls/{id}/answer')
.post(answer);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\Calls\Item\Answer\AnswerPostRequestBody;
use Microsoft\Graph\Generated\Models\AppHostedMediaConfig;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\IncomingCallOptions;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AnswerPostRequestBody();
$requestBody->setCallbackUri('callbackUri-value');
$mediaConfig = new AppHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.appHostedMediaConfig');
$mediaConfig->setBlob('<Media Session Configuration Blob>');
$requestBody->setMediaConfig($mediaConfig);
$requestBody->setAcceptedModalities([new Modality('audio'), ]);
$callOptions = new IncomingCallOptions();
$callOptions->setOdataType('#microsoft.graph.incomingCallOptions');
$callOptions->setIsContentSharingNotificationEnabled(true);
$callOptions->setIsDeltaRosterEnabled(true);
$callOptions->setIsInteractiveRosterEnabled(true);
$requestBody->setCallOptions($callOptions);
$requestBody->setParticipantCapacity(200);
$graphServiceClient->communications()->calls()->byCallId('call-id')->answer()->post($requestBody)->wait();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
callbackUri = "callbackUri-value"
mediaConfig = @{
"@odata.type" = "#microsoft.graph.appHostedMediaConfig"
blob = "<Media Session Configuration Blob>"
}
acceptedModalities = @(
"audio"
)
callOptions = @{
"@odata.type" = "#microsoft.graph.incomingCallOptions"
isContentSharingNotificationEnabled = $true
isDeltaRosterEnabled = $true
isInteractiveRosterEnabled = $true
}
participantCapacity = 200
}
Invoke-MgAnswerCommunicationCall -CallId $callId -BodyParameter $params
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.calls.item.answer.answer_post_request_body import AnswerPostRequestBody
from msgraph.generated.models.app_hosted_media_config import AppHostedMediaConfig
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.incoming_call_options import IncomingCallOptions
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AnswerPostRequestBody(
callback_uri = "callbackUri-value",
media_config = AppHostedMediaConfig(
odata_type = "#microsoft.graph.appHostedMediaConfig",
blob = "<Media Session Configuration Blob>",
),
accepted_modalities = [
Modality.Audio,
],
call_options = IncomingCallOptions(
odata_type = "#microsoft.graph.incomingCallOptions",
is_content_sharing_notification_enabled = True,
is_delta_roster_enabled = True,
is_interactive_roster_enabled = True,
),
participant_capacity = 200,
)
await graph_client.communications.calls.by_call_id('call-id').answer.post(request_body)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Antwort
Das folgende Beispiel zeigt die Antwort.
HTTP/1.1 202 Accepted
Benachrichtigung – eingehend
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/57DAB8B1894C409AB240BD8BEAE78896",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"@odata.id": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"@odata.etag": "W/\"5445\"",
"state": "incoming",
"direction": "incoming",
"source": {
"identity": {
"user": {
"displayName": "Test User",
"id": "8A34A46B-3D17-4ADC-8DCE-DC4E7D572698"
}
},
"region": "westus",
"languageId": "en-US"
},
"targets": [
{
"identity": {
"application": {
"displayName": "Test BOT",
"id": "8A34A46B-3D17-4ADC-8DCE-DC4E7D572698"
}
}
}
],
"requestedModalities": [ "audio" ]
}
}
]
}
Anforderung
POST https://graph.microsoft.com/v1.0/communications/calls/57DAB8B1894C409AB240BD8BEAE78896/answer
Content-Type: application/json
{
"callbackUri": "https://bot.contoso.com/api/calls",
"acceptedModalities": [ "audio" ],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": [
{
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "1D6DE2D4-CD51-4309-8DAA-70768651088E"
},
{
"uri": "https://cdn.contoso.com/cool.wav",
"resourceId": "1D6DE2D4-CD51-4309-8DAA-70768651088F"
}
]
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.Calls.Item.Answer;
using Microsoft.Graph.Models;
var requestBody = new AnswerPostRequestBody
{
CallbackUri = "https://bot.contoso.com/api/calls",
AcceptedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new ServiceHostedMediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
PreFetchMedia = new List<MediaInfo>
{
new MediaInfo
{
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "1D6DE2D4-CD51-4309-8DAA-70768651088E",
},
new MediaInfo
{
Uri = "https://cdn.contoso.com/cool.wav",
ResourceId = "1D6DE2D4-CD51-4309-8DAA-70768651088F",
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Communications.Calls["{call-id}"].Answer.PostAsync(requestBody);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphcommunications.NewAnswerPostRequestBody()
callbackUri := "https://bot.contoso.com/api/calls"
requestBody.SetCallbackUri(&callbackUri)
acceptedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetAcceptedModalities(acceptedModalities)
mediaConfig := graphmodels.NewServiceHostedMediaConfig()
mediaInfo := graphmodels.NewMediaInfo()
uri := "https://cdn.contoso.com/beep.wav"
mediaInfo.SetUri(&uri)
resourceId := "1D6DE2D4-CD51-4309-8DAA-70768651088E"
mediaInfo.SetResourceId(&resourceId)
mediaInfo1 := graphmodels.NewMediaInfo()
uri := "https://cdn.contoso.com/cool.wav"
mediaInfo1.SetUri(&uri)
resourceId := "1D6DE2D4-CD51-4309-8DAA-70768651088F"
mediaInfo1.SetResourceId(&resourceId)
preFetchMedia := []graphmodels.MediaInfoable {
mediaInfo,
mediaInfo1,
}
mediaConfig.SetPreFetchMedia(preFetchMedia)
requestBody.SetMediaConfig(mediaConfig)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Communications().Calls().ByCallId("call-id").Answer().Post(context.Background(), requestBody, nil)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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.answer.AnswerPostRequestBody answerPostRequestBody = new com.microsoft.graph.communications.calls.item.answer.AnswerPostRequestBody();
answerPostRequestBody.setCallbackUri("https://bot.contoso.com/api/calls");
LinkedList<Modality> acceptedModalities = new LinkedList<Modality>();
acceptedModalities.add(Modality.Audio);
answerPostRequestBody.setAcceptedModalities(acceptedModalities);
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.serviceHostedMediaConfig");
LinkedList<MediaInfo> preFetchMedia = new LinkedList<MediaInfo>();
MediaInfo mediaInfo = new MediaInfo();
mediaInfo.setUri("https://cdn.contoso.com/beep.wav");
mediaInfo.setResourceId("1D6DE2D4-CD51-4309-8DAA-70768651088E");
preFetchMedia.add(mediaInfo);
MediaInfo mediaInfo1 = new MediaInfo();
mediaInfo1.setUri("https://cdn.contoso.com/cool.wav");
mediaInfo1.setResourceId("1D6DE2D4-CD51-4309-8DAA-70768651088F");
preFetchMedia.add(mediaInfo1);
mediaConfig.setPreFetchMedia(preFetchMedia);
answerPostRequestBody.setMediaConfig(mediaConfig);
graphClient.communications().calls().byCallId("{call-id}").answer().post(answerPostRequestBody);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
const options = {
authProvider,
};
const client = Client.init(options);
const answer = {
callbackUri: 'https://bot.contoso.com/api/calls',
acceptedModalities: [ 'audio' ],
mediaConfig: {
'@odata.type': '#microsoft.graph.serviceHostedMediaConfig',
preFetchMedia: [
{
uri: 'https://cdn.contoso.com/beep.wav',
resourceId: '1D6DE2D4-CD51-4309-8DAA-70768651088E'
},
{
uri: 'https://cdn.contoso.com/cool.wav',
resourceId: '1D6DE2D4-CD51-4309-8DAA-70768651088F'
}
]
}
};
await client.api('/communications/calls/57DAB8B1894C409AB240BD8BEAE78896/answer')
.post(answer);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\Calls\Item\Answer\AnswerPostRequestBody;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\ServiceHostedMediaConfig;
use Microsoft\Graph\Generated\Models\MediaInfo;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AnswerPostRequestBody();
$requestBody->setCallbackUri('https://bot.contoso.com/api/calls');
$requestBody->setAcceptedModalities([new Modality('audio'), ]);
$mediaConfig = new ServiceHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.serviceHostedMediaConfig');
$preFetchMediaMediaInfo1 = new MediaInfo();
$preFetchMediaMediaInfo1->setUri('https://cdn.contoso.com/beep.wav');
$preFetchMediaMediaInfo1->setResourceId('1D6DE2D4-CD51-4309-8DAA-70768651088E');
$preFetchMediaArray []= $preFetchMediaMediaInfo1;
$preFetchMediaMediaInfo2 = new MediaInfo();
$preFetchMediaMediaInfo2->setUri('https://cdn.contoso.com/cool.wav');
$preFetchMediaMediaInfo2->setResourceId('1D6DE2D4-CD51-4309-8DAA-70768651088F');
$preFetchMediaArray []= $preFetchMediaMediaInfo2;
$mediaConfig->setPreFetchMedia($preFetchMediaArray);
$requestBody->setMediaConfig($mediaConfig);
$graphServiceClient->communications()->calls()->byCallId('call-id')->answer()->post($requestBody)->wait();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
callbackUri = "https://bot.contoso.com/api/calls"
acceptedModalities = @(
"audio"
)
mediaConfig = @{
"@odata.type" = "#microsoft.graph.serviceHostedMediaConfig"
preFetchMedia = @(
@{
uri = "https://cdn.contoso.com/beep.wav"
resourceId = "1D6DE2D4-CD51-4309-8DAA-70768651088E"
}
@{
uri = "https://cdn.contoso.com/cool.wav"
resourceId = "1D6DE2D4-CD51-4309-8DAA-70768651088F"
}
)
}
}
Invoke-MgAnswerCommunicationCall -CallId $callId -BodyParameter $params
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.calls.item.answer.answer_post_request_body import AnswerPostRequestBody
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.service_hosted_media_config import ServiceHostedMediaConfig
from msgraph.generated.models.media_info import MediaInfo
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AnswerPostRequestBody(
callback_uri = "https://bot.contoso.com/api/calls",
accepted_modalities = [
Modality.Audio,
],
media_config = ServiceHostedMediaConfig(
odata_type = "#microsoft.graph.serviceHostedMediaConfig",
pre_fetch_media = [
MediaInfo(
uri = "https://cdn.contoso.com/beep.wav",
resource_id = "1D6DE2D4-CD51-4309-8DAA-70768651088E",
),
MediaInfo(
uri = "https://cdn.contoso.com/cool.wav",
resource_id = "1D6DE2D4-CD51-4309-8DAA-70768651088F",
),
],
),
)
await graph_client.communications.calls.by_call_id('call-id').answer.post(request_body)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Antwort
HTTP/1.1 202 Accepted
Benachrichtigung – Einrichtung
POST https://bot.contoso.com/api/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resourceUrl": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"@odata.id": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"@odata.etag": "W/\"5445\"",
"state": "establishing"
}
}
]
}
Hinweis: Anrufaufbau-/eingerichtete Benachrichtigungen können nicht in der richtigen Reihenfolge eintreffen.
Benachrichtigung – eingerichtet
POST https://bot.contoso.com/api/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resourceUrl": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"@odata.id": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"@odata.etag": "W/\"5445\"",
"state": "established"
}
}
]
}
Hinweis: Anrufaufbau-/eingerichtete Benachrichtigungen können nicht in der richtigen Reihenfolge eintreffen.
Benachrichtigung – eingehend
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/57DAB8B1894C409AB240BD8BEAE78896",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"@odata.id": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"@odata.etag": "W/\"5445\"",
"state": "incoming",
"direction": "incoming",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"user": {
"displayName": "Test User",
"id": "8A34A46B-3D17-4ADC-8DCE-DC4E7D572698"
}
},
"region": "westus",
"languageId": "en-US"
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"application": {
"displayName": "Test BOT",
"id": "8A34A46B-3D17-4ADC-8DCE-DC4E7D572698"
}
}
}
],
"requestedModalities": [ "audio" ]
}
}
]
}
Anforderung
POST https://graph.microsoft.com/v1.0/communications/calls/57DAB8B1894C409AB240BD8BEAE78896/answer
Content-Type: application/json
{
"callbackUri": "https://bot.contoso.com/api/calls",
"acceptedModalities": [ "audio" ],
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
"blob": "<Media Session Configuration Blob>"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.Calls.Item.Answer;
using Microsoft.Graph.Models;
var requestBody = new AnswerPostRequestBody
{
CallbackUri = "https://bot.contoso.com/api/calls",
AcceptedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new AppHostedMediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
Blob = "<Media Session Configuration Blob>",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Communications.Calls["{call-id}"].Answer.PostAsync(requestBody);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphcommunications.NewAnswerPostRequestBody()
callbackUri := "https://bot.contoso.com/api/calls"
requestBody.SetCallbackUri(&callbackUri)
acceptedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetAcceptedModalities(acceptedModalities)
mediaConfig := graphmodels.NewAppHostedMediaConfig()
blob := "<Media Session Configuration Blob>"
mediaConfig.SetBlob(&blob)
requestBody.SetMediaConfig(mediaConfig)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Communications().Calls().ByCallId("call-id").Answer().Post(context.Background(), requestBody, nil)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
// 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.answer.AnswerPostRequestBody answerPostRequestBody = new com.microsoft.graph.communications.calls.item.answer.AnswerPostRequestBody();
answerPostRequestBody.setCallbackUri("https://bot.contoso.com/api/calls");
LinkedList<Modality> acceptedModalities = new LinkedList<Modality>();
acceptedModalities.add(Modality.Audio);
answerPostRequestBody.setAcceptedModalities(acceptedModalities);
AppHostedMediaConfig mediaConfig = new AppHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.appHostedMediaConfig");
mediaConfig.setBlob("<Media Session Configuration Blob>");
answerPostRequestBody.setMediaConfig(mediaConfig);
graphClient.communications().calls().byCallId("{call-id}").answer().post(answerPostRequestBody);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
const options = {
authProvider,
};
const client = Client.init(options);
const answer = {
callbackUri: 'https://bot.contoso.com/api/calls',
acceptedModalities: [ 'audio' ],
mediaConfig: {
'@odata.type': '#microsoft.graph.appHostedMediaConfig',
blob: '<Media Session Configuration Blob>'
}
};
await client.api('/communications/calls/57DAB8B1894C409AB240BD8BEAE78896/answer')
.post(answer);
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\Calls\Item\Answer\AnswerPostRequestBody;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\AppHostedMediaConfig;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new AnswerPostRequestBody();
$requestBody->setCallbackUri('https://bot.contoso.com/api/calls');
$requestBody->setAcceptedModalities([new Modality('audio'), ]);
$mediaConfig = new AppHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.appHostedMediaConfig');
$mediaConfig->setBlob('<Media Session Configuration Blob>');
$requestBody->setMediaConfig($mediaConfig);
$graphServiceClient->communications()->calls()->byCallId('call-id')->answer()->post($requestBody)->wait();
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
callbackUri = "https://bot.contoso.com/api/calls"
acceptedModalities = @(
"audio"
)
mediaConfig = @{
"@odata.type" = "#microsoft.graph.appHostedMediaConfig"
blob = "<Media Session Configuration Blob>"
}
}
Invoke-MgAnswerCommunicationCall -CallId $callId -BodyParameter $params
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.calls.item.answer.answer_post_request_body import AnswerPostRequestBody
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.app_hosted_media_config import AppHostedMediaConfig
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = AnswerPostRequestBody(
callback_uri = "https://bot.contoso.com/api/calls",
accepted_modalities = [
Modality.Audio,
],
media_config = AppHostedMediaConfig(
odata_type = "#microsoft.graph.appHostedMediaConfig",
blob = "<Media Session Configuration Blob>",
),
)
await graph_client.communications.calls.by_call_id('call-id').answer.post(request_body)
Einzelheiten darüber, wie Sie das SDK zu Ihrem Projekt hinzufügen und eine authProvider-Instanz erstellen, finden Sie in der SDK-Dokumentation.
Antwort
HTTP/1.1 202 Accepted
Benachrichtigung – Einrichtung
POST https://bot.contoso.com/api/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resourceUrl": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"@odata.id": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"@odata.etag": "W/\"5445\"",
"state": "establishing"
}
}
]
}
Hinweis: Anrufaufbau-/eingerichtete Benachrichtigungen können nicht in der richtigen Reihenfolge eintreffen.
Benachrichtigung – eingerichtet
POST https://bot.contoso.com/api/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resourceUrl": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"@odata.id": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896",
"@odata.etag": "W/\"5445\"",
"state": "established"
}
}
]
}
Hinweis: Anrufaufbau-/eingerichtete Benachrichtigungen können nicht in der richtigen Reihenfolge eintreffen.
Benachrichtigung – Inhaltsfreigabe gestartet
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/421f4c00-4436-4c3a-9d9a-c4924cf98e67/contentsharingsessions/2765eb15-01f8-47c6-b12b-c32111a4a86f"
}
]
}
Benachrichtigung – Inhaltsfreigabe beendet
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/421f4c00-4436-4c3a-9d9a-c4924cf98e67/contentsharingsessions/2765eb15-01f8-47c6-b12b-c32111a4a86f"
}
]
}
Beispiel 3: Annehmen eines richtlinienbasierten Aufzeichnungsanrufs
Im Szenario der richtlinienbasierten Aufzeichnung wird eine Benachrichtigung über eingehende Anrufe an den Bot gesendet, der der Richtlinie zugeordnet ist, bevor ein Teilnehmer unter Richtlinie einem Anruf beitritt.
Die Verknüpfungsinformationen finden Sie unter der botData-Eigenschaft . Der Bot kann dann den Anruf annehmen und den Aufzeichnungsstatus entsprechend aktualisieren .
Wenn participantCapacity in der Answer Anforderung für eine richtlinienbasierte Aufzeichnungsbenachrichtigung angegeben ist, werden nachfolgende Teilnehmerbeitrittsereignisse, die zur gleichen Richtliniengruppe gehören, als participantJoiningNotification anstelle einer Benachrichtigung über neue eingehende Anrufe gesendet, bis die Anzahl der Teilnehmer, die von der aktuellen Aufrufinstanz verarbeitet werden, die in angegebene participantCapacityAnzahl erreicht hat.
Im Folgenden finden Sie ein Beispiel für die Benachrichtigung über eingehende Anrufe, die ein Bot in diesem Fall erhalten würde.
{
"@odata.type":"#microsoft.graph.commsNotifications",
"value":[
{
"@odata.type":"#microsoft.graph.commsNotification",
"changeType":"created",
"resource":"/app/calls/e71f0300-9c1f-4d99-b5f4-2722e877d497",
"resourceUrl":"/communications/calls/e71f0300-9c1f-4d99-b5f4-2722e877d497",
"resourceData":{
"@odata.type":"#microsoft.graph.call",
"state":"incoming",
"direction":"incoming",
"source":{
"@odata.type":"#microsoft.graph.participantInfo",
"id":"90fad2ce-8989-41a1-8a66-f6636e629a2a",
"identity":{
"@odata.type":"#microsoft.graph.identitySet",
"user":{
"@odata.type":"#microsoft.graph.identity",
"id":"8A34A46B-3D17-4ADC-8DCE-DC4E7D572698",
"identityProvider":"AAD"
}
},
"endpointType":"default",
"region":"amer"
},
"targets":[
{
"@odata.type":"#microsoft.graph.invitationParticipantInfo",
"identity":{
"@odata.type":"#microsoft.graph.identitySet",
"applicationInstance":{
"@odata.type":"#microsoft.graph.identity",
"id":"832899f8-2ea1-4604-8413-27bd2892079f",
"identityProvider":"AAD"
}
},
"endpointType":"default",
"id":"4520a1a5-5394-5a41-aa12-9ee6fa18cfc8",
"region":null,
"languageId":null
}
],
"meetingInfo":{
"@odata.type":"#microsoft.graph.tokenMeetingInfo",
"token":"join token"
},
"tenantId":"932899f8-2ea1-4604-8413-27bd2892079f",
"myParticipantId":"1520a1a5-5394-4a41-aa72-9ee6fa18cfc8",
"callChainId":"05f2f70f-3a9c-47c1-80a9-cc79e91d8cec",
"incomingContext":{
"@odata.type":"#microsoft.graph.incomingContext",
"sourceParticipantId":"30fad2ce-8989-41a1-8a66-f6636e629a2a",
"observedParticipantId":"30fad2ce-8989-41a1-8a66-f6636e629a2a"
},
"id":"e71f0300-9c1f-4d99-b5f4-2722e877d497",
"applicationMetadata":{
"botData":{
"mediaHostedRegion":"USEA",
"user":{
"participationMethod":"callee",
"clientLocation":"US"
},
"otherSideUser":{
"id":"971f0300-9c1f-4d99-b5f4-2722e877d490",
"participantId":"3520a1a5-5394-4a41-aa72-9ee6fa18cfc8",
"tenantId":"1540a1a5-2394-4a41-aa72-9ee6fa18cfc8",
"onBehalfOf":{
"id":"871f0300-9c1f-4d99-b5f4-2722e877d490"
},
"participationMethod":"caller",
"clientLocation":"EUNO"
},
"inviteReasons":[
"PolicyBasedRecording"
],
"policyIdentifier":"Test Policy",
"pairedRecorders":[
{
"id":"471f0300-5c1f-4d99-b5f4-2722e877d490",
"participantId":"371f0300-2c1f-4d99-b5f4-2722e877d490"
}
],
"otherRecorders":[
{
"id":"671f0300-9c1f-4d99-b5f4-2722e877d490",
"participantId":"a71f0300-ec1f-4d99-b5f4-2722e877d490"
}
]
}
}
}
}
]
}