APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Create call enables your bot to create a new outgoing peer-to-peer or group call, or join an existing meeting. You will need to register the calling bot and go through the list of permissions needed.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Notes: For a call with app-hosted media, you need the Calls.AccessMedia.All or the Calls.AccessMedia.Chat* permission in addition to one of the permissions listed.
Note: The /app path is deprecated. Going forward, use the /communications path.
Request headers
Name
Description
Authorization
Bearer {token}. Required.
Content-type
application/json. Required.
Request body
In the request body, supply a JSON representation of a call object.
Response
If successful, this method returns a 201 Created response code and a call object in the response body.
Examples
Example 1: Create peer-to-peer VoIP call with service hosted media
Note: This call needs the Calls.Initiate.All permission.
Request
The following example shows a request that makes a peer-to-peer call between the bot and the specified user. In this example, the media is hosted by the service. The values of authorization token, callback URL, application ID, application name, user ID, user name, and tenant ID must be replaced with actual values to make the example work.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
Targets = new List<InvitationParticipantInfo>
{
new InvitationParticipantInfo
{
OdataType = "#microsoft.graph.invitationParticipantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
DisplayName = "John",
Id = "112f7296-5fa4-42ca-bae8-6a692b15d4b8",
},
},
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
CallOptions = new CallOptions
{
OdataType = "#microsoft.graph.outgoingCallOptions",
IsContentSharingNotificationEnabled = true,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
},
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Call call = new Call();
call.callbackUri = "https://bot.contoso.com/callback";
LinkedList<InvitationParticipantInfo> targetsList = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo targets = new InvitationParticipantInfo();
IdentitySet identity = new IdentitySet();
Identity user = new Identity();
user.displayName = "John";
user.id = "112f7296-5fa4-42ca-bae8-6a692b15d4b8";
identity.user = user;
targets.identity = identity;
targetsList.add(targets);
call.targets = targetsList;
LinkedList<Modality> requestedModalitiesList = new LinkedList<Modality>();
requestedModalitiesList.add(Modality.AUDIO);
call.requestedModalities = requestedModalitiesList;
OutgoingCallOptions callOptions = new OutgoingCallOptions();
callOptions.isContentSharingNotificationEnabled = true;
call.callOptions = callOptions;
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
call.mediaConfig = mediaConfig;
graphClient.communications().calls()
.buildRequest()
.post(call);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$targetsInvitationParticipantInfo1 = new InvitationParticipantInfo();
$targetsInvitationParticipantInfo1->set@odatatype('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->set@odatatype('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo1IdentityUser = new Identity();
$targetsInvitationParticipantInfo1IdentityUser->set@odatatype('#microsoft.graph.identity');
$targetsInvitationParticipantInfo1IdentityUser->setDisplayName('John');
$targetsInvitationParticipantInfo1IdentityUser->setId('112f7296-5fa4-42ca-bae8-6a692b15d4b8');
$targetsInvitationParticipantInfo1Identity->setUser($targetsInvitationParticipantInfo1IdentityUser);
$targetsInvitationParticipantInfo1->setIdentity($targetsInvitationParticipantInfo1Identity);
$targetsArray []= $targetsInvitationParticipantInfo1;
$requestBody->setTargets($targetsArray);
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$callOptions = new CallOptions();
$callOptions->set@odatatype('#microsoft.graph.outgoingCallOptions');
$callOptions->setIsContentSharingNotificationEnabled(true);
$requestBody->setCallOptions($callOptions);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.serviceHostedMediaConfig');
$requestBody->setMediaConfig($mediaConfig);
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Example 2: Create peer-to-peer VoIP call with application hosted media
Note: This example needs Calls.Initiate.All and Calls.AccessMedia.All permissions.
Request
The following example shows a request that makes a peer-to-peer call between the bot and the specified user. In this example, the media is hosted locally by the application. The values of authorization token, callback URL, application ID, application name, user ID, user name, and tenant ID must be replaced with actual values to make the example work.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
Source = new ParticipantInfo
{
OdataType = "#microsoft.graph.participantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
Application = new Identity
{
OdataType = "#microsoft.graph.identity",
DisplayName = "Calling Bot",
Id = "2891555a-92ff-42e6-80fa-6e1300c6b5c6",
},
},
Region = null,
LanguageId = null,
},
Targets = new List<InvitationParticipantInfo>
{
new InvitationParticipantInfo
{
OdataType = "#microsoft.graph.invitationParticipantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
DisplayName = "John",
Id = "112f7296-5fa4-42ca-bae8-6a692b15d4b8",
},
},
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"blob" , "<Media Session Configuration>"
},
},
},
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$source = new ParticipantInfo();
$source->set@odatatype('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->set@odatatype('#microsoft.graph.identitySet');
$sourceIdentityApplication = new Identity();
$sourceIdentityApplication->set@odatatype('#microsoft.graph.identity');
$sourceIdentityApplication->setDisplayName('Calling Bot');
$sourceIdentityApplication->setId('2891555a-92ff-42e6-80fa-6e1300c6b5c6');
$sourceIdentity->setApplication($sourceIdentityApplication);
$source->setIdentity($sourceIdentity);
$Source->setRegion(null);
$Source->setLanguageId(null);
$requestBody->setSource($source);
$targetsInvitationParticipantInfo1 = new InvitationParticipantInfo();
$targetsInvitationParticipantInfo1->set@odatatype('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->set@odatatype('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo1IdentityUser = new Identity();
$targetsInvitationParticipantInfo1IdentityUser->set@odatatype('#microsoft.graph.identity');
$targetsInvitationParticipantInfo1IdentityUser->setDisplayName('John');
$targetsInvitationParticipantInfo1IdentityUser->setId('112f7296-5fa4-42ca-bae8-6a692b15d4b8');
$targetsInvitationParticipantInfo1Identity->setUser($targetsInvitationParticipantInfo1IdentityUser);
$targetsInvitationParticipantInfo1->setIdentity($targetsInvitationParticipantInfo1Identity);
$targetsArray []= $targetsInvitationParticipantInfo1;
$requestBody->setTargets($targetsArray);
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.appHostedMediaConfig');
$additionalData = [
'blob' => '<Media Session Configuration>',
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<Media Session Configuration> is the serialized media session configuration which contains the session information of the media stack. Specific information about audio, video, VBSS session information should be passed here.
The following is an example of an audio media session blob.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
Direction = CallDirection.Outgoing,
Subject = "Create a group call with service hosted media",
CallbackUri = "https://bot.contoso.com/callback",
Source = new ParticipantInfo
{
OdataType = "#microsoft.graph.participantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
Application = new Identity
{
OdataType = "#microsoft.graph.identity",
DisplayName = "TestBot",
Id = "dd3885da-f9ab-486b-bfae-85de3d445555",
},
},
},
Targets = new List<InvitationParticipantInfo>
{
new InvitationParticipantInfo
{
OdataType = "#microsoft.graph.invitationParticipantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
DisplayName = "user1",
Id = "98da8a1a-1b87-452c-a713-65d3f10b5555",
},
},
},
new InvitationParticipantInfo
{
OdataType = "#microsoft.graph.participantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
DisplayName = "user2",
Id = "bf5aae9a-d11d-47a8-93b1-782504c95555",
},
},
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
RemoveFromDefaultAudioGroup = false,
},
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Call call = new Call();
call.direction = CallDirection.OUTGOING;
call.subject = "Create a group call with service hosted media";
call.callbackUri = "https://bot.contoso.com/callback";
ParticipantInfo source = new ParticipantInfo();
IdentitySet identity = new IdentitySet();
Identity application = new Identity();
application.displayName = "TestBot";
application.id = "dd3885da-f9ab-486b-bfae-85de3d445555";
identity.application = application;
source.identity = identity;
call.source = source;
LinkedList<InvitationParticipantInfo> targetsList = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo targets = new InvitationParticipantInfo();
IdentitySet identity1 = new IdentitySet();
Identity user = new Identity();
user.displayName = "user1";
user.id = "98da8a1a-1b87-452c-a713-65d3f10b5555";
identity1.user = user;
targets.identity = identity1;
targetsList.add(targets);
ParticipantInfo targets1 = new ParticipantInfo();
IdentitySet identity2 = new IdentitySet();
Identity user1 = new Identity();
user1.displayName = "user2";
user1.id = "bf5aae9a-d11d-47a8-93b1-782504c95555";
identity2.user = user1;
targets1.identity = identity2;
targetsList.add(targets1);
call.targets = targetsList;
LinkedList<Modality> requestedModalitiesList = new LinkedList<Modality>();
requestedModalitiesList.add(Modality.AUDIO);
call.requestedModalities = requestedModalitiesList;
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
mediaConfig.removeFromDefaultAudioGroup = false;
call.mediaConfig = mediaConfig;
call.tenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a";
graphClient.communications().calls()
.buildRequest()
.post(call);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewCall()
direction := graphmodels.OUTGOING_CALLDIRECTION
requestBody.SetDirection(&direction)
subject := "Create a group call with service hosted media"
requestBody.SetSubject(&subject)
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
source := graphmodels.NewParticipantInfo()
identity := graphmodels.NewIdentitySet()
application := graphmodels.NewIdentity()
displayName := "TestBot"
application.SetDisplayName(&displayName)
id := "dd3885da-f9ab-486b-bfae-85de3d445555"
application.SetId(&id)
identity.SetApplication(application)
source.SetIdentity(identity)
requestBody.SetSource(source)
invitationParticipantInfo := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
displayName := "user1"
user.SetDisplayName(&displayName)
id := "98da8a1a-1b87-452c-a713-65d3f10b5555"
user.SetId(&id)
identity.SetUser(user)
invitationParticipantInfo.SetIdentity(identity)
invitationParticipantInfo1 := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
displayName := "user2"
user.SetDisplayName(&displayName)
id := "bf5aae9a-d11d-47a8-93b1-782504c95555"
user.SetId(&id)
identity.SetUser(user)
invitationParticipantInfo1.SetIdentity(identity)
targets := []graphmodels.InvitationParticipantInfoable {
invitationParticipantInfo,
invitationParticipantInfo1,
}
requestBody.SetTargets(targets)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
mediaConfig := graphmodels.NewMediaConfig()
removeFromDefaultAudioGroup := false
mediaConfig.SetRemoveFromDefaultAudioGroup(&removeFromDefaultAudioGroup)
requestBody.SetMediaConfig(mediaConfig)
tenantId := "aa67bd4c-8475-432d-bd41-39f255720e0a"
requestBody.SetTenantId(&tenantId)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setDirection(new CallDirection('outgoing'));
$requestBody->setSubject('Create a group call with service hosted media');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$source = new ParticipantInfo();
$source->set@odatatype('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->set@odatatype('#microsoft.graph.identitySet');
$sourceIdentityApplication = new Identity();
$sourceIdentityApplication->set@odatatype('#microsoft.graph.identity');
$sourceIdentityApplication->setDisplayName('TestBot');
$sourceIdentityApplication->setId('dd3885da-f9ab-486b-bfae-85de3d445555');
$sourceIdentity->setApplication($sourceIdentityApplication);
$source->setIdentity($sourceIdentity);
$requestBody->setSource($source);
$targetsInvitationParticipantInfo1 = new InvitationParticipantInfo();
$targetsInvitationParticipantInfo1->set@odatatype('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->set@odatatype('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo1IdentityUser = new Identity();
$targetsInvitationParticipantInfo1IdentityUser->set@odatatype('#microsoft.graph.identity');
$targetsInvitationParticipantInfo1IdentityUser->setDisplayName('user1');
$targetsInvitationParticipantInfo1IdentityUser->setId('98da8a1a-1b87-452c-a713-65d3f10b5555');
$targetsInvitationParticipantInfo1Identity->setUser($targetsInvitationParticipantInfo1IdentityUser);
$targetsInvitationParticipantInfo1->setIdentity($targetsInvitationParticipantInfo1Identity);
$targetsArray []= $targetsInvitationParticipantInfo1;
$targetsInvitationParticipantInfo2 = new InvitationParticipantInfo();
$targetsInvitationParticipantInfo2->set@odatatype('#microsoft.graph.participantInfo');
$targetsInvitationParticipantInfo2Identity = new IdentitySet();
$targetsInvitationParticipantInfo2Identity->set@odatatype('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo2IdentityUser = new Identity();
$targetsInvitationParticipantInfo2IdentityUser->set@odatatype('#microsoft.graph.identity');
$targetsInvitationParticipantInfo2IdentityUser->setDisplayName('user2');
$targetsInvitationParticipantInfo2IdentityUser->setId('bf5aae9a-d11d-47a8-93b1-782504c95555');
$targetsInvitationParticipantInfo2Identity->setUser($targetsInvitationParticipantInfo2IdentityUser);
$targetsInvitationParticipantInfo2->setIdentity($targetsInvitationParticipantInfo2Identity);
$targetsArray []= $targetsInvitationParticipantInfo2;
$requestBody->setTargets($targetsArray);
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.serviceHostedMediaConfig');
$mediaConfig->setRemoveFromDefaultAudioGroup(false);
$requestBody->setMediaConfig($mediaConfig);
$requestBody->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
Direction = CallDirection.Outgoing,
Subject = "Create a group call with app hosted media",
CallbackUri = "https://bot.contoso.com/callback",
Source = new ParticipantInfo
{
OdataType = "#microsoft.graph.participantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
Application = new Identity
{
OdataType = "#microsoft.graph.identity",
DisplayName = "TestBot",
Id = "dd3885da-f9ab-486b-bfae-85de3d445555",
},
},
},
Targets = new List<InvitationParticipantInfo>
{
new InvitationParticipantInfo
{
OdataType = "#microsoft.graph.invitationParticipantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
DisplayName = "user1",
Id = "98da8a1a-1b87-452c-a713-65d3f10b5555",
},
},
},
new InvitationParticipantInfo
{
OdataType = "#microsoft.graph.participantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
DisplayName = "user2",
Id = "bf5aae9a-d11d-47a8-93b1-782504c95555",
},
},
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
RemoveFromDefaultAudioGroup = false,
AdditionalData = new Dictionary<string, object>
{
{
"blob" , "<Media Session Configuration>"
},
},
},
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Call call = new Call();
call.direction = CallDirection.OUTGOING;
call.subject = "Create a group call with app hosted media";
call.callbackUri = "https://bot.contoso.com/callback";
ParticipantInfo source = new ParticipantInfo();
IdentitySet identity = new IdentitySet();
Identity application = new Identity();
application.displayName = "TestBot";
application.id = "dd3885da-f9ab-486b-bfae-85de3d445555";
identity.application = application;
source.identity = identity;
call.source = source;
LinkedList<InvitationParticipantInfo> targetsList = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo targets = new InvitationParticipantInfo();
IdentitySet identity1 = new IdentitySet();
Identity user = new Identity();
user.displayName = "user1";
user.id = "98da8a1a-1b87-452c-a713-65d3f10b5555";
identity1.user = user;
targets.identity = identity1;
targetsList.add(targets);
ParticipantInfo targets1 = new ParticipantInfo();
IdentitySet identity2 = new IdentitySet();
Identity user1 = new Identity();
user1.displayName = "user2";
user1.id = "bf5aae9a-d11d-47a8-93b1-782504c95555";
identity2.user = user1;
targets1.identity = identity2;
targetsList.add(targets1);
call.targets = targetsList;
LinkedList<Modality> requestedModalitiesList = new LinkedList<Modality>();
requestedModalitiesList.add(Modality.AUDIO);
call.requestedModalities = requestedModalitiesList;
AppHostedMediaConfig mediaConfig = new AppHostedMediaConfig();
mediaConfig.blob = "<Media Session Configuration>";
mediaConfig.removeFromDefaultAudioGroup = false;
call.mediaConfig = mediaConfig;
call.tenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a";
graphClient.communications().calls()
.buildRequest()
.post(call);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewCall()
direction := graphmodels.OUTGOING_CALLDIRECTION
requestBody.SetDirection(&direction)
subject := "Create a group call with app hosted media"
requestBody.SetSubject(&subject)
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
source := graphmodels.NewParticipantInfo()
identity := graphmodels.NewIdentitySet()
application := graphmodels.NewIdentity()
displayName := "TestBot"
application.SetDisplayName(&displayName)
id := "dd3885da-f9ab-486b-bfae-85de3d445555"
application.SetId(&id)
identity.SetApplication(application)
source.SetIdentity(identity)
requestBody.SetSource(source)
invitationParticipantInfo := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
displayName := "user1"
user.SetDisplayName(&displayName)
id := "98da8a1a-1b87-452c-a713-65d3f10b5555"
user.SetId(&id)
identity.SetUser(user)
invitationParticipantInfo.SetIdentity(identity)
invitationParticipantInfo1 := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
displayName := "user2"
user.SetDisplayName(&displayName)
id := "bf5aae9a-d11d-47a8-93b1-782504c95555"
user.SetId(&id)
identity.SetUser(user)
invitationParticipantInfo1.SetIdentity(identity)
targets := []graphmodels.InvitationParticipantInfoable {
invitationParticipantInfo,
invitationParticipantInfo1,
}
requestBody.SetTargets(targets)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
mediaConfig := graphmodels.NewMediaConfig()
removeFromDefaultAudioGroup := false
mediaConfig.SetRemoveFromDefaultAudioGroup(&removeFromDefaultAudioGroup)
additionalData := map[string]interface{}{
"blob" : "<Media Session Configuration>",
}
mediaConfig.SetAdditionalData(additionalData)
requestBody.SetMediaConfig(mediaConfig)
tenantId := "aa67bd4c-8475-432d-bd41-39f255720e0a"
requestBody.SetTenantId(&tenantId)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setDirection(new CallDirection('outgoing'));
$requestBody->setSubject('Create a group call with app hosted media');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$source = new ParticipantInfo();
$source->set@odatatype('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->set@odatatype('#microsoft.graph.identitySet');
$sourceIdentityApplication = new Identity();
$sourceIdentityApplication->set@odatatype('#microsoft.graph.identity');
$sourceIdentityApplication->setDisplayName('TestBot');
$sourceIdentityApplication->setId('dd3885da-f9ab-486b-bfae-85de3d445555');
$sourceIdentity->setApplication($sourceIdentityApplication);
$source->setIdentity($sourceIdentity);
$requestBody->setSource($source);
$targetsInvitationParticipantInfo1 = new InvitationParticipantInfo();
$targetsInvitationParticipantInfo1->set@odatatype('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->set@odatatype('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo1IdentityUser = new Identity();
$targetsInvitationParticipantInfo1IdentityUser->set@odatatype('#microsoft.graph.identity');
$targetsInvitationParticipantInfo1IdentityUser->setDisplayName('user1');
$targetsInvitationParticipantInfo1IdentityUser->setId('98da8a1a-1b87-452c-a713-65d3f10b5555');
$targetsInvitationParticipantInfo1Identity->setUser($targetsInvitationParticipantInfo1IdentityUser);
$targetsInvitationParticipantInfo1->setIdentity($targetsInvitationParticipantInfo1Identity);
$targetsArray []= $targetsInvitationParticipantInfo1;
$targetsInvitationParticipantInfo2 = new InvitationParticipantInfo();
$targetsInvitationParticipantInfo2->set@odatatype('#microsoft.graph.participantInfo');
$targetsInvitationParticipantInfo2Identity = new IdentitySet();
$targetsInvitationParticipantInfo2Identity->set@odatatype('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo2IdentityUser = new Identity();
$targetsInvitationParticipantInfo2IdentityUser->set@odatatype('#microsoft.graph.identity');
$targetsInvitationParticipantInfo2IdentityUser->setDisplayName('user2');
$targetsInvitationParticipantInfo2IdentityUser->setId('bf5aae9a-d11d-47a8-93b1-782504c95555');
$targetsInvitationParticipantInfo2Identity->setUser($targetsInvitationParticipantInfo2IdentityUser);
$targetsInvitationParticipantInfo2->setIdentity($targetsInvitationParticipantInfo2Identity);
$targetsArray []= $targetsInvitationParticipantInfo2;
$requestBody->setTargets($targetsArray);
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.appHostedMediaConfig');
$mediaConfig->setRemoveFromDefaultAudioGroup(false);
$additionalData = [
'blob' => '<Media Session Configuration>',
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$requestBody->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Example 5: Join scheduled meeting with service hosted media
To join the scheduled meeting we will need to get the thread ID, message ID, organizer ID and the tenant ID in which the meeting is scheduled.
This information can be obtained from the Get onlineMeeting API.
The values of authorization token, callback URL, application ID, application name, user ID, user name, and tenant ID must be replaced along with the details obtained from the Get onlineMeeting API with actual values to make the example work.
Note: This example needs the Calls.JoinGroupCalls.All permission or the Calls.JoinGroupCalls.Chatresource-specific permission.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"preFetchMedia" , new List<>
{
new
{
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "f8971b04-b53e-418c-9222-c82ce681a582",
},
new
{
Uri = "https://cdn.contoso.com/cool.wav",
ResourceId = "86dc814b-c172-4428-9112-60f8ecae1edb",
},
}
},
},
},
ChatInfo = new ChatInfo
{
OdataType = "#microsoft.graph.chatInfo",
ThreadId = "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
MessageId = "0",
},
MeetingInfo = new MeetingInfo
{
OdataType = "#microsoft.graph.organizerMeetingInfo",
AllowConversationWithoutHost = true,
AdditionalData = new Dictionary<string, object>
{
{
"organizer" , new
{
OdataType = "#microsoft.graph.identitySet",
User = new
{
OdataType = "#microsoft.graph.identity",
Id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
TenantId = "9f386a15-f9cc-445b-8106-ac85e314a07b",
DisplayName = "Bob",
},
}
},
},
},
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.serviceHostedMediaConfig');
$additionalData = [
'preFetchMedia' => $preFetchMedia1 = new ();
$ preFetchMedia1->setUri('https://cdn.contoso.com/beep.wav');
$ preFetchMedia1->setResourceId('f8971b04-b53e-418c-9222-c82ce681a582');
$preFetchMediaArray []= $preFetchMedia1;
$preFetchMedia2 = new ();
$ preFetchMedia2->setUri('https://cdn.contoso.com/cool.wav');
$ preFetchMedia2->setResourceId('86dc814b-c172-4428-9112-60f8ecae1edb');
$preFetchMediaArray []= $preFetchMedia2;
$mediaConfig->setPreFetchMedia($preFetchMediaArray);
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$chatInfo = new ChatInfo();
$chatInfo->set@odatatype('#microsoft.graph.chatInfo');
$chatInfo->setThreadId('19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2');
$chatInfo->setMessageId('0');
$requestBody->setChatInfo($chatInfo);
$meetingInfo = new MeetingInfo();
$meetingInfo->set@odatatype('#microsoft.graph.organizerMeetingInfo');
$meetingInfo->setAllowConversationWithoutHost(true);
$additionalData = [
'organizer' => $meetingInfo = new Organizer();
$meetingInfo->set@odatatype('#microsoft.graph.identitySet');
$user = new User();
$user->set@odatatype('#microsoft.graph.identity');
$user->setId('5810cede-f3cc-42eb-b2c1-e9bd5d53ec96');
$user->setTenantId('9f386a15-f9cc-445b-8106-ac85e314a07b');
$user->setDisplayName('Bob');
$meetingInfo->setUser($user);
$meetingInfo->setOrganizer($organizer);
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('86dc81db-c112-4228-9222-63f3esaa1edb');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Note: For join meeting scenarios apart from call state notifications, we receive roster notifications.
Example 6: Join a scheduled meeting with joinMeetingId and passcode
The following shows an example that requires a joinMeetingId and a passcode to join an existing meeting. You can retrieve these properties from the Get onlineMeeting API.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"preFetchMedia" , new List<>
{
new
{
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "f8971b04-b53e-418c-9222-c82ce681a582",
},
new
{
Uri = "https://cdn.contoso.com/cool.wav",
ResourceId = "86dc814b-c172-4428-9112-60f8ecae1edb",
},
}
},
},
},
MeetingInfo = new MeetingInfo
{
OdataType = "#microsoft.graph.joinMeetingIdMeetingInfo",
AdditionalData = new Dictionary<string, object>
{
{
"joinMeetingId" , "1234567"
},
{
"passcode" , "psw123"
},
},
},
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.serviceHostedMediaConfig');
$additionalData = [
'preFetchMedia' => $preFetchMedia1 = new ();
$ preFetchMedia1->setUri('https://cdn.contoso.com/beep.wav');
$ preFetchMedia1->setResourceId('f8971b04-b53e-418c-9222-c82ce681a582');
$preFetchMediaArray []= $preFetchMedia1;
$preFetchMedia2 = new ();
$ preFetchMedia2->setUri('https://cdn.contoso.com/cool.wav');
$ preFetchMedia2->setResourceId('86dc814b-c172-4428-9112-60f8ecae1edb');
$preFetchMediaArray []= $preFetchMedia2;
$mediaConfig->setPreFetchMedia($preFetchMediaArray);
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$meetingInfo = new MeetingInfo();
$meetingInfo->set@odatatype('#microsoft.graph.joinMeetingIdMeetingInfo');
$additionalData = [
'joinMeetingId' => '1234567',
'passcode' => 'psw123',
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('86dc81db-c112-4228-9222-63f3esaa1edb');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Example 7: Join a scheduled meeting with joinMeetingId
The following shows an example that requires a joinMeetingId but doesn't require a passcode to join an existing meeting. You can retrieve the joinMeetingId property from the Get onlineMeeting API.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"preFetchMedia" , new List<>
{
new
{
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "f8971b04-b53e-418c-9222-c82ce681a582",
},
new
{
Uri = "https://cdn.contoso.com/cool.wav",
ResourceId = "86dc814b-c172-4428-9112-60f8ecae1edb",
},
}
},
},
},
MeetingInfo = new MeetingInfo
{
OdataType = "#microsoft.graph.joinMeetingIdMeetingInfo",
AdditionalData = new Dictionary<string, object>
{
{
"joinMeetingId" , "1234567"
},
{
"passcode" , null
},
},
},
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.serviceHostedMediaConfig');
$additionalData = [
'preFetchMedia' => $preFetchMedia1 = new ();
$ preFetchMedia1->setUri('https://cdn.contoso.com/beep.wav');
$ preFetchMedia1->setResourceId('f8971b04-b53e-418c-9222-c82ce681a582');
$preFetchMediaArray []= $preFetchMedia1;
$preFetchMedia2 = new ();
$ preFetchMedia2->setUri('https://cdn.contoso.com/cool.wav');
$ preFetchMedia2->setResourceId('86dc814b-c172-4428-9112-60f8ecae1edb');
$preFetchMediaArray []= $preFetchMedia2;
$mediaConfig->setPreFetchMedia($preFetchMediaArray);
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$meetingInfo = new MeetingInfo();
$meetingInfo->set@odatatype('#microsoft.graph.joinMeetingIdMeetingInfo');
$additionalData = [
'joinMeetingId' => '1234567',
'passcode' => null,
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('86dc81db-c112-4228-9222-63f3esaa1edb');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
Direction = CallDirection.Outgoing,
CallbackUri = "https://bot.contoso.com/callback",
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"blob" , "<Media Session Configuration>"
},
},
},
ChatInfo = new ChatInfo
{
OdataType = "#microsoft.graph.chatInfo",
ThreadId = "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
MessageId = "0",
},
MeetingInfo = new MeetingInfo
{
OdataType = "#microsoft.graph.organizerMeetingInfo",
AllowConversationWithoutHost = true,
AdditionalData = new Dictionary<string, object>
{
{
"organizer" , new
{
OdataType = "#microsoft.graph.identitySet",
User = new
{
OdataType = "#microsoft.graph.identity",
Id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
DisplayName = "Bob",
},
}
},
},
},
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setDirection(new CallDirection('outgoing'));
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.appHostedMediaConfig');
$additionalData = [
'blob' => '<Media Session Configuration>',
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$chatInfo = new ChatInfo();
$chatInfo->set@odatatype('#microsoft.graph.chatInfo');
$chatInfo->setThreadId('19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2');
$chatInfo->setMessageId('0');
$requestBody->setChatInfo($chatInfo);
$meetingInfo = new MeetingInfo();
$meetingInfo->set@odatatype('#microsoft.graph.organizerMeetingInfo');
$meetingInfo->setAllowConversationWithoutHost(true);
$additionalData = [
'organizer' => $meetingInfo = new Organizer();
$ meetingInfo->set@odatatype('#microsoft.graph.identitySet');
$user = new User();
$ user->set@odatatype('#microsoft.graph.identity');
$ user->setId('5810cede-f3cc-42eb-b2c1-e9bd5d53ec96');
$ user->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$ user->setDisplayName('Bob');
$meetingInfo->setUser($user);
$meetingInfo->setOrganizer($organizer);
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Example 9: Join channel meeting with service hosted media
Meeting inside a channel requires specific details like thread ID, message ID, and organizer details that can be obtained using the Get onlineMeeting API.
The values of authorization token, callback URL, application ID, application name, user ID, user name, and tenant ID must be replaced along with the details obtained from the Get onlineMeeting API with actual values to make the example work.
Note: This example needs the Calls.JoinGroupCalls.All permission.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"preFetchMedia" , new List<>
{
new
{
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "f8971b04-b53e-418c-9222-c82ce681a582",
},
new
{
Uri = "https://cdn.contoso.com/cool.wav",
ResourceId = "86dc814b-c172-4428-9112-60f8ecae1edb",
},
}
},
},
},
ChatInfo = new ChatInfo
{
OdataType = "#microsoft.graph.chatInfo",
ThreadId = "19:cbee7c1c860e465f8258e3cebf7bee0d@thread.skype",
MessageId = "1533758867081",
},
MeetingInfo = new MeetingInfo
{
OdataType = "#microsoft.graph.organizerMeetingInfo",
AllowConversationWithoutHost = true,
AdditionalData = new Dictionary<string, object>
{
{
"organizer" , new
{
OdataType = "#microsoft.graph.identitySet",
User = new
{
OdataType = "#microsoft.graph.identity",
Id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
DisplayName = "Bob",
},
}
},
},
},
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.serviceHostedMediaConfig');
$additionalData = [
'preFetchMedia' => $preFetchMedia1 = new ();
$ preFetchMedia1->setUri('https://cdn.contoso.com/beep.wav');
$ preFetchMedia1->setResourceId('f8971b04-b53e-418c-9222-c82ce681a582');
$preFetchMediaArray []= $preFetchMedia1;
$preFetchMedia2 = new ();
$ preFetchMedia2->setUri('https://cdn.contoso.com/cool.wav');
$ preFetchMedia2->setResourceId('86dc814b-c172-4428-9112-60f8ecae1edb');
$preFetchMediaArray []= $preFetchMedia2;
$mediaConfig->setPreFetchMedia($preFetchMediaArray);
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$chatInfo = new ChatInfo();
$chatInfo->set@odatatype('#microsoft.graph.chatInfo');
$chatInfo->setThreadId('19:cbee7c1c860e465f8258e3cebf7bee0d@thread.skype');
$chatInfo->setMessageId('1533758867081');
$requestBody->setChatInfo($chatInfo);
$meetingInfo = new MeetingInfo();
$meetingInfo->set@odatatype('#microsoft.graph.organizerMeetingInfo');
$meetingInfo->setAllowConversationWithoutHost(true);
$additionalData = [
'organizer' => $meetingInfo = new Organizer();
$meetingInfo->set@odatatype('#microsoft.graph.identitySet');
$user = new User();
$user->set@odatatype('#microsoft.graph.identity');
$user->setId('5810cede-f3cc-42eb-b2c1-e9bd5d53ec96');
$user->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$user->setDisplayName('Bob');
$meetingInfo->setUser($user);
$meetingInfo->setOrganizer($organizer);
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Example 10: Join channel meeting as a guest with service hosted media
For joining a channel meeting as a guest you will need to create a guest identity and add it as the call source in the join meeting request.
The display name is the name you want to be displayed in the meeting for your guest identity. The ID may be a unique ID identifying the guest identity.
Note: This example needs the Calls.JoinGroupCallsAsGuest.All permission.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
Source = new ParticipantInfo
{
OdataType = "#microsoft.graph.participantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
AdditionalData = new Dictionary<string, object>
{
{
"guest" , new
{
OdataType = "#microsoft.graph.identity",
DisplayName = "Guest User",
Id = "d7a3b999-17ac-4bca-9e77-e6a730d2ec2e",
}
},
},
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"preFetchMedia" , new List<>
{
new
{
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "f8971b04-b53e-418c-9222-c82ce681a582",
},
new
{
Uri = "https://cdn.contoso.com/cool.wav",
ResourceId = "86dc814b-c172-4428-9112-60f8ecae1edb",
},
}
},
},
},
ChatInfo = new ChatInfo
{
OdataType = "#microsoft.graph.chatInfo",
ThreadId = "19:cbee7c1c860e465f8258e3cebf7bee0d@thread.skype",
MessageId = "1533758867081",
},
MeetingInfo = new MeetingInfo
{
OdataType = "#microsoft.graph.organizerMeetingInfo",
AllowConversationWithoutHost = true,
AdditionalData = new Dictionary<string, object>
{
{
"organizer" , new
{
OdataType = "#microsoft.graph.identitySet",
User = new
{
OdataType = "#microsoft.graph.identity",
Id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
DisplayName = "Bob",
},
}
},
},
},
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$source = new ParticipantInfo();
$source->set@odatatype('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->set@odatatype('#microsoft.graph.identitySet');
$additionalData = [
'guest' => $sourceIdentity = new Guest();
$ sourceIdentity->set@odatatype('#microsoft.graph.identity');
$ sourceIdentity->setDisplayName('Guest User');
$ sourceIdentity->setId('d7a3b999-17ac-4bca-9e77-e6a730d2ec2e');
$sourceIdentity->setGuest($guest);
];
$sourceIdentity->setAdditionalData($additionalData);
$source->setIdentity($sourceIdentity);
$requestBody->setSource($source);
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.serviceHostedMediaConfig');
$additionalData = [
'preFetchMedia' => $preFetchMedia1 = new ();
$ preFetchMedia1->setUri('https://cdn.contoso.com/beep.wav');
$ preFetchMedia1->setResourceId('f8971b04-b53e-418c-9222-c82ce681a582');
$preFetchMediaArray []= $preFetchMedia1;
$preFetchMedia2 = new ();
$ preFetchMedia2->setUri('https://cdn.contoso.com/cool.wav');
$ preFetchMedia2->setResourceId('86dc814b-c172-4428-9112-60f8ecae1edb');
$preFetchMediaArray []= $preFetchMedia2;
$mediaConfig->setPreFetchMedia($preFetchMediaArray);
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$chatInfo = new ChatInfo();
$chatInfo->set@odatatype('#microsoft.graph.chatInfo');
$chatInfo->setThreadId('19:cbee7c1c860e465f8258e3cebf7bee0d@thread.skype');
$chatInfo->setMessageId('1533758867081');
$requestBody->setChatInfo($chatInfo);
$meetingInfo = new MeetingInfo();
$meetingInfo->set@odatatype('#microsoft.graph.organizerMeetingInfo');
$meetingInfo->setAllowConversationWithoutHost(true);
$additionalData = [
'organizer' => $meetingInfo = new Organizer();
$meetingInfo->set@odatatype('#microsoft.graph.identitySet');
$user = new User();
$user->set@odatatype('#microsoft.graph.identity');
$user->setId('5810cede-f3cc-42eb-b2c1-e9bd5d53ec96');
$user->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$user->setDisplayName('Bob');
$meetingInfo->setUser($user);
$meetingInfo->setOrganizer($organizer);
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Note: The guest join depends on the tenant settings for meeting. The application might be put in lobby waiting to be admitted by a user. This is defined by the isInLobby property
The following example shows the request to make a peer-to-peer call between the bot and a PSTN number. In this example, the media is hosted by the service. The values of authorization token, callback URL, application instance ID, application instance display name, phone ID and tenant ID must be replaced with actual values to make the example work.
Note: Application instance ID is the object ID of application instance. The application ID that application instance links to should match the one in authorization token. Phone ID is the phone number in E.164 format.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
Source = new ParticipantInfo
{
OdataType = "#microsoft.graph.participantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
AdditionalData = new Dictionary<string, object>
{
{
"applicationInstance" , new
{
OdataType = "#microsoft.graph.identity",
DisplayName = "Calling Bot",
Id = "3d913abb-aec0-4964-8fa6-3c6850c4f278",
}
},
},
},
CountryCode = null,
EndpointType = null,
Region = null,
LanguageId = null,
},
Targets = new List<InvitationParticipantInfo>
{
new InvitationParticipantInfo
{
OdataType = "#microsoft.graph.invitationParticipantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
AdditionalData = new Dictionary<string, object>
{
{
"phone" , new
{
OdataType = "#microsoft.graph.identity",
Id = "+12345678901",
}
},
},
},
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
},
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$source = new ParticipantInfo();
$source->set@odatatype('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->set@odatatype('#microsoft.graph.identitySet');
$additionalData = [
'applicationInstance' => $sourceIdentity = new ApplicationInstance();
$ sourceIdentity->set@odatatype('#microsoft.graph.identity');
$ sourceIdentity->setDisplayName('Calling Bot');
$ sourceIdentity->setId('3d913abb-aec0-4964-8fa6-3c6850c4f278');
$sourceIdentity->setApplicationInstance($applicationInstance);
];
$sourceIdentity->setAdditionalData($additionalData);
$source->setIdentity($sourceIdentity);
$Source->setCountryCode(null);
$Source->setEndpointType(null);
$Source->setRegion(null);
$Source->setLanguageId(null);
$requestBody->setSource($source);
$targetsInvitationParticipantInfo1 = new InvitationParticipantInfo();
$targetsInvitationParticipantInfo1->set@odatatype('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->set@odatatype('#microsoft.graph.identitySet');
$additionalData = [
'phone' => $targetsInvitationParticipantInfo1Identity = new Phone();
$ targetsInvitationParticipantInfo1Identity->set@odatatype('#microsoft.graph.identity');
$ targetsInvitationParticipantInfo1Identity->setId('+12345678901');
$targetsInvitationParticipantInfo1Identity->setPhone($phone);
];
$targetsInvitationParticipantInfo1Identity->setAdditionalData($additionalData);
$targetsInvitationParticipantInfo1->setIdentity($targetsInvitationParticipantInfo1Identity);
$targetsArray []= $targetsInvitationParticipantInfo1;
$requestBody->setTargets($targetsArray);
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.serviceHostedMediaConfig');
$requestBody->setMediaConfig($mediaConfig);
$requestBody->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
The following example shows a request to make a peer-to-peer call between the bot and a PSTN number. In this example, the media is hosted locally by the application. The values of authorization token, callback URL, application instance ID, application instance display name, phone ID and tenant ID must be replaced with actual values to make the example work.
Note: Application instance ID is the object ID of application instance. The application ID that application instance links to should match the one in authorization token. Phone ID is the phone number in E.164 format.
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
Source = new ParticipantInfo
{
OdataType = "#microsoft.graph.participantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
AdditionalData = new Dictionary<string, object>
{
{
"applicationInstance" , new
{
OdataType = "#microsoft.graph.identity",
DisplayName = "Calling Bot",
Id = "3d913abb-aec0-4964-8fa6-3c6850c4f278",
}
},
},
},
CountryCode = null,
EndpointType = null,
Region = null,
LanguageId = null,
},
Targets = new List<InvitationParticipantInfo>
{
new InvitationParticipantInfo
{
OdataType = "#microsoft.graph.invitationParticipantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
AdditionalData = new Dictionary<string, object>
{
{
"phone" , new
{
OdataType = "#microsoft.graph.identity",
Id = "+12345678901",
}
},
},
},
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new MediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"blob" , "<Media Session Configuration>"
},
},
},
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new Call();
$requestBody->set@odatatype('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$source = new ParticipantInfo();
$source->set@odatatype('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->set@odatatype('#microsoft.graph.identitySet');
$additionalData = [
'applicationInstance' => $sourceIdentity = new ApplicationInstance();
$ sourceIdentity->set@odatatype('#microsoft.graph.identity');
$ sourceIdentity->setDisplayName('Calling Bot');
$ sourceIdentity->setId('3d913abb-aec0-4964-8fa6-3c6850c4f278');
$sourceIdentity->setApplicationInstance($applicationInstance);
];
$sourceIdentity->setAdditionalData($additionalData);
$source->setIdentity($sourceIdentity);
$Source->setCountryCode(null);
$Source->setEndpointType(null);
$Source->setRegion(null);
$Source->setLanguageId(null);
$requestBody->setSource($source);
$targetsInvitationParticipantInfo1 = new InvitationParticipantInfo();
$targetsInvitationParticipantInfo1->set@odatatype('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->set@odatatype('#microsoft.graph.identitySet');
$additionalData = [
'phone' => $targetsInvitationParticipantInfo1Identity = new Phone();
$ targetsInvitationParticipantInfo1Identity->set@odatatype('#microsoft.graph.identity');
$ targetsInvitationParticipantInfo1Identity->setId('+12345678901');
$targetsInvitationParticipantInfo1Identity->setPhone($phone);
];
$targetsInvitationParticipantInfo1Identity->setAdditionalData($additionalData);
$targetsInvitationParticipantInfo1->setIdentity($targetsInvitationParticipantInfo1Identity);
$targetsArray []= $targetsInvitationParticipantInfo1;
$requestBody->setTargets($targetsArray);
$requestBody->setRequestedModalities([$requestBody->setModality(new Modality('audio'));
]);
$mediaConfig = new MediaConfig();
$mediaConfig->set@odatatype('#microsoft.graph.appHostedMediaConfig');
$additionalData = [
'blob' => '<Media Session Configuration>',
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$requestBody->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.