Create call
Article
03/09/2023
49 minutes to read
18 contributors
Feedback
In this article
Namespace: microsoft.graph
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 as mentioned below.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions .
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Not supported.
Delegated (personal Microsoft account)
Not supported.
Application
Calls.JoinGroupCalls.Chat*, Calls.JoinGroupCallAsGuest.All, Calls.JoinGroupCall.All, Calls.Initiate.All, Calls.InitiateGroupCall.All
Note: For a call with app-hosted media, you need the Calls.AccessMedia.All permission in addition to one of the permissions listed in the table above.
Permissions marked with * use resource-specific consent .
HTTP request
POST /communications/calls
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
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.
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"callbackUri": "https://bot.contoso.com/callback",
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "John",
"id": "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
}
}
}
],
"requestedModalities": [
"audio"
],
"callOptions": {
"@odata.type": "#microsoft.graph.outgoingCallOptions",
"isContentSharingNotificationEnabled": true
},
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig"
}
}
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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
callbackUri: 'https://bot.contoso.com/callback',
targets: [
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'John',
id: '112f7296-5fa4-42ca-bae8-6a692b15d4b8'
}
}
}
],
requestedModalities: [
'audio'
],
callOptions: {
'@odata.type': '#microsoft.graph.outgoingCallOptions',
isContentSharingNotificationEnabled: true
},
mediaConfig: {
'@odata.type': '#microsoft.graph.serviceHostedMediaConfig'
}
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewCall()
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
invitationParticipantInfo := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
displayName := "John"
user.SetDisplayName(&displayName)
id := "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
user.SetId(&id)
identity.SetUser(user)
invitationParticipantInfo.SetIdentity(identity)
targets := []graphmodels.InvitationParticipantInfoable {
invitationParticipantInfo,
}
requestBody.SetTargets(targets)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
callOptions := graphmodels.NewCallOptions()
isContentSharingNotificationEnabled := true
callOptions.SetIsContentSharingNotificationEnabled(&isContentSharingNotificationEnabled)
requestBody.SetCallOptions(callOptions)
mediaConfig := graphmodels.NewMediaConfig()
requestBody.SetMediaConfig(mediaConfig)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
CallbackUri = "https://bot.contoso.com/callback"
Targets = @(
@{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
User = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "John"
Id = "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
}
}
}
)
RequestedModalities = @(
"audio"
)
CallOptions = @{
"@odata.type" = "#microsoft.graph.outgoingCallOptions"
IsContentSharingNotificationEnabled = $true
}
MediaConfig = @{
"@odata.type" = "#microsoft.graph.serviceHostedMediaConfig"
}
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2e1a0b00-2db4-4022-9570-243709c565ab
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d8217646-3110-40b1-bae6-e9ac6c3a9f74",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
},
"countryCode": null,
"endpointType": null,
"region": null,
"languageId": null
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "John",
"id": "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
}
},
"endpointType": null,
"replacesCallId": null,
}
],
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": [
{
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "f8971b04-b53e-418c-9222-c82ce681a582"
},
{
"uri": "https://cdn.contoso.com/cool.wav",
"resourceId": "86dc814b-c172-4428-9112-60f8ecae1edb"
}
],
},
"myParticipantId": "499ff390-7a72-40e8-83a0-8fac6295ae7e",
"id": "2e1a0b00-2db4-4022-9570-243709c565ab",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
"subject": null,
"ringingTimeoutInSeconds": null,
"mediaState": null,
"resultInfo": null,
"answeredBy": null,
"chatInfo": null,
"meetingInfo": null,
"transcription": null,
"toneInfo": null
}
Notification - establishing
POST https://bot.contoso.com/callback
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resourceUrl": "/communications/calls/2e1a0b00-2db4-4022-9570-243709c565ab",
"callbackUri": "https://bot.contoso.com/callback",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"id": "2e1a0b00-2db4-4022-9570-243709c565ab"
}
}
]
}
Note: Call establishing/established notifications may arrive out of order.
Notification - established
POST https://bot.contoso.com/callback
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resourceUrl": "/communications/calls/2e1a0b00-b3c5-4b0f-99b3-c133bc1e6116",
"callbackUri": "https://bot.contoso.com/callback",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "established",
"direction": "outgoing",
"id": "2e1a0b00-b3c5-4b0f-99b3-c133bc1e6116"
}
}
]
}
Note: Call establishing/established notifications may arrive out of order.
Notification - content sharing started
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",
"resourceData": [
{
"@odata.type": "#microsoft.graph.contentSharingSession",
"id": "F7D9EF30FF0A9BD3F64B274387FB8FF8E96B6CFBA8F87F8305A74DE99AF007BC"
}
]
}
]
}
Notification - content sharing updated
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/421f4c00-4436-4c3a-9d9a-c4924cf98e67/contentsharingsessions",
"resourceData": [
{
"@odata.type": "#microsoft.graph.contentSharingSession",
"id": "F7D9EF30FF0A9BD3F64B274387FB8FF8E96B6CFBA8F87F8305A74DE99AF007BC"
}
]
}
]
}
Notification - content sharing ended
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",
"resourceData": [
{
"@odata.type": "#microsoft.graph.contentSharingSession",
"id": "F7D9EF30FF0A9BD3F64B274387FB8FF8E96B6CFBA8F87F8305A74DE99AF007BC"
}
]
}
]
}
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.
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"callbackUri": "https://bot.contoso.com/callback",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
},
"region": null,
"languageId": null
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "John",
"id": "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
}
}
}
],
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
"blob": "<Media Session Configuration>"
}
}
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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
callbackUri: 'https://bot.contoso.com/callback',
source: {
'@odata.type': '#microsoft.graph.participantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
application: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'Calling Bot',
id: '2891555a-92ff-42e6-80fa-6e1300c6b5c6'
}
},
region: null,
languageId: null
},
targets: [
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'John',
id: '112f7296-5fa4-42ca-bae8-6a692b15d4b8'
}
}
}
],
requestedModalities: [
'audio'
],
mediaConfig: {
'@odata.type': '#microsoft.graph.appHostedMediaConfig',
blob: '<Media Session Configuration>'
}
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Call call = new Call();
call.callbackUri = "https://bot.contoso.com/callback";
ParticipantInfo source = new ParticipantInfo();
IdentitySet identity = new IdentitySet();
Identity application = new Identity();
application.displayName = "Calling Bot";
application.id = "2891555a-92ff-42e6-80fa-6e1300c6b5c6";
identity.application = application;
source.identity = identity;
source.region = null;
source.languageId = null;
call.source = source;
LinkedList<InvitationParticipantInfo> targetsList = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo targets = new InvitationParticipantInfo();
IdentitySet identity1 = new IdentitySet();
Identity user = new Identity();
user.displayName = "John";
user.id = "112f7296-5fa4-42ca-bae8-6a692b15d4b8";
identity1.user = user;
targets.identity = identity1;
targetsList.add(targets);
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>";
call.mediaConfig = mediaConfig;
graphClient.communications().calls()
.buildRequest()
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewCall()
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
source := graphmodels.NewParticipantInfo()
identity := graphmodels.NewIdentitySet()
application := graphmodels.NewIdentity()
displayName := "Calling Bot"
application.SetDisplayName(&displayName)
id := "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
application.SetId(&id)
identity.SetApplication(application)
source.SetIdentity(identity)
region := null
source.SetRegion(®ion)
languageId := null
source.SetLanguageId(&languageId)
requestBody.SetSource(source)
invitationParticipantInfo := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
displayName := "John"
user.SetDisplayName(&displayName)
id := "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
user.SetId(&id)
identity.SetUser(user)
invitationParticipantInfo.SetIdentity(identity)
targets := []graphmodels.InvitationParticipantInfoable {
invitationParticipantInfo,
}
requestBody.SetTargets(targets)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
mediaConfig := graphmodels.NewMediaConfig()
additionalData := map[string]interface{}{
"blob" : "<Media Session Configuration>",
}
mediaConfig.SetAdditionalData(additionalData)
requestBody.SetMediaConfig(mediaConfig)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
CallbackUri = "https://bot.contoso.com/callback"
Source = @{
"@odata.type" = "#microsoft.graph.participantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
Application = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "Calling Bot"
Id = "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
}
Region = $null
LanguageId = $null
}
Targets = @(
@{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
User = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "John"
Id = "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
}
}
}
)
RequestedModalities = @(
"audio"
)
MediaConfig = @{
"@odata.type" = "#microsoft.graph.appHostedMediaConfig"
Blob = "<Media Session Configuration>"
}
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Note: For peer-to-peer calls, the expected notifications are for call state changes only.
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2e1a0b00-2db4-4022-9570-243709c565ab
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d8217646-3110-40b1-bae6-e9ac6c3a9f74",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
},
"region": null,
"languageId": null
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "John",
"id": "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
}
}
}
],
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
"blob": "<Media Session Configuration>",
},
"myParticipantId": "499ff390-7a72-40e8-83a0-8fac6295ae7e",
"id": "2e1a0b00-2db4-4022-9570-243709c565ab",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
"subject": null,
"ringingTimeoutInSeconds": null,
"mediaState": null,
"resultInfo": null,
"answeredBy": null,
"chatInfo": null,
"meetingInfo": null,
"transcription": null,
"toneInfo": null
}
This supports up to 5 VoIP users. The example shows how to create a group call with two VoIP users.
Note: This example call needs the Calls.InitiateGroupCalls.All
permission. The group call created doesn't support chat or recording.
Request
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"direction": "outgoing",
"subject": "Create a group call with service hosted media",
"callbackUri": "https://bot.contoso.com/callback",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "TestBot",
"id": "dd3885da-f9ab-486b-bfae-85de3d445555"
}
}
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "user1",
"id": "98da8a1a-1b87-452c-a713-65d3f10b5555"
}
}
},
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "user2",
"id": "bf5aae9a-d11d-47a8-93b1-782504c95555"
}
}
}
],
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"removeFromDefaultAudioGroup": false
}
}
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.invitationParticipantInfo",
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",
AdditionalData = new Dictionary<string, object>
{
{
"removeFromDefaultAudioGroup" , false
},
},
},
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
direction: 'outgoing',
subject: 'Create a group call with service hosted media',
callbackUri: 'https://bot.contoso.com/callback',
source: {
'@odata.type': '#microsoft.graph.participantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
application: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'TestBot',
id: 'dd3885da-f9ab-486b-bfae-85de3d445555'
}
}
},
targets: [
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'user1',
id: '98da8a1a-1b87-452c-a713-65d3f10b5555'
}
}
},
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'user2',
id: 'bf5aae9a-d11d-47a8-93b1-782504c95555'
}
}
}
],
requestedModalities: [
'audio'
],
mediaConfig: {
'@odata.type': '#microsoft.graph.serviceHostedMediaConfig',
removeFromDefaultAudioGroup: false
}
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
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);
InvitationParticipantInfo targets1 = new InvitationParticipantInfo();
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;
graphClient.communications().calls()
.buildRequest()
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//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()
additionalData := map[string]interface{}{
removeFromDefaultAudioGroup := false
mediaConfig.SetRemoveFromDefaultAudioGroup(&removeFromDefaultAudioGroup)
}
mediaConfig.SetAdditionalData(additionalData)
requestBody.SetMediaConfig(mediaConfig)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
Direction = "outgoing"
Subject = "Create a group call with service hosted media"
CallbackUri = "https://bot.contoso.com/callback"
Source = @{
"@odata.type" = "#microsoft.graph.participantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
Application = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "TestBot"
Id = "dd3885da-f9ab-486b-bfae-85de3d445555"
}
}
}
Targets = @(
@{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
User = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "user1"
Id = "98da8a1a-1b87-452c-a713-65d3f10b5555"
}
}
}
@{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
User = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "user2"
Id = "bf5aae9a-d11d-47a8-93b1-782504c95555"
}
}
}
)
RequestedModalities = @(
"audio"
)
MediaConfig = @{
"@odata.type" = "#microsoft.graph.serviceHostedMediaConfig"
RemoveFromDefaultAudioGroup = $false
}
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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.invitationParticipantInfo');
$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');
$additionalData = [
'removeFromDefaultAudioGroup' => false,
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2f1a1100-b174-40a0-aba7-0b405e01ed92
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"subject": "Create a group call with service hosted media",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d17646-3110-40b1-bae6-e9ac6c3f74",
"callRoutes": [],
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "TestBot",
"id": "dd3885da-f9ab-486b-bfae-85de3d445555"
}
},
"region": null,
"languageId": null
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "user1",
"id": "98da8a1a-1b87-452c-a713-65d3f10b5555"
}
}
},
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "user2",
"id": "bf5aae9a-d11d-47a8-93b1-782504c95555"
}
}
}
],
"requestedModalities": [
"audio"
],
"activeModalities": [],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
},
"routingPolicies": [],
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a",
"id": "2f1a1100-b174-40a0-aba7-0b405e01ed92",
"myParticipantId": "c9a65b85-a223-44ae-8cdb-29395458323f",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
}
This supports up to 5 VoIP users. The example shows how to create a group call with two VoIP users.
Note: This example call needs the Calls.InitiateGroupCalls.All
permission. The group call created doesn't support chat or recording.
Request
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"direction": "outgoing",
"subject": "Create a group call with application hosted media",
"callbackUri": "https://bot.contoso.com/callback",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "TestBot",
"id": "dd3885da-f9ab-486b-bfae-85de3d445555"
}
}
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "user1",
"id": "98da8a1a-1b87-452c-a713-65d3f10b5555"
}
}
},
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "user2",
"id": "bf5aae9a-d11d-47a8-93b1-782504c95555"
}
}
}
],
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
"removeFromDefaultAudioGroup": false
}
}
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
Direction = CallDirection.Outgoing,
Subject = "Create a group call with application 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.invitationParticipantInfo",
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",
AdditionalData = new Dictionary<string, object>
{
{
"removeFromDefaultAudioGroup" , false
},
},
},
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
direction: 'outgoing',
subject: 'Create a group call with application hosted media',
callbackUri: 'https://bot.contoso.com/callback',
source: {
'@odata.type': '#microsoft.graph.participantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
application: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'TestBot',
id: 'dd3885da-f9ab-486b-bfae-85de3d445555'
}
}
},
targets: [
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'user1',
id: '98da8a1a-1b87-452c-a713-65d3f10b5555'
}
}
},
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'user2',
id: 'bf5aae9a-d11d-47a8-93b1-782504c95555'
}
}
}
],
requestedModalities: [
'audio'
],
mediaConfig: {
'@odata.type': '#microsoft.graph.appHostedMediaConfig',
removeFromDefaultAudioGroup: false
}
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Call call = new Call();
call.direction = CallDirection.OUTGOING;
call.subject = "Create a group call with application 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);
InvitationParticipantInfo targets1 = new InvitationParticipantInfo();
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.removeFromDefaultAudioGroup = false;
call.mediaConfig = mediaConfig;
graphClient.communications().calls()
.buildRequest()
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//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 application 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()
additionalData := map[string]interface{}{
removeFromDefaultAudioGroup := false
mediaConfig.SetRemoveFromDefaultAudioGroup(&removeFromDefaultAudioGroup)
}
mediaConfig.SetAdditionalData(additionalData)
requestBody.SetMediaConfig(mediaConfig)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
Direction = "outgoing"
Subject = "Create a group call with application hosted media"
CallbackUri = "https://bot.contoso.com/callback"
Source = @{
"@odata.type" = "#microsoft.graph.participantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
Application = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "TestBot"
Id = "dd3885da-f9ab-486b-bfae-85de3d445555"
}
}
}
Targets = @(
@{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
User = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "user1"
Id = "98da8a1a-1b87-452c-a713-65d3f10b5555"
}
}
}
@{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
User = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "user2"
Id = "bf5aae9a-d11d-47a8-93b1-782504c95555"
}
}
}
)
RequestedModalities = @(
"audio"
)
MediaConfig = @{
"@odata.type" = "#microsoft.graph.appHostedMediaConfig"
RemoveFromDefaultAudioGroup = $false
}
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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 application 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.invitationParticipantInfo');
$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');
$additionalData = [
'removeFromDefaultAudioGroup' => false,
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2f1a1100-b174-40a0-aba7-0b405e01ed92
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"subject": "Create a group call with app hosted media",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d8217646-3110-40b1-bae6-e9ac6c3a9f74",
"callRoutes": [],
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "TestBot",
"id": "dd3885da-f9ab-486b-bfae-85de3d445555"
}
},
"region": null,
"languageId": null
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "user1",
"id": "98da8a1a-1b87-452c-a713-65d3f10b5555"
}
}
},
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "user2",
"id": "bf5aae9a-d11d-47a8-93b1-782504c95555"
}
}
}
],
"requestedModalities": [
"audio"
],
"activeModalities": [],
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
"blob": "<Media Session Configuration>",
"removeFromDefaultAudioGroup": false
},
"routingPolicies": [],
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a",
"id": "2f1a1100-b174-40a0-aba7-0b405e01ed92",
"myParticipantId": "c9a65b85-a223-44ae-8cdb-29395458323f",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
}
To join the scheduled meeting, you need to get the thread ID, message ID, organizer ID, and the tenant ID in which the meeting is scheduled.
You can get this information by 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.
Request
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"callbackUri": "https://bot.contoso.com/callback",
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": [
{
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "f8971b04-b53e-418c-9222-c82ce681a582"
},
{
"uri": "https://cdn.contoso.com/cool.wav",
"resourceId": "86dc814b-c172-4428-9112-60f8ecae1edb"
}
],
},
"chatInfo": {
"@odata.type": "#microsoft.graph.chatInfo",
"threadId": "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
"messageId": "0"
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.organizerMeetingInfo",
"organizer": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
"displayName": "Bob",
"tenantId":"86dc81db-c112-4228-9222-63f3esaa1edb"
}
},
"allowConversationWithoutHost": true
},
"tenantId":"86dc81db-c112-4228-9222-63f3esaa1edb"
}
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",
AdditionalData = new Dictionary<string, object>
{
{
"organizer" , new
{
OdataType = "#microsoft.graph.identitySet",
User = new
{
OdataType = "#microsoft.graph.identity",
Id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
DisplayName = "Bob",
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb",
},
}
},
{
"allowConversationWithoutHost" , true
},
},
},
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
callbackUri: 'https://bot.contoso.com/callback',
requestedModalities: [
'audio'
],
mediaConfig: {
'@odata.type': '#microsoft.graph.serviceHostedMediaConfig',
preFetchMedia: [
{
uri: 'https://cdn.contoso.com/beep.wav',
resourceId: 'f8971b04-b53e-418c-9222-c82ce681a582'
},
{
uri: 'https://cdn.contoso.com/cool.wav',
resourceId: '86dc814b-c172-4428-9112-60f8ecae1edb'
}
],
},
chatInfo: {
'@odata.type': '#microsoft.graph.chatInfo',
threadId: '19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2',
messageId: '0'
},
meetingInfo: {
'@odata.type': '#microsoft.graph.organizerMeetingInfo',
organizer: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
id: '5810cede-f3cc-42eb-b2c1-e9bd5d53ec96',
displayName: 'Bob',
tenantId: '86dc81db-c112-4228-9222-63f3esaa1edb'
}
},
allowConversationWithoutHost: true
},
tenantId: '86dc81db-c112-4228-9222-63f3esaa1edb'
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewCall()
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
mediaConfig := graphmodels.NewMediaConfig()
additionalData := map[string]interface{}{
:= graphmodels.New()
uri := "https://cdn.contoso.com/beep.wav"
.SetUri(&uri)
resourceId := "f8971b04-b53e-418c-9222-c82ce681a582"
.SetResourceId(&resourceId)
:= graphmodels.New()
uri := "https://cdn.contoso.com/cool.wav"
.SetUri(&uri)
resourceId := "86dc814b-c172-4428-9112-60f8ecae1edb"
.SetResourceId(&resourceId)
preFetchMedia := []graphmodels.Objectable {
,
,
}
}
mediaConfig.SetAdditionalData(additionalData)
requestBody.SetMediaConfig(mediaConfig)
chatInfo := graphmodels.NewChatInfo()
threadId := "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2"
chatInfo.SetThreadId(&threadId)
messageId := "0"
chatInfo.SetMessageId(&messageId)
requestBody.SetChatInfo(chatInfo)
meetingInfo := graphmodels.NewMeetingInfo()
additionalData := map[string]interface{}{
organizer := graphmodels.New()
user := graphmodels.New()
id := "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96"
user.SetId(&id)
displayName := "Bob"
user.SetDisplayName(&displayName)
tenantId := "86dc81db-c112-4228-9222-63f3esaa1edb"
user.SetTenantId(&tenantId)
organizer.SetUser(user)
meetingInfo.SetOrganizer(organizer)
allowConversationWithoutHost := true
meetingInfo.SetAllowConversationWithoutHost(&allowConversationWithoutHost)
}
meetingInfo.SetAdditionalData(additionalData)
requestBody.SetMeetingInfo(meetingInfo)
tenantId := "86dc81db-c112-4228-9222-63f3esaa1edb"
requestBody.SetTenantId(&tenantId)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
CallbackUri = "https://bot.contoso.com/callback"
RequestedModalities = @(
"audio"
)
MediaConfig = @{
"@odata.type" = "#microsoft.graph.serviceHostedMediaConfig"
PreFetchMedia = @(
)
}
ChatInfo = @{
"@odata.type" = "#microsoft.graph.chatInfo"
ThreadId = "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2"
MessageId = "0"
}
MeetingInfo = @{
"@odata.type" = "#microsoft.graph.organizerMeetingInfo"
Organizer = @{
"@odata.type" = "#microsoft.graph.identitySet"
User = @{
"@odata.type" = "#microsoft.graph.identity"
Id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96"
DisplayName = "Bob"
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb"
}
}
AllowConversationWithoutHost = $true
}
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb"
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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');
$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->setDisplayName('Bob');
$user->setTenantId('86dc81db-c112-4228-9222-63f3esaa1edb');
$meetingInfo->setUser($user);
$meetingInfo->setOrganizer($organizer);
'allowConversationWithoutHost' => true,
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('86dc81db-c112-4228-9222-63f3esaa1edb');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2f1a1100-b174-40a0-aba7-0b405e01ed92
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d8217646-3110-40b1-bae6-e9ac6c3a9f74",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
},
"region": null,
"languageId": null
},
"targets": [],
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": [
{
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "f8971b04-b53e-418c-9222-c82ce681a582"
},
{
"uri": "https://cdn.contoso.com/cool.wav",
"resourceId": "86dc814b-c172-4428-9112-60f8ecae1edb"
}
],
},
"chatInfo": {
"@odata.type": "#microsoft.graph.chatInfo",
"threadId": "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
"messageId": "0",
"replyChainMessageId": null
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.organizerMeetingInfo",
"organizer": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
"displayName": "Bob"
}
},
"allowConversationWithoutHost": true
},
"transcription": null,
"myParticipantId": "05491616-385f-44a8-9974-18cc5f9933c1",
"id": "2f1a1100-b174-40a0-aba7-0b405e01ed92",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
"ringingTimeoutInSeconds": null,
"mediaState": null,
"subject": null,
"resultInfo": null,
"answeredBy": null,
"toneInfo": null
}
Notification - establishing
POST https://bot.contoso.com/callback
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resourceUrl": "/communications/calls/2f1a1100-b174-40a0-aba7-0b405e01ed92",
"callbackUri": "https://bot.contoso.com/callback",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"chatInfo": {
"@odata.type": "#microsoft.graph.chatInfo",
"threadId": "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
"messageId": "0"
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.organizerMeetingInfo",
"organizer": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
"displayName": "Bob"
}
},
"allowConversationWithoutHost": true
},
"id": "2f1a1100-b174-40a0-aba7-0b405e01ed92"
}
}
]
}
Note: Call establishing/established notifications may arrive out of order.
Notification - established
POST https://bot.contoso.com/callback
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resourceUrl": "/communications/calls/2f1a1100-b174-40a0-aba7-0b405e01ed92",
"callbackUri": "https://bot.contoso.com/callback",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "established",
"chatInfo": {
"@odata.type": "#microsoft.graph.chatInfo",
"threadId": "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
"messageId": "0"
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.organizerMeetingInfo",
"organizer": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
"displayName": "Bob"
}
},
"allowConversationWithoutHost": true
},
"id": "2f1a1100-b174-40a0-aba7-0b405e01ed92"
}
}
]
}
Note: Call establishing/established notifications may arrive out of order.
Notification - roster
POST https://bot.contoso.com/callback
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resourceUrl": "/communications/calls/2f1a1100-b174-40a0-aba7-0b405e01ed92/participants",
"callbackUri": "https://bot.contoso.com/callback",
"resourceData": [
{
"@odata.type": "#microsoft.graph.participant",
"info": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "John",
"id": "112f7296-5fa4-42ca-bae8-6a692b15d4b8"
}
},
"languageId": "en-US"
},
"mediaStreams": [
{
"@odata.type": "#microsoft.graph.mediaStream",
"mediaType": "audio",
"sourceId": "1",
"direction": "sendReceive",
"serverMuted": false
},
{
"@odata.type": "#microsoft.graph.mediaStream",
"mediaType": "video",
"sourceId": "2",
"direction": "receiveOnly",
"serverMuted": false
},
{
"@odata.type": "#microsoft.graph.mediaStream",
"mediaType": "videoBasedScreenSharing",
"sourceId": "8",
"direction": "receiveOnly",
"serverMuted": false
}
],
"isMuted": true,
"isInLobby": false,
"id": "0d7664b6-6432-43ed-8d27-d9e7adec188c"
},
{
"@odata.type": "#microsoft.graph.participant",
"info": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
}
},
"mediaStreams": [
{
"@odata.type": "#microsoft.graph.mediaStream",
"mediaType": "audio",
"sourceId": "10",
"direction": "sendReceive",
"serverMuted": false
}
],
"isMuted": false,
"isInLobby": false,
"id": "05491616-385f-44a8-9974-18cc5f9933c1"
}
]
}
]
}
Note: For join meeting scenarios apart from call state notifications, we receive roster notifications.
Update the media config with the appHostedMediaConfig as shown in the following example.
Request
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"direction": "outgoing",
"callbackUri": "https://bot.contoso.com/callback",
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig"
},
"chatInfo": {
"@odata.type": "#microsoft.graph.chatInfo",
"threadId": "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
"messageId": "0"
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.organizerMeetingInfo",
"organizer": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a",
"displayName": "Bob"
}
},
"allowConversationWithoutHost": true
},
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a"
}
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",
},
ChatInfo = new ChatInfo
{
OdataType = "#microsoft.graph.chatInfo",
ThreadId = "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
MessageId = "0",
},
MeetingInfo = new MeetingInfo
{
OdataType = "#microsoft.graph.organizerMeetingInfo",
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",
},
}
},
{
"allowConversationWithoutHost" , true
},
},
},
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
};
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
direction: 'outgoing',
callbackUri: 'https://bot.contoso.com/callback',
requestedModalities: [
'audio'
],
mediaConfig: {
'@odata.type': '#microsoft.graph.appHostedMediaConfig'
},
chatInfo: {
'@odata.type': '#microsoft.graph.chatInfo',
threadId: '19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2',
messageId: '0'
},
meetingInfo: {
'@odata.type': '#microsoft.graph.organizerMeetingInfo',
organizer: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
id: '5810cede-f3cc-42eb-b2c1-e9bd5d53ec96',
tenantId: 'aa67bd4c-8475-432d-bd41-39f255720e0a',
displayName: 'Bob'
}
},
allowConversationWithoutHost: true
},
tenantId: 'aa67bd4c-8475-432d-bd41-39f255720e0a'
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//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)
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
mediaConfig := graphmodels.NewMediaConfig()
requestBody.SetMediaConfig(mediaConfig)
chatInfo := graphmodels.NewChatInfo()
threadId := "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2"
chatInfo.SetThreadId(&threadId)
messageId := "0"
chatInfo.SetMessageId(&messageId)
requestBody.SetChatInfo(chatInfo)
meetingInfo := graphmodels.NewMeetingInfo()
additionalData := map[string]interface{}{
organizer := graphmodels.New()
user := graphmodels.New()
id := "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96"
user.SetId(&id)
tenantId := "aa67bd4c-8475-432d-bd41-39f255720e0a"
user.SetTenantId(&tenantId)
displayName := "Bob"
user.SetDisplayName(&displayName)
organizer.SetUser(user)
meetingInfo.SetOrganizer(organizer)
allowConversationWithoutHost := true
meetingInfo.SetAllowConversationWithoutHost(&allowConversationWithoutHost)
}
meetingInfo.SetAdditionalData(additionalData)
requestBody.SetMeetingInfo(meetingInfo)
tenantId := "aa67bd4c-8475-432d-bd41-39f255720e0a"
requestBody.SetTenantId(&tenantId)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
Direction = "outgoing"
CallbackUri = "https://bot.contoso.com/callback"
RequestedModalities = @(
"audio"
)
MediaConfig = @{
"@odata.type" = "#microsoft.graph.appHostedMediaConfig"
}
ChatInfo = @{
"@odata.type" = "#microsoft.graph.chatInfo"
ThreadId = "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2"
MessageId = "0"
}
MeetingInfo = @{
"@odata.type" = "#microsoft.graph.organizerMeetingInfo"
Organizer = @{
"@odata.type" = "#microsoft.graph.identitySet"
User = @{
"@odata.type" = "#microsoft.graph.identity"
Id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96"
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a"
DisplayName = "Bob"
}
}
AllowConversationWithoutHost = $true
}
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a"
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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');
$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');
$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);
'allowConversationWithoutHost' => true,
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$requestResult = $graphServiceClient->communications()->calls()->post($requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2f1a1100-b174-40a0-aba7-0b405e01ed92
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d8217646-3110-40b1-bae6-e9ac6c3a9f74",
"callRoutes": [],
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
},
"region": null,
"languageId": null
},
"targets": [],
"requestedModalities": [
"audio"
],
"activeModalities": [],
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
"blob": "<Media Session Configuration>",
},
"chatInfo": {
"@odata.type": "#microsoft.graph.chatInfo",
"threadId": "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
"messageId": "0",
"replyChainMessageId": null
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.organizerMeetingInfo",
"organizer": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a",
"displayName": "Bob"
}
},
"allowConversationWithoutHost": true
},
"transcription": null,
"routingPolicies": [],
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a",
"myParticipantId": "05491616-385f-44a8-9974-18cc5f9933c1",
"id": "2f1a1100-b174-40a0-aba7-0b405e01ed92",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
"terminationReason": null,
"ringingTimeoutInSeconds": null,
"mediaState": null,
"subject": null,
"resultInfo": null,
"answeredBy": null,
"meetingCapability": null,
"toneInfo": null
}
Example 7: 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.
Request
The following is an example of a request.
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"callbackUri": "https://bot.contoso.com/callback",
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": [
{
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "f8971b04-b53e-418c-9222-c82ce681a582"
},
{
"uri": "https://cdn.contoso.com/cool.wav",
"resourceId": "86dc814b-c172-4428-9112-60f8ecae1edb"
}
]
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.joinMeetingIdMeetingInfo",
"joinMeetingId": "1234567",
"passcode": "psw123"
},
"tenantId": "86dc81db-c112-4228-9222-63f3esaa1edb"
}
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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
callbackUri: 'https://bot.contoso.com/callback',
requestedModalities: [
'audio'
],
mediaConfig: {
'@odata.type': '#microsoft.graph.serviceHostedMediaConfig',
preFetchMedia: [
{
uri: 'https://cdn.contoso.com/beep.wav',
resourceId: 'f8971b04-b53e-418c-9222-c82ce681a582'
},
{
uri: 'https://cdn.contoso.com/cool.wav',
resourceId: '86dc814b-c172-4428-9112-60f8ecae1edb'
}
]
},
meetingInfo: {
'@odata.type': '#microsoft.graph.joinMeetingIdMeetingInfo',
joinMeetingId: '1234567',
passcode: 'psw123'
},
tenantId: '86dc81db-c112-4228-9222-63f3esaa1edb'
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Call call = new Call();
call.callbackUri = "https://bot.contoso.com/callback";
LinkedList<Modality> requestedModalitiesList = new LinkedList<Modality>();
requestedModalitiesList.add(Modality.AUDIO);
call.requestedModalities = requestedModalitiesList;
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
LinkedList<MediaInfo> preFetchMediaList = new LinkedList<MediaInfo>();
MediaInfo preFetchMedia = new MediaInfo();
preFetchMedia.uri = "https://cdn.contoso.com/beep.wav";
preFetchMedia.resourceId = "f8971b04-b53e-418c-9222-c82ce681a582";
preFetchMediaList.add(preFetchMedia);
MediaInfo preFetchMedia1 = new MediaInfo();
preFetchMedia1.uri = "https://cdn.contoso.com/cool.wav";
preFetchMedia1.resourceId = "86dc814b-c172-4428-9112-60f8ecae1edb";
preFetchMediaList.add(preFetchMedia1);
mediaConfig.preFetchMedia = preFetchMediaList;
call.mediaConfig = mediaConfig;
JoinMeetingIdMeetingInfo meetingInfo = new JoinMeetingIdMeetingInfo();
meetingInfo.joinMeetingId = "1234567";
meetingInfo.passcode = "psw123";
call.meetingInfo = meetingInfo;
call.tenantId = "86dc81db-c112-4228-9222-63f3esaa1edb";
graphClient.communications().calls()
.buildRequest()
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewCall()
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
mediaConfig := graphmodels.NewMediaConfig()
additionalData := map[string]interface{}{
:= graphmodels.New()
uri := "https://cdn.contoso.com/beep.wav"
.SetUri(&uri)
resourceId := "f8971b04-b53e-418c-9222-c82ce681a582"
.SetResourceId(&resourceId)
:= graphmodels.New()
uri := "https://cdn.contoso.com/cool.wav"
.SetUri(&uri)
resourceId := "86dc814b-c172-4428-9112-60f8ecae1edb"
.SetResourceId(&resourceId)
preFetchMedia := []graphmodels.Objectable {
,
,
}
}
mediaConfig.SetAdditionalData(additionalData)
requestBody.SetMediaConfig(mediaConfig)
meetingInfo := graphmodels.NewMeetingInfo()
additionalData := map[string]interface{}{
"joinMeetingId" : "1234567",
"passcode" : "psw123",
}
meetingInfo.SetAdditionalData(additionalData)
requestBody.SetMeetingInfo(meetingInfo)
tenantId := "86dc81db-c112-4228-9222-63f3esaa1edb"
requestBody.SetTenantId(&tenantId)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
CallbackUri = "https://bot.contoso.com/callback"
RequestedModalities = @(
"audio"
)
MediaConfig = @{
"@odata.type" = "#microsoft.graph.serviceHostedMediaConfig"
PreFetchMedia = @(
)
}
MeetingInfo = @{
"@odata.type" = "#microsoft.graph.joinMeetingIdMeetingInfo"
JoinMeetingId = "1234567"
Passcode = "psw123"
}
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb"
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2f1a1100-b174-40a0-aba7-0b405e01ed92
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d8217646-3110-40b1-bae6-e9ac6c3a9f74",
"callRoutes": [],
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
},
"region": null,
"languageId": null
},
"targets": [],
"requestedModalities": [
"audio"
],
"activeModalities": [],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": [
{
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "f8971b04-b53e-418c-9222-c82ce681a582"
},
{
"uri": "https://cdn.contoso.com/cool.wav",
"resourceId": "86dc814b-c172-4428-9112-60f8ecae1edb"
}
],
},
"chatInfo": {
"@odata.type": "#microsoft.graph.chatInfo",
"threadId": "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNNkYTFm@thread.v2",
"messageId": "0",
"replyChainMessageId": null
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.joinMeetingIdMeetingInfo",
"joinMeetingId": "1234567",
"passcode": "psw123"
},
"transcription": null,
"routingPolicies": [],
"tenantId": "86dc81db-c112-4228-9222-63f3esaa1edb",
"myParticipantId": "05491616-385f-44a8-9974-18cc5f9933c1",
"id": "2f1a1100-b174-40a0-aba7-0b405e01ed92",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
"terminationReason": null,
"ringingTimeoutInSeconds": null,
"mediaState": null,
"subject": null,
"resultInfo": null,
"answeredBy": null,
"meetingCapability": null,
"toneInfo": null
}
Example 8: 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.
Request
The following is an example of a request.
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"callbackUri": "https://bot.contoso.com/callback",
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": [
{
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "f8971b04-b53e-418c-9222-c82ce681a582"
},
{
"uri": "https://cdn.contoso.com/cool.wav",
"resourceId": "86dc814b-c172-4428-9112-60f8ecae1edb"
}
]
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.joinMeetingIdMeetingInfo",
"joinMeetingId": "1234567",
"passcode": null
},
"tenantId": "86dc81db-c112-4228-9222-63f3esaa1edb"
}
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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
callbackUri: 'https://bot.contoso.com/callback',
requestedModalities: [
'audio'
],
mediaConfig: {
'@odata.type': '#microsoft.graph.serviceHostedMediaConfig',
preFetchMedia: [
{
uri: 'https://cdn.contoso.com/beep.wav',
resourceId: 'f8971b04-b53e-418c-9222-c82ce681a582'
},
{
uri: 'https://cdn.contoso.com/cool.wav',
resourceId: '86dc814b-c172-4428-9112-60f8ecae1edb'
}
]
},
meetingInfo: {
'@odata.type': '#microsoft.graph.joinMeetingIdMeetingInfo',
joinMeetingId: '1234567',
passcode: null
},
tenantId: '86dc81db-c112-4228-9222-63f3esaa1edb'
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Call call = new Call();
call.callbackUri = "https://bot.contoso.com/callback";
LinkedList<Modality> requestedModalitiesList = new LinkedList<Modality>();
requestedModalitiesList.add(Modality.AUDIO);
call.requestedModalities = requestedModalitiesList;
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
LinkedList<MediaInfo> preFetchMediaList = new LinkedList<MediaInfo>();
MediaInfo preFetchMedia = new MediaInfo();
preFetchMedia.uri = "https://cdn.contoso.com/beep.wav";
preFetchMedia.resourceId = "f8971b04-b53e-418c-9222-c82ce681a582";
preFetchMediaList.add(preFetchMedia);
MediaInfo preFetchMedia1 = new MediaInfo();
preFetchMedia1.uri = "https://cdn.contoso.com/cool.wav";
preFetchMedia1.resourceId = "86dc814b-c172-4428-9112-60f8ecae1edb";
preFetchMediaList.add(preFetchMedia1);
mediaConfig.preFetchMedia = preFetchMediaList;
call.mediaConfig = mediaConfig;
JoinMeetingIdMeetingInfo meetingInfo = new JoinMeetingIdMeetingInfo();
meetingInfo.joinMeetingId = "1234567";
meetingInfo.passcode = null;
call.meetingInfo = meetingInfo;
call.tenantId = "86dc81db-c112-4228-9222-63f3esaa1edb";
graphClient.communications().calls()
.buildRequest()
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewCall()
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
mediaConfig := graphmodels.NewMediaConfig()
additionalData := map[string]interface{}{
:= graphmodels.New()
uri := "https://cdn.contoso.com/beep.wav"
.SetUri(&uri)
resourceId := "f8971b04-b53e-418c-9222-c82ce681a582"
.SetResourceId(&resourceId)
:= graphmodels.New()
uri := "https://cdn.contoso.com/cool.wav"
.SetUri(&uri)
resourceId := "86dc814b-c172-4428-9112-60f8ecae1edb"
.SetResourceId(&resourceId)
preFetchMedia := []graphmodels.Objectable {
,
,
}
}
mediaConfig.SetAdditionalData(additionalData)
requestBody.SetMediaConfig(mediaConfig)
meetingInfo := graphmodels.NewMeetingInfo()
additionalData := map[string]interface{}{
"joinMeetingId" : "1234567",
passcode := null
meetingInfo.SetPasscode(&passcode)
}
meetingInfo.SetAdditionalData(additionalData)
requestBody.SetMeetingInfo(meetingInfo)
tenantId := "86dc81db-c112-4228-9222-63f3esaa1edb"
requestBody.SetTenantId(&tenantId)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
CallbackUri = "https://bot.contoso.com/callback"
RequestedModalities = @(
"audio"
)
MediaConfig = @{
"@odata.type" = "#microsoft.graph.serviceHostedMediaConfig"
PreFetchMedia = @(
)
}
MeetingInfo = @{
"@odata.type" = "#microsoft.graph.joinMeetingIdMeetingInfo"
JoinMeetingId = "1234567"
Passcode = $null
}
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb"
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following is an example of the response.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2f1a1100-b174-40a0-aba7-0b405e01ed92
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d8217646-3110-40b1-bae6-e9ac6c3a9f74",
"callRoutes": [],
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"application": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "2891555a-92ff-42e6-80fa-6e1300c6b5c6"
}
},
"region": null,
"languageId": null
},
"targets": [],
"requestedModalities": [
"audio"
],
"activeModalities": [],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": [
{
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "f8971b04-b53e-418c-9222-c82ce681a582"
},
{
"uri": "https://cdn.contoso.com/cool.wav",
"resourceId": "86dc814b-c172-4428-9112-60f8ecae1edb"
}
],
},
"chatInfo": {
"@odata.type": "#microsoft.graph.chatInfo",
"threadId": "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNNkYTFm@thread.v2",
"messageId": "0",
"replyChainMessageId": null
},
"meetingInfo": {
"@odata.type": "#microsoft.graph.joinMeetingIdMeetingInfo",
"joinMeetingId": "1234567",
"passcode": null
},
"transcription": null,
"routingPolicies": [],
"tenantId": "86dc81db-c112-4228-9222-63f3esaa1edb",
"myParticipantId": "05491616-385f-44a8-9974-18cc5f9933c1",
"id": "2f1a1100-b174-40a0-aba7-0b405e01ed92",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
"terminationReason": null,
"ringingTimeoutInSeconds": null,
"mediaState": null,
"subject": null,
"resultInfo": null,
"answeredBy": null,
"meetingCapability": null,
"toneInfo": null
}
Note: This call requires the Calls.Initiate.All permission.
This call requires an application instance with a PSTN number assigned. For details, see Assign a phone number to your bot .
Request
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.
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"callbackUri": "https://bot.contoso.com/callback",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"applicationInstance": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "3d913abb-aec0-4964-8fa6-3c6850c4f278"
},
},
"countryCode": null,
"endpointType": null,
"region": null,
"languageId": null
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"phone": {
"@odata.type": "#microsoft.graph.identity",
"id": "+12345678901"
}
}
}
],
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig"
},
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a"
}
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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
callbackUri: 'https://bot.contoso.com/callback',
source: {
'@odata.type': '#microsoft.graph.participantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
applicationInstance: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'Calling Bot',
id: '3d913abb-aec0-4964-8fa6-3c6850c4f278'
},
},
countryCode: null,
endpointType: null,
region: null,
languageId: null
},
targets: [
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
phone: {
'@odata.type': '#microsoft.graph.identity',
id: '+12345678901'
}
}
}
],
requestedModalities: [
'audio'
],
mediaConfig: {
'@odata.type': '#microsoft.graph.serviceHostedMediaConfig'
},
tenantId: 'aa67bd4c-8475-432d-bd41-39f255720e0a'
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewCall()
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
source := graphmodels.NewParticipantInfo()
identity := graphmodels.NewIdentitySet()
additionalData := map[string]interface{}{
applicationInstance := graphmodels.New()
displayName := "Calling Bot"
applicationInstance.SetDisplayName(&displayName)
id := "3d913abb-aec0-4964-8fa6-3c6850c4f278"
applicationInstance.SetId(&id)
identity.SetApplicationInstance(applicationInstance)
}
identity.SetAdditionalData(additionalData)
source.SetIdentity(identity)
countryCode := null
source.SetCountryCode(&countryCode)
endpointType := null
source.SetEndpointType(&endpointType)
region := null
source.SetRegion(®ion)
languageId := null
source.SetLanguageId(&languageId)
requestBody.SetSource(source)
invitationParticipantInfo := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
additionalData := map[string]interface{}{
phone := graphmodels.New()
id := "+12345678901"
phone.SetId(&id)
identity.SetPhone(phone)
}
identity.SetAdditionalData(additionalData)
invitationParticipantInfo.SetIdentity(identity)
targets := []graphmodels.InvitationParticipantInfoable {
invitationParticipantInfo,
}
requestBody.SetTargets(targets)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
mediaConfig := graphmodels.NewMediaConfig()
requestBody.SetMediaConfig(mediaConfig)
tenantId := "aa67bd4c-8475-432d-bd41-39f255720e0a"
requestBody.SetTenantId(&tenantId)
result, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
CallbackUri = "https://bot.contoso.com/callback"
Source = @{
"@odata.type" = "#microsoft.graph.participantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
ApplicationInstance = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "Calling Bot"
Id = "3d913abb-aec0-4964-8fa6-3c6850c4f278"
}
}
CountryCode = $null
EndpointType = $null
Region = $null
LanguageId = $null
}
Targets = @(
@{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
Phone = @{
"@odata.type" = "#microsoft.graph.identity"
Id = "+12345678901"
}
}
}
)
RequestedModalities = @(
"audio"
)
MediaConfig = @{
"@odata.type" = "#microsoft.graph.serviceHostedMediaConfig"
}
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a"
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2e1a0b00-2db4-4022-9570-243709c565ab
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d8217646-3110-40b1-bae6-e9ac6c3a9f74",
"callRoutes": [],
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"applicationInstance": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "3d913abb-aec0-4964-8fa6-3c6850c4f278"
},
},
"countryCode": null,
"endpointType": null,
"region": null,
"languageId": null
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"phone": {
"@odata.type": "#microsoft.graph.identity",
"id": "+12345678901"
}
},
"endpointType": null,
"region": null,
"replacesCallId": null,
"languageId": null
}
],
"requestedModalities": [
"audio"
],
"activeModalities": [],
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig",
"preFetchMedia": [
{
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "f8971b04-b53e-418c-9222-c82ce681a582"
},
{
"uri": "https://cdn.contoso.com/cool.wav",
"resourceId": "86dc814b-c172-4428-9112-60f8ecae1edb"
}
],
},
"routingPolicies": [],
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a",
"myParticipantId": "499ff390-7a72-40e8-83a0-8fac6295ae7e",
"id": "2e1a0b00-2db4-4022-9570-243709c565ab",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
"subject": null,
"terminationReason": null,
"ringingTimeoutInSeconds": null,
"mediaState": null,
"resultInfo": null,
"answeredBy": null,
"chatInfo": null,
"meetingInfo": null,
"transcription": null,
"meetingCapability": null,
"toneInfo": null
}
Note : This example requires Calls.Initiate.All and Calls.AccessMedia.All permissions.
This call requires an application instance with a PSTN number assigned. For details, see Assign a phone number to your bot .
Request
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.
POST https://graph.microsoft.com/v1.0/communications/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"callbackUri": "https://bot.contoso.com/callback",
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"applicationInstance": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "3d913abb-aec0-4964-8fa6-3c6850c4f278"
},
},
"countryCode": null,
"endpointType": null,
"region": null,
"languageId": null
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"phone": {
"@odata.type": "#microsoft.graph.identity",
"id": "+12345678901"
}
}
}
],
"requestedModalities": [
"audio"
],
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
"blob": "<Media Session Configuration>"
},
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a"
}
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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
const call = {
'@odata.type': '#microsoft.graph.call',
callbackUri: 'https://bot.contoso.com/callback',
source: {
'@odata.type': '#microsoft.graph.participantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
applicationInstance: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'Calling Bot',
id: '3d913abb-aec0-4964-8fa6-3c6850c4f278'
},
},
countryCode: null,
endpointType: null,
region: null,
languageId: null
},
targets: [
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
phone: {
'@odata.type': '#microsoft.graph.identity',
id: '+12345678901'
}
}
}
],
requestedModalities: [
'audio'
],
mediaConfig: {
'@odata.type': '#microsoft.graph.appHostedMediaConfig',
blob: '<Media Session Configuration>'
},
tenantId: 'aa67bd4c-8475-432d-bd41-39f255720e0a'
};
await client.api('/communications/calls')
.post(call);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestBody := graphmodels.NewCall()
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
source := graphmodels.NewParticipantInfo()
identity := graphmodels.NewIdentitySet()
additionalData := map[string]interface{}{
applicationInstance := graphmodels.New()
displayName := "Calling Bot"
applicationInstance.SetDisplayName(&displayName)
id := "3d913abb-aec0-4964-8fa6-3c6850c4f278"
applicationInstance.SetId(&id)
identity.SetApplicationInstance(applicationInstance)
}
identity.SetAdditionalData(additionalData)
source.SetIdentity(identity)
countryCode := null
source.SetCountryCode(&countryCode)
endpointType := null
source.SetEndpointType(&endpointType)
region := null
source.SetRegion(®ion)
languageId := null
source.SetLanguageId(&languageId)
requestBody.SetSource(source)
invitationParticipantInfo := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
additionalData := map[string]interface{}{
phone := graphmodels.New()
id := "+12345678901"
phone.SetId(&id)
identity.SetPhone(phone)
}
identity.SetAdditionalData(additionalData)
invitationParticipantInfo.SetIdentity(identity)
targets := []graphmodels.InvitationParticipantInfoable {
invitationParticipantInfo,
}
requestBody.SetTargets(targets)
requestedModalities := []graphmodels.Modalityable {
modality := graphmodels.AUDIO_MODALITY
requestBody.SetModality(&modality)
}
requestBody.SetRequestedModalities(requestedModalities)
mediaConfig := graphmodels.NewMediaConfig()
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)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
"@odata.type" = "#microsoft.graph.call"
CallbackUri = "https://bot.contoso.com/callback"
Source = @{
"@odata.type" = "#microsoft.graph.participantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
ApplicationInstance = @{
"@odata.type" = "#microsoft.graph.identity"
DisplayName = "Calling Bot"
Id = "3d913abb-aec0-4964-8fa6-3c6850c4f278"
}
}
CountryCode = $null
EndpointType = $null
Region = $null
LanguageId = $null
}
Targets = @(
@{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
Identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
Phone = @{
"@odata.type" = "#microsoft.graph.identity"
Id = "+12345678901"
}
}
}
)
RequestedModalities = @(
"audio"
)
MediaConfig = @{
"@odata.type" = "#microsoft.graph.appHostedMediaConfig"
Blob = "<Media Session Configuration>"
}
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a"
}
New-MgCommunicationCall -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Location: https://graph.microsoft.com/v1.0/communications/calls/2e1a0b00-2db4-4022-9570-243709c565ab
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"direction": "outgoing",
"callbackUri": "https://bot.contoso.com/callback",
"callChainId": "d8217646-3110-40b1-bae6-e9ac6c3a9f74",
"callRoutes": [],
"source": {
"@odata.type": "#microsoft.graph.participantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"applicationInstance": {
"@odata.type": "#microsoft.graph.identity",
"displayName": "Calling Bot",
"id": "3d913abb-aec0-4964-8fa6-3c6850c4f278"
},
},
"countryCode": null,
"endpointType": null,
"region": null,
"languageId": null
},
"targets": [
{
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"phone": {
"@odata.type": "#microsoft.graph.identity",
"id": "+12345678901"
}
},
"endpointType": null,
"region": null,
"replacesCallId": null,
"languageId": null
}
],
"requestedModalities": [
"audio"
],
"activeModalities": [],
"mediaConfig": {
"@odata.type": "#microsoft.graph.appHostedMediaConfig",
"blob": "<Media Session Configuration>",
},
"routingPolicies": [],
"tenantId": "aa67bd4c-8475-432d-bd41-39f255720e0a",
"myParticipantId": "499ff390-7a72-40e8-83a0-8fac6295ae7e",
"id": "2e1a0b00-2db4-4022-9570-243709c565ab",
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#app/calls/$entity",
"subject": null,
"terminationReason": null,
"ringingTimeoutInSeconds": null,
"mediaState": null,
"resultInfo": null,
"answeredBy": null,
"chatInfo": null,
"meetingInfo": null,
"transcription": null,
"meetingCapability": null,
"toneInfo": null
}