// 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,
AdditionalData = new Dictionary<string, object>
{
{
"isDeltaRosterEnabled" , 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);
// 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);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("isDeltaRosterEnabled", true);
callOptions.setAdditionalData(additionalData);
answerPostRequestBody.setCallOptions(callOptions);
answerPostRequestBody.setParticipantCapacity(200);
graphClient.communications().calls().byCallId("{call-id}").answer().post(answerPostRequestBody);
// 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);
// 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);
<?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();
# 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)
// 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);
// 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);
<?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();
# 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)