通話の作成
[アーティクル] 10/22/2024
27 人の共同作成者
フィードバック
この記事の内容
名前空間: microsoft.graph
呼び出し を作成すると、ボットは新しい発信ピアツーピア通話またはグループ通話を作成したり、既存の会議に参加したりできます。
呼び出し元のボットを登録 し、必要なアクセス許可の一覧を確認する必要があります。
この API では、次の PSTN シナリオがサポートされています。
ボットの PSTN 番号への着信呼び出しと、ボットが別の PSTN を招待します。
ボットの PSTN 番号への着信呼び出しと、ボットから別の PSTN への転送。
ボットの PSTN 番号への着信呼び出し後、ボットは別の PSTN にリダイレクトします。
ボットのインスタンス識別子とボットへの着信呼び出しによって、別の PSTN が招待されます。
ボットのインスタンス識別子を呼び出し、ボットを別の PSTN に転送します。
ボットのインスタンス識別子とボットへの着信呼び出しは、別の PSTN にリダイレクトされます。
スケジュールされた会議からボットのインスタンス識別子を呼び出し、ボットが PSTN を招待します。
ボット (インスタンス識別子付き) から PSTN への発信呼び出し。
ボットと別のピア (Teams ユーザー、PSTN) 間の P2P 呼び出しでは、ボットは別の PSTN を招待します。
ボットと別のピア (Teams ユーザー、PSTN) 間の P2P 呼び出しでは、ボットは別の Teams ユーザーを招待します。
ボットはスケジュールされた会議に参加し、PSTN を招待します。
この API は、次の国内クラウド展開 で使用できます。
グローバル サービス
米国政府機関 L4
米国政府機関 L5 (DOD)
21Vianet が運営する中国
✅
✅
✅
❌
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ 、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類 」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス 」を参照してください。
アクセス許可の種類
最小特権アクセス許可
より高い特権のアクセス許可
委任 (職場または学校のアカウント)
サポートされていません。
サポートされていません。
委任 (個人用 Microsoft アカウント)
サポートされていません。
サポートされていません。
アプリケーション
Calls.JoinGroupCalls.Chat
Calls.Initiate.All、Calls.InitiateGroupCall.All、Calls.JoinGroupCall.All、Calls.JoinGroupCallAsGuest.All
注:
アプリでホストされたメディアを使用した呼び出しの場合は、前の表に示したいずれかのアクセス許可に加えて、Calls.AccessMedia.All アクセス許可が必要です。
Calls.JoinGroupCalls.Chat アクセス許可は 、リソース固有の同意を使用します 。
Microsoft Teams認定されている Cloud Video Interop ソリューションには、ブラウザーを介して参加する外部ユーザーと同様に、会議参加リンクがある会議に参加するためにこの API を呼び出すアクセス許可があります。
HTTP 要求
POST /communications/calls
名前
説明
Authorization
ベアラー {token}。 必須です。
認証と認可 についての詳細をご覧ください。
Content-type
application/json. 必須です。
要求本文
要求本文で、 呼び出し オブジェクトの JSON 表現を指定します。
応答
成功した場合、このメソッドは 201 Created
応答コードと応答本文の 呼び出し オブジェクトを返します。
例
手記: この呼び出しには、Calls.Initiate.All アクセス許可が必要です。
要求
次の例は、ボットと指定したユーザーの間でピアツーピア呼び出しを行う要求を示しています。 この例では、サービスによってメディアがホストされます。 認証トークン、コールバック URL、アプリケーション ID、アプリケーション名、ユーザー ID、ユーザー名、テナント ID の値を実際の値に置き換えて、サンプルを機能させる必要があります。
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,
"isDeltaRosterEnabled": true
},
"mediaConfig": {
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
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 OutgoingCallOptions
{
OdataType = "#microsoft.graph.outgoingCallOptions",
IsContentSharingNotificationEnabled = true,
AdditionalData = new Dictionary<string, object>
{
{
"isDeltaRosterEnabled" , true
},
},
},
MediaConfig = new ServiceHostedMediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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,\
"isDeltaRosterEnabled": true\
},\
"mediaConfig": {\
"@odata.type": "#microsoft.graph.serviceHostedMediaConfig"\
}\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
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.NewOutgoingCallOptions()
isContentSharingNotificationEnabled := true
callOptions.SetIsContentSharingNotificationEnabled(&isContentSharingNotificationEnabled)
additionalData := map[string]interface{}{
isDeltaRosterEnabled := true
callOptions.SetIsDeltaRosterEnabled(&isDeltaRosterEnabled)
}
callOptions.SetAdditionalData(additionalData)
requestBody.SetCallOptions(callOptions)
mediaConfig := graphmodels.NewServiceHostedMediaConfig()
requestBody.SetMediaConfig(mediaConfig)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setCallbackUri("https://bot.contoso.com/callback");
LinkedList<InvitationParticipantInfo> targets = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo invitationParticipantInfo = new InvitationParticipantInfo();
invitationParticipantInfo.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity = new IdentitySet();
identity.setOdataType("#microsoft.graph.identitySet");
Identity user = new Identity();
user.setOdataType("#microsoft.graph.identity");
user.setDisplayName("John");
user.setId("112f7296-5fa4-42ca-bae8-6a692b15d4b8");
identity.setUser(user);
invitationParticipantInfo.setIdentity(identity);
targets.add(invitationParticipantInfo);
call.setTargets(targets);
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
OutgoingCallOptions callOptions = new OutgoingCallOptions();
callOptions.setOdataType("#microsoft.graph.outgoingCallOptions");
callOptions.setIsContentSharingNotificationEnabled(true);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("isDeltaRosterEnabled", true);
callOptions.setAdditionalData(additionalData);
call.setCallOptions(callOptions);
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.serviceHostedMediaConfig");
call.setMediaConfig(mediaConfig);
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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,
isDeltaRosterEnabled: true
},
mediaConfig: {
'@odata.type': '#microsoft.graph.serviceHostedMediaConfig'
}
};
await client.api('/communications/calls')
.post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\OutgoingCallOptions;
use Microsoft\Graph\Generated\Models\ServiceHostedMediaConfig;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$targetsInvitationParticipantInfo1 = new InvitationParticipantInfo();
$targetsInvitationParticipantInfo1->setOdataType('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->setOdataType('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo1IdentityUser = new Identity();
$targetsInvitationParticipantInfo1IdentityUser->setOdataType('#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([new Modality('audio'),]);
$callOptions = new OutgoingCallOptions();
$callOptions->setOdataType('#microsoft.graph.outgoingCallOptions');
$callOptions->setIsContentSharingNotificationEnabled(true);
$additionalData = [
'isDeltaRosterEnabled' => true,
];
$callOptions->setAdditionalData($additionalData);
$requestBody->setCallOptions($callOptions);
$mediaConfig = new ServiceHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.serviceHostedMediaConfig');
$requestBody->setMediaConfig($mediaConfig);
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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
isDeltaRosterEnabled = $true
}
mediaConfig = @{
"@odata.type" = "#microsoft.graph.serviceHostedMediaConfig"
}
}
New-MgCommunicationCall -BodyParameter $params
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
from msgraph.generated.models.identity_set import IdentitySet
from msgraph.generated.models.identity import Identity
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.outgoing_call_options import OutgoingCallOptions
from msgraph.generated.models.service_hosted_media_config import ServiceHostedMediaConfig
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
callback_uri = "https://bot.contoso.com/callback",
targets = [
InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
user = Identity(
odata_type = "#microsoft.graph.identity",
display_name = "John",
id = "112f7296-5fa4-42ca-bae8-6a692b15d4b8",
),
),
),
],
requested_modalities = [
Modality.Audio,
],
call_options = OutgoingCallOptions(
odata_type = "#microsoft.graph.outgoingCallOptions",
is_content_sharing_notification_enabled = True,
additional_data = {
"is_delta_roster_enabled" : True,
}
),
media_config = ServiceHostedMediaConfig(
odata_type = "#microsoft.graph.serviceHostedMediaConfig",
),
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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,
"callOptions": {
"@odata.type": "#microsoft.graph.outgoingCallOptions",
"isContentSharingNotificationEnabled": true,
"isDeltaRosterEnabled": true
},
"toneInfo": null
}
通知 - 確立
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"
}
}
]
}
手記: 通話の確立/確立された通知が順番に届く可能性があります。
通知 - 確立済み
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"
}
}
]
}
手記: 通話の確立/確立された通知が順番に届く可能性があります。
通知 - コンテンツの共有が開始されました
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"
}
]
}
]
}
通知 - コンテンツ共有が更新されました
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"
}
]
}
]
}
通知 - コンテンツの共有が終了しました
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"
}
]
}
]
}
注 : この例では、Calls.Initiate.All および Calls.AccessMedia.All のアクセス許可が必要です。
要求
次の例は、ボットと指定したユーザーの間でピアツーピア呼び出しを行う要求を示しています。 この例では、メディアはアプリケーションによってローカルでホストされます。 認証トークン、コールバック URL、アプリケーション ID、アプリケーション名、ユーザー ID、ユーザー名、テナント ID の値を実際の値に置き換えて、サンプルを機能させる必要があります。
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>"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
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 AppHostedMediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
Blob = "<Media Session Configuration>",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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>"\
}\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
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.NewAppHostedMediaConfig()
blob := "<Media Session Configuration>"
mediaConfig.SetBlob(&blob)
requestBody.SetMediaConfig(mediaConfig)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setCallbackUri("https://bot.contoso.com/callback");
ParticipantInfo source = new ParticipantInfo();
source.setOdataType("#microsoft.graph.participantInfo");
IdentitySet identity = new IdentitySet();
identity.setOdataType("#microsoft.graph.identitySet");
Identity application = new Identity();
application.setOdataType("#microsoft.graph.identity");
application.setDisplayName("Calling Bot");
application.setId("2891555a-92ff-42e6-80fa-6e1300c6b5c6");
identity.setApplication(application);
source.setIdentity(identity);
source.setRegion(null);
source.setLanguageId(null);
call.setSource(source);
LinkedList<InvitationParticipantInfo> targets = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo invitationParticipantInfo = new InvitationParticipantInfo();
invitationParticipantInfo.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity1 = new IdentitySet();
identity1.setOdataType("#microsoft.graph.identitySet");
Identity user = new Identity();
user.setOdataType("#microsoft.graph.identity");
user.setDisplayName("John");
user.setId("112f7296-5fa4-42ca-bae8-6a692b15d4b8");
identity1.setUser(user);
invitationParticipantInfo.setIdentity(identity1);
targets.add(invitationParticipantInfo);
call.setTargets(targets);
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
AppHostedMediaConfig mediaConfig = new AppHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.appHostedMediaConfig");
mediaConfig.setBlob("<Media Session Configuration>");
call.setMediaConfig(mediaConfig);
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\ParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\AppHostedMediaConfig;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$source = new ParticipantInfo();
$source->setOdataType('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->setOdataType('#microsoft.graph.identitySet');
$sourceIdentityApplication = new Identity();
$sourceIdentityApplication->setOdataType('#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->setOdataType('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->setOdataType('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo1IdentityUser = new Identity();
$targetsInvitationParticipantInfo1IdentityUser->setOdataType('#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([new Modality('audio'),]);
$mediaConfig = new AppHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.appHostedMediaConfig');
$mediaConfig->setBlob('<Media Session Configuration>');
$requestBody->setMediaConfig($mediaConfig);
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.participant_info import ParticipantInfo
from msgraph.generated.models.identity_set import IdentitySet
from msgraph.generated.models.identity import Identity
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.app_hosted_media_config import AppHostedMediaConfig
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
callback_uri = "https://bot.contoso.com/callback",
source = ParticipantInfo(
odata_type = "#microsoft.graph.participantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
application = Identity(
odata_type = "#microsoft.graph.identity",
display_name = "Calling Bot",
id = "2891555a-92ff-42e6-80fa-6e1300c6b5c6",
),
),
region = None,
language_id = None,
),
targets = [
InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
user = Identity(
odata_type = "#microsoft.graph.identity",
display_name = "John",
id = "112f7296-5fa4-42ca-bae8-6a692b15d4b8",
),
),
),
],
requested_modalities = [
Modality.Audio,
],
media_config = AppHostedMediaConfig(
odata_type = "#microsoft.graph.appHostedMediaConfig",
blob = "<Media Session Configuration>",
),
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
手記: ピアツーピア呼び出しの場合、予期される通知は通話状態の変更に対してのみ行われます。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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
}
これにより、最大 5 人の VoIP ユーザーがサポートされます。 この例では、2 人の VoIP ユーザーを使用してグループ呼び出しを作成する方法を示します。
手記: この例の呼び出しには、アクセス許可が必要です Calls.InitiateGroupCalls.All
。 作成されたグループ呼び出しでは、チャットや録音はサポートされていません。
要求
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
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
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 ServiceHostedMediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"removeFromDefaultAudioGroup" , false
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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\
}\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
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.NewServiceHostedMediaConfig()
additionalData := map[string]interface{}{
removeFromDefaultAudioGroup := false
mediaConfig.SetRemoveFromDefaultAudioGroup(&removeFromDefaultAudioGroup)
}
mediaConfig.SetAdditionalData(additionalData)
requestBody.SetMediaConfig(mediaConfig)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setDirection(CallDirection.Outgoing);
call.setSubject("Create a group call with service hosted media");
call.setCallbackUri("https://bot.contoso.com/callback");
ParticipantInfo source = new ParticipantInfo();
source.setOdataType("#microsoft.graph.participantInfo");
IdentitySet identity = new IdentitySet();
identity.setOdataType("#microsoft.graph.identitySet");
Identity application = new Identity();
application.setOdataType("#microsoft.graph.identity");
application.setDisplayName("TestBot");
application.setId("dd3885da-f9ab-486b-bfae-85de3d445555");
identity.setApplication(application);
source.setIdentity(identity);
call.setSource(source);
LinkedList<InvitationParticipantInfo> targets = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo invitationParticipantInfo = new InvitationParticipantInfo();
invitationParticipantInfo.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity1 = new IdentitySet();
identity1.setOdataType("#microsoft.graph.identitySet");
Identity user = new Identity();
user.setOdataType("#microsoft.graph.identity");
user.setDisplayName("user1");
user.setId("98da8a1a-1b87-452c-a713-65d3f10b5555");
identity1.setUser(user);
invitationParticipantInfo.setIdentity(identity1);
targets.add(invitationParticipantInfo);
InvitationParticipantInfo invitationParticipantInfo1 = new InvitationParticipantInfo();
invitationParticipantInfo1.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity2 = new IdentitySet();
identity2.setOdataType("#microsoft.graph.identitySet");
Identity user1 = new Identity();
user1.setOdataType("#microsoft.graph.identity");
user1.setDisplayName("user2");
user1.setId("bf5aae9a-d11d-47a8-93b1-782504c95555");
identity2.setUser(user1);
invitationParticipantInfo1.setIdentity(identity2);
targets.add(invitationParticipantInfo1);
call.setTargets(targets);
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.serviceHostedMediaConfig");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("removeFromDefaultAudioGroup", false);
mediaConfig.setAdditionalData(additionalData);
call.setMediaConfig(mediaConfig);
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\CallDirection;
use Microsoft\Graph\Generated\Models\ParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\ServiceHostedMediaConfig;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#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->setOdataType('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->setOdataType('#microsoft.graph.identitySet');
$sourceIdentityApplication = new Identity();
$sourceIdentityApplication->setOdataType('#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->setOdataType('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->setOdataType('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo1IdentityUser = new Identity();
$targetsInvitationParticipantInfo1IdentityUser->setOdataType('#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->setOdataType('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo2Identity = new IdentitySet();
$targetsInvitationParticipantInfo2Identity->setOdataType('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo2IdentityUser = new Identity();
$targetsInvitationParticipantInfo2IdentityUser->setOdataType('#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([new Modality('audio'),]);
$mediaConfig = new ServiceHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.serviceHostedMediaConfig');
$additionalData = [
'removeFromDefaultAudioGroup' => false,
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.call_direction import CallDirection
from msgraph.generated.models.participant_info import ParticipantInfo
from msgraph.generated.models.identity_set import IdentitySet
from msgraph.generated.models.identity import Identity
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.service_hosted_media_config import ServiceHostedMediaConfig
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
direction = CallDirection.Outgoing,
subject = "Create a group call with service hosted media",
callback_uri = "https://bot.contoso.com/callback",
source = ParticipantInfo(
odata_type = "#microsoft.graph.participantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
application = Identity(
odata_type = "#microsoft.graph.identity",
display_name = "TestBot",
id = "dd3885da-f9ab-486b-bfae-85de3d445555",
),
),
),
targets = [
InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
user = Identity(
odata_type = "#microsoft.graph.identity",
display_name = "user1",
id = "98da8a1a-1b87-452c-a713-65d3f10b5555",
),
),
),
InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
user = Identity(
odata_type = "#microsoft.graph.identity",
display_name = "user2",
id = "bf5aae9a-d11d-47a8-93b1-782504c95555",
),
),
),
],
requested_modalities = [
Modality.Audio,
],
media_config = ServiceHostedMediaConfig(
odata_type = "#microsoft.graph.serviceHostedMediaConfig",
additional_data = {
"remove_from_default_audio_group" : False,
}
),
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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",
}
これにより、最大 5 人の VoIP ユーザーがサポートされます。 この例では、2 人の VoIP ユーザーを使用してグループ呼び出しを作成する方法を示します。
手記: この例の呼び出しには、アクセス許可が必要です Calls.InitiateGroupCalls.All
。 作成されたグループ呼び出しでは、チャットや録音はサポートされていません。
要求
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
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
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 AppHostedMediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
AdditionalData = new Dictionary<string, object>
{
{
"removeFromDefaultAudioGroup" , false
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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\
}\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
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.NewAppHostedMediaConfig()
additionalData := map[string]interface{}{
removeFromDefaultAudioGroup := false
mediaConfig.SetRemoveFromDefaultAudioGroup(&removeFromDefaultAudioGroup)
}
mediaConfig.SetAdditionalData(additionalData)
requestBody.SetMediaConfig(mediaConfig)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setDirection(CallDirection.Outgoing);
call.setSubject("Create a group call with application hosted media");
call.setCallbackUri("https://bot.contoso.com/callback");
ParticipantInfo source = new ParticipantInfo();
source.setOdataType("#microsoft.graph.participantInfo");
IdentitySet identity = new IdentitySet();
identity.setOdataType("#microsoft.graph.identitySet");
Identity application = new Identity();
application.setOdataType("#microsoft.graph.identity");
application.setDisplayName("TestBot");
application.setId("dd3885da-f9ab-486b-bfae-85de3d445555");
identity.setApplication(application);
source.setIdentity(identity);
call.setSource(source);
LinkedList<InvitationParticipantInfo> targets = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo invitationParticipantInfo = new InvitationParticipantInfo();
invitationParticipantInfo.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity1 = new IdentitySet();
identity1.setOdataType("#microsoft.graph.identitySet");
Identity user = new Identity();
user.setOdataType("#microsoft.graph.identity");
user.setDisplayName("user1");
user.setId("98da8a1a-1b87-452c-a713-65d3f10b5555");
identity1.setUser(user);
invitationParticipantInfo.setIdentity(identity1);
targets.add(invitationParticipantInfo);
InvitationParticipantInfo invitationParticipantInfo1 = new InvitationParticipantInfo();
invitationParticipantInfo1.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity2 = new IdentitySet();
identity2.setOdataType("#microsoft.graph.identitySet");
Identity user1 = new Identity();
user1.setOdataType("#microsoft.graph.identity");
user1.setDisplayName("user2");
user1.setId("bf5aae9a-d11d-47a8-93b1-782504c95555");
identity2.setUser(user1);
invitationParticipantInfo1.setIdentity(identity2);
targets.add(invitationParticipantInfo1);
call.setTargets(targets);
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
AppHostedMediaConfig mediaConfig = new AppHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.appHostedMediaConfig");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("removeFromDefaultAudioGroup", false);
mediaConfig.setAdditionalData(additionalData);
call.setMediaConfig(mediaConfig);
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\CallDirection;
use Microsoft\Graph\Generated\Models\ParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\AppHostedMediaConfig;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#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->setOdataType('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->setOdataType('#microsoft.graph.identitySet');
$sourceIdentityApplication = new Identity();
$sourceIdentityApplication->setOdataType('#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->setOdataType('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->setOdataType('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo1IdentityUser = new Identity();
$targetsInvitationParticipantInfo1IdentityUser->setOdataType('#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->setOdataType('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo2Identity = new IdentitySet();
$targetsInvitationParticipantInfo2Identity->setOdataType('#microsoft.graph.identitySet');
$targetsInvitationParticipantInfo2IdentityUser = new Identity();
$targetsInvitationParticipantInfo2IdentityUser->setOdataType('#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([new Modality('audio'),]);
$mediaConfig = new AppHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.appHostedMediaConfig');
$additionalData = [
'removeFromDefaultAudioGroup' => false,
];
$mediaConfig->setAdditionalData($additionalData);
$requestBody->setMediaConfig($mediaConfig);
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.call_direction import CallDirection
from msgraph.generated.models.participant_info import ParticipantInfo
from msgraph.generated.models.identity_set import IdentitySet
from msgraph.generated.models.identity import Identity
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.app_hosted_media_config import AppHostedMediaConfig
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
direction = CallDirection.Outgoing,
subject = "Create a group call with application hosted media",
callback_uri = "https://bot.contoso.com/callback",
source = ParticipantInfo(
odata_type = "#microsoft.graph.participantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
application = Identity(
odata_type = "#microsoft.graph.identity",
display_name = "TestBot",
id = "dd3885da-f9ab-486b-bfae-85de3d445555",
),
),
),
targets = [
InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
user = Identity(
odata_type = "#microsoft.graph.identity",
display_name = "user1",
id = "98da8a1a-1b87-452c-a713-65d3f10b5555",
),
),
),
InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
user = Identity(
odata_type = "#microsoft.graph.identity",
display_name = "user2",
id = "bf5aae9a-d11d-47a8-93b1-782504c95555",
),
),
),
],
requested_modalities = [
Modality.Audio,
],
media_config = AppHostedMediaConfig(
odata_type = "#microsoft.graph.appHostedMediaConfig",
additional_data = {
"remove_from_default_audio_group" : False,
}
),
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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",
}
スケジュールされた会議に参加するには、スレッド ID、メッセージ ID、開催者 ID、会議がスケジュールされているテナント ID を取得する必要があります。
この情報は、 Get onlineMeeting API を 使用して取得できます。
認証トークン、コールバック URL、アプリケーション ID、アプリケーション名、ユーザー ID、ユーザー名、テナント ID の値を、 Get onlineMeeting API から取得した詳細と共に実際の値に置き換えて、サンプルを動作させる必要があります。
手記: この例では、アクセス許可が必要です Calls.JoinGroupCalls.All
。
要求
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"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new ServiceHostedMediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
PreFetchMedia = new List<MediaInfo>
{
new MediaInfo
{
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "f8971b04-b53e-418c-9222-c82ce681a582",
},
new MediaInfo
{
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 OrganizerMeetingInfo
{
OdataType = "#microsoft.graph.organizerMeetingInfo",
Organizer = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
Id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
DisplayName = "Bob",
AdditionalData = new Dictionary<string, object>
{
{
"tenantId" , "86dc81db-c112-4228-9222-63f3esaa1edb"
},
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"allowConversationWithoutHost" , true
},
},
},
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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"\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
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.NewServiceHostedMediaConfig()
mediaInfo := graphmodels.NewMediaInfo()
uri := "https://cdn.contoso.com/beep.wav"
mediaInfo.SetUri(&uri)
resourceId := "f8971b04-b53e-418c-9222-c82ce681a582"
mediaInfo.SetResourceId(&resourceId)
mediaInfo1 := graphmodels.NewMediaInfo()
uri := "https://cdn.contoso.com/cool.wav"
mediaInfo1.SetUri(&uri)
resourceId := "86dc814b-c172-4428-9112-60f8ecae1edb"
mediaInfo1.SetResourceId(&resourceId)
preFetchMedia := []graphmodels.MediaInfoable {
mediaInfo,
mediaInfo1,
}
mediaConfig.SetPreFetchMedia(preFetchMedia)
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.NewOrganizerMeetingInfo()
organizer := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
id := "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96"
user.SetId(&id)
displayName := "Bob"
user.SetDisplayName(&displayName)
additionalData := map[string]interface{}{
"tenantId" : "86dc81db-c112-4228-9222-63f3esaa1edb",
}
user.SetAdditionalData(additionalData)
organizer.SetUser(user)
meetingInfo.SetOrganizer(organizer)
additionalData := map[string]interface{}{
allowConversationWithoutHost := true
meetingInfo.SetAllowConversationWithoutHost(&allowConversationWithoutHost)
}
meetingInfo.SetAdditionalData(additionalData)
requestBody.SetMeetingInfo(meetingInfo)
tenantId := "86dc81db-c112-4228-9222-63f3esaa1edb"
requestBody.SetTenantId(&tenantId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setCallbackUri("https://bot.contoso.com/callback");
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.serviceHostedMediaConfig");
LinkedList<MediaInfo> preFetchMedia = new LinkedList<MediaInfo>();
MediaInfo mediaInfo = new MediaInfo();
mediaInfo.setUri("https://cdn.contoso.com/beep.wav");
mediaInfo.setResourceId("f8971b04-b53e-418c-9222-c82ce681a582");
preFetchMedia.add(mediaInfo);
MediaInfo mediaInfo1 = new MediaInfo();
mediaInfo1.setUri("https://cdn.contoso.com/cool.wav");
mediaInfo1.setResourceId("86dc814b-c172-4428-9112-60f8ecae1edb");
preFetchMedia.add(mediaInfo1);
mediaConfig.setPreFetchMedia(preFetchMedia);
call.setMediaConfig(mediaConfig);
ChatInfo chatInfo = new ChatInfo();
chatInfo.setOdataType("#microsoft.graph.chatInfo");
chatInfo.setThreadId("19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2");
chatInfo.setMessageId("0");
call.setChatInfo(chatInfo);
OrganizerMeetingInfo meetingInfo = new OrganizerMeetingInfo();
meetingInfo.setOdataType("#microsoft.graph.organizerMeetingInfo");
IdentitySet organizer = new IdentitySet();
organizer.setOdataType("#microsoft.graph.identitySet");
Identity user = new Identity();
user.setOdataType("#microsoft.graph.identity");
user.setId("5810cede-f3cc-42eb-b2c1-e9bd5d53ec96");
user.setDisplayName("Bob");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("tenantId", "86dc81db-c112-4228-9222-63f3esaa1edb");
user.setAdditionalData(additionalData);
organizer.setUser(user);
meetingInfo.setOrganizer(organizer);
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("allowConversationWithoutHost", true);
meetingInfo.setAdditionalData(additionalData1);
call.setMeetingInfo(meetingInfo);
call.setTenantId("86dc81db-c112-4228-9222-63f3esaa1edb");
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\ServiceHostedMediaConfig;
use Microsoft\Graph\Generated\Models\MediaInfo;
use Microsoft\Graph\Generated\Models\ChatInfo;
use Microsoft\Graph\Generated\Models\OrganizerMeetingInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$requestBody->setRequestedModalities([new Modality('audio'), ]);
$mediaConfig = new ServiceHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.serviceHostedMediaConfig');
$preFetchMediaMediaInfo1 = new MediaInfo();
$preFetchMediaMediaInfo1->setUri('https://cdn.contoso.com/beep.wav');
$preFetchMediaMediaInfo1->setResourceId('f8971b04-b53e-418c-9222-c82ce681a582');
$preFetchMediaArray []= $preFetchMediaMediaInfo1;
$preFetchMediaMediaInfo2 = new MediaInfo();
$preFetchMediaMediaInfo2->setUri('https://cdn.contoso.com/cool.wav');
$preFetchMediaMediaInfo2->setResourceId('86dc814b-c172-4428-9112-60f8ecae1edb');
$preFetchMediaArray []= $preFetchMediaMediaInfo2;
$mediaConfig->setPreFetchMedia($preFetchMediaArray);
$requestBody->setMediaConfig($mediaConfig);
$chatInfo = new ChatInfo();
$chatInfo->setOdataType('#microsoft.graph.chatInfo');
$chatInfo->setThreadId('19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2');
$chatInfo->setMessageId('0');
$requestBody->setChatInfo($chatInfo);
$meetingInfo = new OrganizerMeetingInfo();
$meetingInfo->setOdataType('#microsoft.graph.organizerMeetingInfo');
$meetingInfoOrganizer = new IdentitySet();
$meetingInfoOrganizer->setOdataType('#microsoft.graph.identitySet');
$meetingInfoOrganizerUser = new Identity();
$meetingInfoOrganizerUser->setOdataType('#microsoft.graph.identity');
$meetingInfoOrganizerUser->setId('5810cede-f3cc-42eb-b2c1-e9bd5d53ec96');
$meetingInfoOrganizerUser->setDisplayName('Bob');
$additionalData = [
'tenantId' => '86dc81db-c112-4228-9222-63f3esaa1edb',
];
$meetingInfoOrganizerUser->setAdditionalData($additionalData);
$meetingInfoOrganizer->setUser($meetingInfoOrganizerUser);
$meetingInfo->setOrganizer($meetingInfoOrganizer);
$additionalData = [
'allowConversationWithoutHost' => true,
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('86dc81db-c112-4228-9222-63f3esaa1edb');
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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 = @(
@{
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"
}
New-MgCommunicationCall -BodyParameter $params
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.service_hosted_media_config import ServiceHostedMediaConfig
from msgraph.generated.models.media_info import MediaInfo
from msgraph.generated.models.chat_info import ChatInfo
from msgraph.generated.models.organizer_meeting_info import OrganizerMeetingInfo
from msgraph.generated.models.identity_set import IdentitySet
from msgraph.generated.models.identity import Identity
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
callback_uri = "https://bot.contoso.com/callback",
requested_modalities = [
Modality.Audio,
],
media_config = ServiceHostedMediaConfig(
odata_type = "#microsoft.graph.serviceHostedMediaConfig",
pre_fetch_media = [
MediaInfo(
uri = "https://cdn.contoso.com/beep.wav",
resource_id = "f8971b04-b53e-418c-9222-c82ce681a582",
),
MediaInfo(
uri = "https://cdn.contoso.com/cool.wav",
resource_id = "86dc814b-c172-4428-9112-60f8ecae1edb",
),
],
),
chat_info = ChatInfo(
odata_type = "#microsoft.graph.chatInfo",
thread_id = "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
message_id = "0",
),
meeting_info = OrganizerMeetingInfo(
odata_type = "#microsoft.graph.organizerMeetingInfo",
organizer = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
user = Identity(
odata_type = "#microsoft.graph.identity",
id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
display_name = "Bob",
additional_data = {
"tenant_id" : "86dc81db-c112-4228-9222-63f3esaa1edb",
}
),
),
additional_data = {
"allow_conversation_without_host" : True,
}
),
tenant_id = "86dc81db-c112-4228-9222-63f3esaa1edb",
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
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
}
通知 - 確立
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"
}
}
]
}
手記: 通話の確立/確立された通知が順番に届く可能性があります。
通知 - 確立済み
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"
}
}
]
}
手記: 通話の確立/確立された通知が順番に届く可能性があります。
通知 - 名簿
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"
}
]
}
]
}
Delta 名簿が有効
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resource": "/app/calls/421f7700-f4ad-4ea9-a3fc-c1d2195675ad/participants",
"resourceUrl": "/communications/calls/421f7700-f4ad-4ea9-a3fc-c1d2195675ad/participants",
"resourceData": [
{
"@odata.type": "#microsoft.graph.deltaParticipants",
"participants": [
{
"@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",
"rosterSequenceNumber": 1
},
{
"@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",
"rosterSequenceNumber": 1,
"removedState": {
"reason": "Removed from roster"
}
}
],
"sequenceNumber": 1
}
]
}
]
}
手記: 通話状態通知以外の会議に参加するシナリオでは、名簿通知を受け取ります。
次の例に示すように、メディア構成を appHostedMediaConfig で更新します。
要求
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"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
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 AppHostedMediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
},
ChatInfo = new ChatInfo
{
OdataType = "#microsoft.graph.chatInfo",
ThreadId = "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
MessageId = "0",
},
MeetingInfo = new OrganizerMeetingInfo
{
OdataType = "#microsoft.graph.organizerMeetingInfo",
Organizer = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
Id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
DisplayName = "Bob",
AdditionalData = new Dictionary<string, object>
{
{
"tenantId" , "aa67bd4c-8475-432d-bd41-39f255720e0a"
},
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"allowConversationWithoutHost" , true
},
},
},
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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"\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
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.NewAppHostedMediaConfig()
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.NewOrganizerMeetingInfo()
organizer := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
id := "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96"
user.SetId(&id)
displayName := "Bob"
user.SetDisplayName(&displayName)
additionalData := map[string]interface{}{
"tenantId" : "aa67bd4c-8475-432d-bd41-39f255720e0a",
}
user.SetAdditionalData(additionalData)
organizer.SetUser(user)
meetingInfo.SetOrganizer(organizer)
additionalData := map[string]interface{}{
allowConversationWithoutHost := true
meetingInfo.SetAllowConversationWithoutHost(&allowConversationWithoutHost)
}
meetingInfo.SetAdditionalData(additionalData)
requestBody.SetMeetingInfo(meetingInfo)
tenantId := "aa67bd4c-8475-432d-bd41-39f255720e0a"
requestBody.SetTenantId(&tenantId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setDirection(CallDirection.Outgoing);
call.setCallbackUri("https://bot.contoso.com/callback");
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
AppHostedMediaConfig mediaConfig = new AppHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.appHostedMediaConfig");
call.setMediaConfig(mediaConfig);
ChatInfo chatInfo = new ChatInfo();
chatInfo.setOdataType("#microsoft.graph.chatInfo");
chatInfo.setThreadId("19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2");
chatInfo.setMessageId("0");
call.setChatInfo(chatInfo);
OrganizerMeetingInfo meetingInfo = new OrganizerMeetingInfo();
meetingInfo.setOdataType("#microsoft.graph.organizerMeetingInfo");
IdentitySet organizer = new IdentitySet();
organizer.setOdataType("#microsoft.graph.identitySet");
Identity user = new Identity();
user.setOdataType("#microsoft.graph.identity");
user.setId("5810cede-f3cc-42eb-b2c1-e9bd5d53ec96");
user.setDisplayName("Bob");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("tenantId", "aa67bd4c-8475-432d-bd41-39f255720e0a");
user.setAdditionalData(additionalData);
organizer.setUser(user);
meetingInfo.setOrganizer(organizer);
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("allowConversationWithoutHost", true);
meetingInfo.setAdditionalData(additionalData1);
call.setMeetingInfo(meetingInfo);
call.setTenantId("aa67bd4c-8475-432d-bd41-39f255720e0a");
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\CallDirection;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\AppHostedMediaConfig;
use Microsoft\Graph\Generated\Models\ChatInfo;
use Microsoft\Graph\Generated\Models\OrganizerMeetingInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#microsoft.graph.call');
$requestBody->setDirection(new CallDirection('outgoing'));
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$requestBody->setRequestedModalities([new Modality('audio'), ]);
$mediaConfig = new AppHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.appHostedMediaConfig');
$requestBody->setMediaConfig($mediaConfig);
$chatInfo = new ChatInfo();
$chatInfo->setOdataType('#microsoft.graph.chatInfo');
$chatInfo->setThreadId('19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2');
$chatInfo->setMessageId('0');
$requestBody->setChatInfo($chatInfo);
$meetingInfo = new OrganizerMeetingInfo();
$meetingInfo->setOdataType('#microsoft.graph.organizerMeetingInfo');
$meetingInfoOrganizer = new IdentitySet();
$meetingInfoOrganizer->setOdataType('#microsoft.graph.identitySet');
$meetingInfoOrganizerUser = new Identity();
$meetingInfoOrganizerUser->setOdataType('#microsoft.graph.identity');
$meetingInfoOrganizerUser->setId('5810cede-f3cc-42eb-b2c1-e9bd5d53ec96');
$meetingInfoOrganizerUser->setDisplayName('Bob');
$additionalData = [
'tenantId' => 'aa67bd4c-8475-432d-bd41-39f255720e0a',
];
$meetingInfoOrganizerUser->setAdditionalData($additionalData);
$meetingInfoOrganizer->setUser($meetingInfoOrganizerUser);
$meetingInfo->setOrganizer($meetingInfoOrganizer);
$additionalData = [
'allowConversationWithoutHost' => true,
];
$meetingInfo->setAdditionalData($additionalData);
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.call_direction import CallDirection
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.app_hosted_media_config import AppHostedMediaConfig
from msgraph.generated.models.chat_info import ChatInfo
from msgraph.generated.models.organizer_meeting_info import OrganizerMeetingInfo
from msgraph.generated.models.identity_set import IdentitySet
from msgraph.generated.models.identity import Identity
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
direction = CallDirection.Outgoing,
callback_uri = "https://bot.contoso.com/callback",
requested_modalities = [
Modality.Audio,
],
media_config = AppHostedMediaConfig(
odata_type = "#microsoft.graph.appHostedMediaConfig",
),
chat_info = ChatInfo(
odata_type = "#microsoft.graph.chatInfo",
thread_id = "19:meeting_Win6Ydo4wsMijFjZS00ZGVjLTk5MGUtOTRjNWY2NmNkYTFm@thread.v2",
message_id = "0",
),
meeting_info = OrganizerMeetingInfo(
odata_type = "#microsoft.graph.organizerMeetingInfo",
organizer = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
user = Identity(
odata_type = "#microsoft.graph.identity",
id = "5810cede-f3cc-42eb-b2c1-e9bd5d53ec96",
display_name = "Bob",
additional_data = {
"tenant_id" : "aa67bd4c-8475-432d-bd41-39f255720e0a",
}
),
),
additional_data = {
"allow_conversation_without_host" : True,
}
),
tenant_id = "aa67bd4c-8475-432d-bd41-39f255720e0a",
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
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
}
例 7: joinMeetingId とパスコードを使用してスケジュールされた会議に参加する
次に、既存の会議に 参加するために joinMeetingId と パスコード を必要とする例を示します。 これらのプロパティは、 Get onlineMeeting API から取得できます。
要求
次の例は要求を示しています。
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"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new ServiceHostedMediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
PreFetchMedia = new List<MediaInfo>
{
new MediaInfo
{
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "f8971b04-b53e-418c-9222-c82ce681a582",
},
new MediaInfo
{
Uri = "https://cdn.contoso.com/cool.wav",
ResourceId = "86dc814b-c172-4428-9112-60f8ecae1edb",
},
},
},
MeetingInfo = new JoinMeetingIdMeetingInfo
{
OdataType = "#microsoft.graph.joinMeetingIdMeetingInfo",
JoinMeetingId = "1234567",
Passcode = "psw123",
},
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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"\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
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.NewServiceHostedMediaConfig()
mediaInfo := graphmodels.NewMediaInfo()
uri := "https://cdn.contoso.com/beep.wav"
mediaInfo.SetUri(&uri)
resourceId := "f8971b04-b53e-418c-9222-c82ce681a582"
mediaInfo.SetResourceId(&resourceId)
mediaInfo1 := graphmodels.NewMediaInfo()
uri := "https://cdn.contoso.com/cool.wav"
mediaInfo1.SetUri(&uri)
resourceId := "86dc814b-c172-4428-9112-60f8ecae1edb"
mediaInfo1.SetResourceId(&resourceId)
preFetchMedia := []graphmodels.MediaInfoable {
mediaInfo,
mediaInfo1,
}
mediaConfig.SetPreFetchMedia(preFetchMedia)
requestBody.SetMediaConfig(mediaConfig)
meetingInfo := graphmodels.NewJoinMeetingIdMeetingInfo()
joinMeetingId := "1234567"
meetingInfo.SetJoinMeetingId(&joinMeetingId)
passcode := "psw123"
meetingInfo.SetPasscode(&passcode)
requestBody.SetMeetingInfo(meetingInfo)
tenantId := "86dc81db-c112-4228-9222-63f3esaa1edb"
requestBody.SetTenantId(&tenantId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setCallbackUri("https://bot.contoso.com/callback");
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.serviceHostedMediaConfig");
LinkedList<MediaInfo> preFetchMedia = new LinkedList<MediaInfo>();
MediaInfo mediaInfo = new MediaInfo();
mediaInfo.setUri("https://cdn.contoso.com/beep.wav");
mediaInfo.setResourceId("f8971b04-b53e-418c-9222-c82ce681a582");
preFetchMedia.add(mediaInfo);
MediaInfo mediaInfo1 = new MediaInfo();
mediaInfo1.setUri("https://cdn.contoso.com/cool.wav");
mediaInfo1.setResourceId("86dc814b-c172-4428-9112-60f8ecae1edb");
preFetchMedia.add(mediaInfo1);
mediaConfig.setPreFetchMedia(preFetchMedia);
call.setMediaConfig(mediaConfig);
JoinMeetingIdMeetingInfo meetingInfo = new JoinMeetingIdMeetingInfo();
meetingInfo.setOdataType("#microsoft.graph.joinMeetingIdMeetingInfo");
meetingInfo.setJoinMeetingId("1234567");
meetingInfo.setPasscode("psw123");
call.setMeetingInfo(meetingInfo);
call.setTenantId("86dc81db-c112-4228-9222-63f3esaa1edb");
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\ServiceHostedMediaConfig;
use Microsoft\Graph\Generated\Models\MediaInfo;
use Microsoft\Graph\Generated\Models\JoinMeetingIdMeetingInfo;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$requestBody->setRequestedModalities([new Modality('audio'), ]);
$mediaConfig = new ServiceHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.serviceHostedMediaConfig');
$preFetchMediaMediaInfo1 = new MediaInfo();
$preFetchMediaMediaInfo1->setUri('https://cdn.contoso.com/beep.wav');
$preFetchMediaMediaInfo1->setResourceId('f8971b04-b53e-418c-9222-c82ce681a582');
$preFetchMediaArray []= $preFetchMediaMediaInfo1;
$preFetchMediaMediaInfo2 = new MediaInfo();
$preFetchMediaMediaInfo2->setUri('https://cdn.contoso.com/cool.wav');
$preFetchMediaMediaInfo2->setResourceId('86dc814b-c172-4428-9112-60f8ecae1edb');
$preFetchMediaArray []= $preFetchMediaMediaInfo2;
$mediaConfig->setPreFetchMedia($preFetchMediaArray);
$requestBody->setMediaConfig($mediaConfig);
$meetingInfo = new JoinMeetingIdMeetingInfo();
$meetingInfo->setOdataType('#microsoft.graph.joinMeetingIdMeetingInfo');
$meetingInfo->setJoinMeetingId('1234567');
$meetingInfo->setPasscode('psw123');
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('86dc81db-c112-4228-9222-63f3esaa1edb');
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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 = @(
@{
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"
}
New-MgCommunicationCall -BodyParameter $params
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.service_hosted_media_config import ServiceHostedMediaConfig
from msgraph.generated.models.media_info import MediaInfo
from msgraph.generated.models.join_meeting_id_meeting_info import JoinMeetingIdMeetingInfo
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
callback_uri = "https://bot.contoso.com/callback",
requested_modalities = [
Modality.Audio,
],
media_config = ServiceHostedMediaConfig(
odata_type = "#microsoft.graph.serviceHostedMediaConfig",
pre_fetch_media = [
MediaInfo(
uri = "https://cdn.contoso.com/beep.wav",
resource_id = "f8971b04-b53e-418c-9222-c82ce681a582",
),
MediaInfo(
uri = "https://cdn.contoso.com/cool.wav",
resource_id = "86dc814b-c172-4428-9112-60f8ecae1edb",
),
],
),
meeting_info = JoinMeetingIdMeetingInfo(
odata_type = "#microsoft.graph.joinMeetingIdMeetingInfo",
join_meeting_id = "1234567",
passcode = "psw123",
),
tenant_id = "86dc81db-c112-4228-9222-63f3esaa1edb",
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
次の例は応答を示しています。
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
}
例 8: joinMeetingId を使用してスケジュールされた会議に参加する
次の例は、 joinMeetingId を必要とするが、既存の会議に参加するために パスコード を必要としない例を示しています。
get onlineMeeting API から joinMeetingId プロパティを取得 できます。
要求
次の例は要求を示しています。
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"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new Call
{
OdataType = "#microsoft.graph.call",
CallbackUri = "https://bot.contoso.com/callback",
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new ServiceHostedMediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
PreFetchMedia = new List<MediaInfo>
{
new MediaInfo
{
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "f8971b04-b53e-418c-9222-c82ce681a582",
},
new MediaInfo
{
Uri = "https://cdn.contoso.com/cool.wav",
ResourceId = "86dc814b-c172-4428-9112-60f8ecae1edb",
},
},
},
MeetingInfo = new JoinMeetingIdMeetingInfo
{
OdataType = "#microsoft.graph.joinMeetingIdMeetingInfo",
JoinMeetingId = "1234567",
Passcode = null,
},
TenantId = "86dc81db-c112-4228-9222-63f3esaa1edb",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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"\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
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.NewServiceHostedMediaConfig()
mediaInfo := graphmodels.NewMediaInfo()
uri := "https://cdn.contoso.com/beep.wav"
mediaInfo.SetUri(&uri)
resourceId := "f8971b04-b53e-418c-9222-c82ce681a582"
mediaInfo.SetResourceId(&resourceId)
mediaInfo1 := graphmodels.NewMediaInfo()
uri := "https://cdn.contoso.com/cool.wav"
mediaInfo1.SetUri(&uri)
resourceId := "86dc814b-c172-4428-9112-60f8ecae1edb"
mediaInfo1.SetResourceId(&resourceId)
preFetchMedia := []graphmodels.MediaInfoable {
mediaInfo,
mediaInfo1,
}
mediaConfig.SetPreFetchMedia(preFetchMedia)
requestBody.SetMediaConfig(mediaConfig)
meetingInfo := graphmodels.NewJoinMeetingIdMeetingInfo()
joinMeetingId := "1234567"
meetingInfo.SetJoinMeetingId(&joinMeetingId)
passcode := null
meetingInfo.SetPasscode(&passcode)
requestBody.SetMeetingInfo(meetingInfo)
tenantId := "86dc81db-c112-4228-9222-63f3esaa1edb"
requestBody.SetTenantId(&tenantId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setCallbackUri("https://bot.contoso.com/callback");
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.serviceHostedMediaConfig");
LinkedList<MediaInfo> preFetchMedia = new LinkedList<MediaInfo>();
MediaInfo mediaInfo = new MediaInfo();
mediaInfo.setUri("https://cdn.contoso.com/beep.wav");
mediaInfo.setResourceId("f8971b04-b53e-418c-9222-c82ce681a582");
preFetchMedia.add(mediaInfo);
MediaInfo mediaInfo1 = new MediaInfo();
mediaInfo1.setUri("https://cdn.contoso.com/cool.wav");
mediaInfo1.setResourceId("86dc814b-c172-4428-9112-60f8ecae1edb");
preFetchMedia.add(mediaInfo1);
mediaConfig.setPreFetchMedia(preFetchMedia);
call.setMediaConfig(mediaConfig);
JoinMeetingIdMeetingInfo meetingInfo = new JoinMeetingIdMeetingInfo();
meetingInfo.setOdataType("#microsoft.graph.joinMeetingIdMeetingInfo");
meetingInfo.setJoinMeetingId("1234567");
meetingInfo.setPasscode(null);
call.setMeetingInfo(meetingInfo);
call.setTenantId("86dc81db-c112-4228-9222-63f3esaa1edb");
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\ServiceHostedMediaConfig;
use Microsoft\Graph\Generated\Models\MediaInfo;
use Microsoft\Graph\Generated\Models\JoinMeetingIdMeetingInfo;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$requestBody->setRequestedModalities([new Modality('audio'), ]);
$mediaConfig = new ServiceHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.serviceHostedMediaConfig');
$preFetchMediaMediaInfo1 = new MediaInfo();
$preFetchMediaMediaInfo1->setUri('https://cdn.contoso.com/beep.wav');
$preFetchMediaMediaInfo1->setResourceId('f8971b04-b53e-418c-9222-c82ce681a582');
$preFetchMediaArray []= $preFetchMediaMediaInfo1;
$preFetchMediaMediaInfo2 = new MediaInfo();
$preFetchMediaMediaInfo2->setUri('https://cdn.contoso.com/cool.wav');
$preFetchMediaMediaInfo2->setResourceId('86dc814b-c172-4428-9112-60f8ecae1edb');
$preFetchMediaArray []= $preFetchMediaMediaInfo2;
$mediaConfig->setPreFetchMedia($preFetchMediaArray);
$requestBody->setMediaConfig($mediaConfig);
$meetingInfo = new JoinMeetingIdMeetingInfo();
$meetingInfo->setOdataType('#microsoft.graph.joinMeetingIdMeetingInfo');
$meetingInfo->setJoinMeetingId('1234567');
$meetingInfo->setPasscode(null);
$requestBody->setMeetingInfo($meetingInfo);
$requestBody->setTenantId('86dc81db-c112-4228-9222-63f3esaa1edb');
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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 = @(
@{
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"
}
New-MgCommunicationCall -BodyParameter $params
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.service_hosted_media_config import ServiceHostedMediaConfig
from msgraph.generated.models.media_info import MediaInfo
from msgraph.generated.models.join_meeting_id_meeting_info import JoinMeetingIdMeetingInfo
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
callback_uri = "https://bot.contoso.com/callback",
requested_modalities = [
Modality.Audio,
],
media_config = ServiceHostedMediaConfig(
odata_type = "#microsoft.graph.serviceHostedMediaConfig",
pre_fetch_media = [
MediaInfo(
uri = "https://cdn.contoso.com/beep.wav",
resource_id = "f8971b04-b53e-418c-9222-c82ce681a582",
),
MediaInfo(
uri = "https://cdn.contoso.com/cool.wav",
resource_id = "86dc814b-c172-4428-9112-60f8ecae1edb",
),
],
),
meeting_info = JoinMeetingIdMeetingInfo(
odata_type = "#microsoft.graph.joinMeetingIdMeetingInfo",
join_meeting_id = "1234567",
passcode = None,
),
tenant_id = "86dc81db-c112-4228-9222-63f3esaa1edb",
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
次の例は応答を示しています。
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
}
手記: この呼び出しには、Calls.Initiate.All アクセス許可が必要です。
この呼び出しには、PSTN 番号が割り当てられたアプリケーション インスタンスが必要です。 詳細については、「 ボットに電話番号を割り当てる 」を参照してください。
要求
次の例は、ボットと PSTN 番号の間でピアツーピア呼び出しを行う要求を示しています。 この例では、メディアはサービスによってホストされます。 認証トークン、コールバック URL、アプリケーション インスタンス ID、アプリケーション インスタンスの表示名、電話 ID、テナント ID の値を実際の値に置き換えて、サンプルを機能させる必要があります。
手記: アプリケーション インスタンス ID は、アプリケーション インスタンスのオブジェクト ID です。 アプリケーション インスタンスがリンクするアプリケーション ID は、承認トークン内のアプリケーション ID と一致する必要があります。 電話番号 ID は、E.164 形式の電話番号です。
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"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
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 Identity
{
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 Identity
{
OdataType = "#microsoft.graph.identity",
Id = "+12345678901",
}
},
},
},
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new ServiceHostedMediaConfig
{
OdataType = "#microsoft.graph.serviceHostedMediaConfig",
},
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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"\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewCall()
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
source := graphmodels.NewParticipantInfo()
identity := graphmodels.NewIdentitySet()
additionalData := map[string]interface{}{
applicationInstance := graphmodels.NewIdentity()
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.NewIdentity()
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.NewServiceHostedMediaConfig()
requestBody.SetMediaConfig(mediaConfig)
tenantId := "aa67bd4c-8475-432d-bd41-39f255720e0a"
requestBody.SetTenantId(&tenantId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setCallbackUri("https://bot.contoso.com/callback");
ParticipantInfo source = new ParticipantInfo();
source.setOdataType("#microsoft.graph.participantInfo");
IdentitySet identity = new IdentitySet();
identity.setOdataType("#microsoft.graph.identitySet");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
Identity applicationInstance = new Identity();
applicationInstance.setOdataType("#microsoft.graph.identity");
applicationInstance.setDisplayName("Calling Bot");
applicationInstance.setId("3d913abb-aec0-4964-8fa6-3c6850c4f278");
additionalData.put("applicationInstance", applicationInstance);
identity.setAdditionalData(additionalData);
source.setIdentity(identity);
source.setCountryCode(null);
source.setEndpointType(null);
source.setRegion(null);
source.setLanguageId(null);
call.setSource(source);
LinkedList<InvitationParticipantInfo> targets = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo invitationParticipantInfo = new InvitationParticipantInfo();
invitationParticipantInfo.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity1 = new IdentitySet();
identity1.setOdataType("#microsoft.graph.identitySet");
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
Identity phone = new Identity();
phone.setOdataType("#microsoft.graph.identity");
phone.setId("+12345678901");
additionalData1.put("phone", phone);
identity1.setAdditionalData(additionalData1);
invitationParticipantInfo.setIdentity(identity1);
targets.add(invitationParticipantInfo);
call.setTargets(targets);
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.serviceHostedMediaConfig");
call.setMediaConfig(mediaConfig);
call.setTenantId("aa67bd4c-8475-432d-bd41-39f255720e0a");
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\ParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\ServiceHostedMediaConfig;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$source = new ParticipantInfo();
$source->setOdataType('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->setOdataType('#microsoft.graph.identitySet');
$additionalData = [
'applicationInstance' => [
'@odata.type' => '#microsoft.graph.identity',
'displayName' => 'Calling Bot',
'id' => '3d913abb-aec0-4964-8fa6-3c6850c4f278',
],
];
$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->setOdataType('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->setOdataType('#microsoft.graph.identitySet');
$additionalData = [
'phone' => [
'@odata.type' => '#microsoft.graph.identity',
'id' => '+12345678901',
],
];
$targetsInvitationParticipantInfo1Identity->setAdditionalData($additionalData);
$targetsInvitationParticipantInfo1->setIdentity($targetsInvitationParticipantInfo1Identity);
$targetsArray []= $targetsInvitationParticipantInfo1;
$requestBody->setTargets($targetsArray);
$requestBody->setRequestedModalities([new Modality('audio'),]);
$mediaConfig = new ServiceHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.serviceHostedMediaConfig');
$requestBody->setMediaConfig($mediaConfig);
$requestBody->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.participant_info import ParticipantInfo
from msgraph.generated.models.identity_set import IdentitySet
from msgraph.generated.models.identity import Identity
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.service_hosted_media_config import ServiceHostedMediaConfig
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
callback_uri = "https://bot.contoso.com/callback",
source = ParticipantInfo(
odata_type = "#microsoft.graph.participantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
additional_data = {
"application_instance" : {
"@odata_type" : "#microsoft.graph.identity",
"display_name" : "Calling Bot",
"id" : "3d913abb-aec0-4964-8fa6-3c6850c4f278",
},
}
),
country_code = None,
endpoint_type = None,
region = None,
language_id = None,
),
targets = [
InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
additional_data = {
"phone" : {
"@odata_type" : "#microsoft.graph.identity",
"id" : "+12345678901",
},
}
),
),
],
requested_modalities = [
Modality.Audio,
],
media_config = ServiceHostedMediaConfig(
odata_type = "#microsoft.graph.serviceHostedMediaConfig",
),
tenant_id = "aa67bd4c-8475-432d-bd41-39f255720e0a",
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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
}
注 : この例では、Calls.Initiate.All および Calls.AccessMedia.All のアクセス許可が必要です。
この呼び出しには、PSTN 番号が割り当てられたアプリケーション インスタンスが必要です。 詳細については、「 ボットに電話番号を割り当てる 」を参照してください。
要求
次の例は、ボットと PSTN 番号の間でピアツーピア呼び出しを行う要求を示しています。 この例では、メディアはアプリケーションによってローカルでホストされます。 認証トークン、コールバック URL、アプリケーション インスタンス ID、アプリケーション インスタンスの表示名、電話 ID、テナント ID の値を実際の値に置き換えて、サンプルを機能させる必要があります。
手記: アプリケーション インスタンス ID は、アプリケーション インスタンスのオブジェクト ID です。 アプリケーション インスタンスがリンクするアプリケーション ID は、承認トークン内のアプリケーション ID と一致する必要があります。 電話番号 ID は、E.164 形式の電話番号です。
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"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
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 Identity
{
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 Identity
{
OdataType = "#microsoft.graph.identity",
Id = "+12345678901",
}
},
},
},
},
},
RequestedModalities = new List<Modality?>
{
Modality.Audio,
},
MediaConfig = new AppHostedMediaConfig
{
OdataType = "#microsoft.graph.appHostedMediaConfig",
Blob = "<Media Session Configuration>",
},
TenantId = "aa67bd4c-8475-432d-bd41-39f255720e0a",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls.PostAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc communications calls create --body '{\
"@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"\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewCall()
callbackUri := "https://bot.contoso.com/callback"
requestBody.SetCallbackUri(&callbackUri)
source := graphmodels.NewParticipantInfo()
identity := graphmodels.NewIdentitySet()
additionalData := map[string]interface{}{
applicationInstance := graphmodels.NewIdentity()
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.NewIdentity()
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.NewAppHostedMediaConfig()
blob := "<Media Session Configuration>"
mediaConfig.SetBlob(&blob)
requestBody.SetMediaConfig(mediaConfig)
tenantId := "aa67bd4c-8475-432d-bd41-39f255720e0a"
requestBody.SetTenantId(&tenantId)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calls, err := graphClient.Communications().Calls().Post(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Call call = new Call();
call.setOdataType("#microsoft.graph.call");
call.setCallbackUri("https://bot.contoso.com/callback");
ParticipantInfo source = new ParticipantInfo();
source.setOdataType("#microsoft.graph.participantInfo");
IdentitySet identity = new IdentitySet();
identity.setOdataType("#microsoft.graph.identitySet");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
Identity applicationInstance = new Identity();
applicationInstance.setOdataType("#microsoft.graph.identity");
applicationInstance.setDisplayName("Calling Bot");
applicationInstance.setId("3d913abb-aec0-4964-8fa6-3c6850c4f278");
additionalData.put("applicationInstance", applicationInstance);
identity.setAdditionalData(additionalData);
source.setIdentity(identity);
source.setCountryCode(null);
source.setEndpointType(null);
source.setRegion(null);
source.setLanguageId(null);
call.setSource(source);
LinkedList<InvitationParticipantInfo> targets = new LinkedList<InvitationParticipantInfo>();
InvitationParticipantInfo invitationParticipantInfo = new InvitationParticipantInfo();
invitationParticipantInfo.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity1 = new IdentitySet();
identity1.setOdataType("#microsoft.graph.identitySet");
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
Identity phone = new Identity();
phone.setOdataType("#microsoft.graph.identity");
phone.setId("+12345678901");
additionalData1.put("phone", phone);
identity1.setAdditionalData(additionalData1);
invitationParticipantInfo.setIdentity(identity1);
targets.add(invitationParticipantInfo);
call.setTargets(targets);
LinkedList<Modality> requestedModalities = new LinkedList<Modality>();
requestedModalities.add(Modality.Audio);
call.setRequestedModalities(requestedModalities);
AppHostedMediaConfig mediaConfig = new AppHostedMediaConfig();
mediaConfig.setOdataType("#microsoft.graph.appHostedMediaConfig");
mediaConfig.setBlob("<Media Session Configuration>");
call.setMediaConfig(mediaConfig);
call.setTenantId("aa67bd4c-8475-432d-bd41-39f255720e0a");
Call result = graphClient.communications().calls().post(call);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Call;
use Microsoft\Graph\Generated\Models\ParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\Modality;
use Microsoft\Graph\Generated\Models\AppHostedMediaConfig;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Call();
$requestBody->setOdataType('#microsoft.graph.call');
$requestBody->setCallbackUri('https://bot.contoso.com/callback');
$source = new ParticipantInfo();
$source->setOdataType('#microsoft.graph.participantInfo');
$sourceIdentity = new IdentitySet();
$sourceIdentity->setOdataType('#microsoft.graph.identitySet');
$additionalData = [
'applicationInstance' => [
'@odata.type' => '#microsoft.graph.identity',
'displayName' => 'Calling Bot',
'id' => '3d913abb-aec0-4964-8fa6-3c6850c4f278',
],
];
$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->setOdataType('#microsoft.graph.invitationParticipantInfo');
$targetsInvitationParticipantInfo1Identity = new IdentitySet();
$targetsInvitationParticipantInfo1Identity->setOdataType('#microsoft.graph.identitySet');
$additionalData = [
'phone' => [
'@odata.type' => '#microsoft.graph.identity',
'id' => '+12345678901',
],
];
$targetsInvitationParticipantInfo1Identity->setAdditionalData($additionalData);
$targetsInvitationParticipantInfo1->setIdentity($targetsInvitationParticipantInfo1Identity);
$targetsArray []= $targetsInvitationParticipantInfo1;
$requestBody->setTargets($targetsArray);
$requestBody->setRequestedModalities([new Modality('audio'),]);
$mediaConfig = new AppHostedMediaConfig();
$mediaConfig->setOdataType('#microsoft.graph.appHostedMediaConfig');
$mediaConfig->setBlob('<Media Session Configuration>');
$requestBody->setMediaConfig($mediaConfig);
$requestBody->setTenantId('aa67bd4c-8475-432d-bd41-39f255720e0a');
$result = $graphServiceClient->communications()->calls()->post($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
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
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.call import Call
from msgraph.generated.models.participant_info import ParticipantInfo
from msgraph.generated.models.identity_set import IdentitySet
from msgraph.generated.models.identity import Identity
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
from msgraph.generated.models.modality import Modality
from msgraph.generated.models.app_hosted_media_config import AppHostedMediaConfig
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Call(
odata_type = "#microsoft.graph.call",
callback_uri = "https://bot.contoso.com/callback",
source = ParticipantInfo(
odata_type = "#microsoft.graph.participantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
additional_data = {
"application_instance" : {
"@odata_type" : "#microsoft.graph.identity",
"display_name" : "Calling Bot",
"id" : "3d913abb-aec0-4964-8fa6-3c6850c4f278",
},
}
),
country_code = None,
endpoint_type = None,
region = None,
language_id = None,
),
targets = [
InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
additional_data = {
"phone" : {
"@odata_type" : "#microsoft.graph.identity",
"id" : "+12345678901",
},
}
),
),
],
requested_modalities = [
Modality.Audio,
],
media_config = AppHostedMediaConfig(
odata_type = "#microsoft.graph.appHostedMediaConfig",
blob = "<Media Session Configuration>",
),
tenant_id = "aa67bd4c-8475-432d-bd41-39f255720e0a",
)
result = await graph_client.communications.calls.post(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
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
}