Namespace: microsoft.graph
Transfer an active peer-to-peer call or group call.
Note: This is only supported if both the transferee and transfer target are Microsoft Teams users that belong to the same tenant. Transfer to PSTN number is supported only for application instance. To learn more about transferor, transferee and transfer target, see RFC 5589.
A consultative transfer means that the transferor can inform the person they want to transfer the call to (the transferee), before the transfer is made. This is opposed to transfering the call directly.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
✅ |
✅ |
❌ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
Not supported. |
Not supported. |
Delegated (personal Microsoft account) |
Not supported. |
Not supported. |
Application |
Calls.Initiate.All |
Not available. |
HTTP request
POST /communications/calls/{id}/transfer
Request body
In the request body, provide a JSON object with the following parameters.
Parameter |
Type |
Description |
transferTarget |
invitationParticipantInfo |
The participant which is the target of the transfer. |
transferee |
participantInfo |
The participant which is the transferee of the transfer. It is only needed when transfer from a group call. |
Response
If successful, this method returns a 202 Accepted
response code.
Examples
These examples show the flow of an incoming call all the way to the different types of transfer notifications.
Example 1: Call transfer from a peer-to-peer call
Request
The following example shows the request.
POST https://graph.microsoft.com/v1.0/communications/calls/{id}/transfer
Content-Type: application/json
Content-Length: 430
{
"transferTarget": {
"endpointType": "default",
"identity": {
"user": {
"id": "550fae72-d251-43ec-868c-373732c2704f",
"displayName": "Heidi Steen"
}
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.Calls.Item.Transfer;
using Microsoft.Graph.Models;
var requestBody = new TransferPostRequestBody
{
TransferTarget = new InvitationParticipantInfo
{
Identity = new IdentitySet
{
User = new Identity
{
Id = "550fae72-d251-43ec-868c-373732c2704f",
DisplayName = "Heidi Steen",
},
},
AdditionalData = new Dictionary<string, object>
{
{
"endpointType" , "default"
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Communications.Calls["{call-id}"].Transfer.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc communications calls transfer post --call-id {call-id} --body '{\
"transferTarget": {\
"endpointType": "default",\
"identity": {\
"user": {\
"id": "550fae72-d251-43ec-868c-373732c2704f",\
"displayName": "Heidi Steen"\
}\
}\
}\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphcommunications "github.com/microsoftgraph/msgraph-sdk-go/communications"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphcommunications.NewTransferPostRequestBody()
transferTarget := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
id := "550fae72-d251-43ec-868c-373732c2704f"
user.SetId(&id)
displayName := "Heidi Steen"
user.SetDisplayName(&displayName)
identity.SetUser(user)
transferTarget.SetIdentity(identity)
additionalData := map[string]interface{}{
"endpointType" : "default",
}
transferTarget.SetAdditionalData(additionalData)
requestBody.SetTransferTarget(transferTarget)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Communications().Calls().ByCallId("call-id").Transfer().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody transferPostRequestBody = new com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody();
InvitationParticipantInfo transferTarget = new InvitationParticipantInfo();
IdentitySet identity = new IdentitySet();
Identity user = new Identity();
user.setId("550fae72-d251-43ec-868c-373732c2704f");
user.setDisplayName("Heidi Steen");
identity.setUser(user);
transferTarget.setIdentity(identity);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("endpointType", "default");
transferTarget.setAdditionalData(additionalData);
transferPostRequestBody.setTransferTarget(transferTarget);
graphClient.communications().calls().byCallId("{call-id}").transfer().post(transferPostRequestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const transfer = {
transferTarget: {
endpointType: 'default',
identity: {
user: {
id: '550fae72-d251-43ec-868c-373732c2704f',
displayName: 'Heidi Steen'
}
}
}
};
await client.api('/communications/calls/{id}/transfer')
.post(transfer);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\Calls\Item\Transfer\TransferPostRequestBody;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TransferPostRequestBody();
$transferTarget = new InvitationParticipantInfo();
$transferTargetIdentity = new IdentitySet();
$transferTargetIdentityUser = new Identity();
$transferTargetIdentityUser->setId('550fae72-d251-43ec-868c-373732c2704f');
$transferTargetIdentityUser->setDisplayName('Heidi Steen');
$transferTargetIdentity->setUser($transferTargetIdentityUser);
$transferTarget->setIdentity($transferTargetIdentity);
$additionalData = [
'endpointType' => 'default',
];
$transferTarget->setAdditionalData($additionalData);
$requestBody->setTransferTarget($transferTarget);
$graphServiceClient->communications()->calls()->byCallId('call-id')->transfer()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
transferTarget = @{
endpointType = "default"
identity = @{
user = @{
id = "550fae72-d251-43ec-868c-373732c2704f"
displayName = "Heidi Steen"
}
}
}
}
Move-MgCommunicationCall -CallId $callId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.calls.item.transfer.transfer_post_request_body import TransferPostRequestBody
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
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 = TransferPostRequestBody(
transfer_target = InvitationParticipantInfo(
identity = IdentitySet(
user = Identity(
id = "550fae72-d251-43ec-868c-373732c2704f",
display_name = "Heidi Steen",
),
),
additional_data = {
"endpoint_type" : "default",
}
),
)
await graph_client.communications.calls.by_call_id('call-id').transfer.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 202 Accepted
Notification - transferring
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferring"
}
}
]
}
Notification - transfer accepted
Note: Transfer accepted may happen after or before media state audio inactive.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferAccepted"
}
}
]
}
Notification - transfer completed
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "terminated",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 0,
"subcode": 7015,
"message": "GracefulTransferCompleted"
}
}
}
]
}
Notification - transfer failed
Note: When a call transfer fails, the call state will be established
.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "established",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 500,
"subCode": 7000,
"message": "<message>"
}
}
}
]
}
Example 2: Consultative transfer from a peer-to-peer call
Request
The following example shows the request.
POST https://graph.microsoft.com/v1.0/communications/calls/341a0500-d4bf-4224-8b19-1581168d328b/transfer
Content-Type: application/json
{
"transferTarget": {
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"endpointType": "default",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"user": {
"@odata.type": "#microsoft.graph.identity",
"id": "550fae72-d251-43ec-868c-373732c2704f",
"displayName": "Heidi Steen"
}
},
"replacesCallId": "e5d39592-99bd-4db8-bca8-30fb894ec51d"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.Calls.Item.Transfer;
using Microsoft.Graph.Models;
var requestBody = new TransferPostRequestBody
{
TransferTarget = new InvitationParticipantInfo
{
OdataType = "#microsoft.graph.invitationParticipantInfo",
Identity = new IdentitySet
{
OdataType = "#microsoft.graph.identitySet",
User = new Identity
{
OdataType = "#microsoft.graph.identity",
Id = "550fae72-d251-43ec-868c-373732c2704f",
DisplayName = "Heidi Steen",
},
},
ReplacesCallId = "e5d39592-99bd-4db8-bca8-30fb894ec51d",
AdditionalData = new Dictionary<string, object>
{
{
"endpointType" , "default"
},
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Communications.Calls["{call-id}"].Transfer.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc communications calls transfer post --call-id {call-id} --body '{\
"transferTarget": {\
"@odata.type": "#microsoft.graph.invitationParticipantInfo",\
"endpointType": "default",\
"identity": {\
"@odata.type": "#microsoft.graph.identitySet",\
"user": {\
"@odata.type": "#microsoft.graph.identity",\
"id": "550fae72-d251-43ec-868c-373732c2704f",\
"displayName": "Heidi Steen"\
}\
},\
"replacesCallId": "e5d39592-99bd-4db8-bca8-30fb894ec51d"\
}\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphcommunications "github.com/microsoftgraph/msgraph-sdk-go/communications"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphcommunications.NewTransferPostRequestBody()
transferTarget := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
id := "550fae72-d251-43ec-868c-373732c2704f"
user.SetId(&id)
displayName := "Heidi Steen"
user.SetDisplayName(&displayName)
identity.SetUser(user)
transferTarget.SetIdentity(identity)
replacesCallId := "e5d39592-99bd-4db8-bca8-30fb894ec51d"
transferTarget.SetReplacesCallId(&replacesCallId)
additionalData := map[string]interface{}{
"endpointType" : "default",
}
transferTarget.SetAdditionalData(additionalData)
requestBody.SetTransferTarget(transferTarget)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Communications().Calls().ByCallId("call-id").Transfer().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody transferPostRequestBody = new com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody();
InvitationParticipantInfo transferTarget = new InvitationParticipantInfo();
transferTarget.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity = new IdentitySet();
identity.setOdataType("#microsoft.graph.identitySet");
Identity user = new Identity();
user.setOdataType("#microsoft.graph.identity");
user.setId("550fae72-d251-43ec-868c-373732c2704f");
user.setDisplayName("Heidi Steen");
identity.setUser(user);
transferTarget.setIdentity(identity);
transferTarget.setReplacesCallId("e5d39592-99bd-4db8-bca8-30fb894ec51d");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("endpointType", "default");
transferTarget.setAdditionalData(additionalData);
transferPostRequestBody.setTransferTarget(transferTarget);
graphClient.communications().calls().byCallId("{call-id}").transfer().post(transferPostRequestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const transfer = {
transferTarget: {
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
endpointType: 'default',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
id: '550fae72-d251-43ec-868c-373732c2704f',
displayName: 'Heidi Steen'
}
},
replacesCallId: 'e5d39592-99bd-4db8-bca8-30fb894ec51d'
}
};
await client.api('/communications/calls/341a0500-d4bf-4224-8b19-1581168d328b/transfer')
.post(transfer);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\Calls\Item\Transfer\TransferPostRequestBody;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TransferPostRequestBody();
$transferTarget = new InvitationParticipantInfo();
$transferTarget->setOdataType('#microsoft.graph.invitationParticipantInfo');
$transferTargetIdentity = new IdentitySet();
$transferTargetIdentity->setOdataType('#microsoft.graph.identitySet');
$transferTargetIdentityUser = new Identity();
$transferTargetIdentityUser->setOdataType('#microsoft.graph.identity');
$transferTargetIdentityUser->setId('550fae72-d251-43ec-868c-373732c2704f');
$transferTargetIdentityUser->setDisplayName('Heidi Steen');
$transferTargetIdentity->setUser($transferTargetIdentityUser);
$transferTarget->setIdentity($transferTargetIdentity);
$transferTarget->setReplacesCallId('e5d39592-99bd-4db8-bca8-30fb894ec51d');
$additionalData = [
'endpointType' => 'default',
];
$transferTarget->setAdditionalData($additionalData);
$requestBody->setTransferTarget($transferTarget);
$graphServiceClient->communications()->calls()->byCallId('call-id')->transfer()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
transferTarget = @{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
endpointType = "default"
identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
user = @{
"@odata.type" = "#microsoft.graph.identity"
id = "550fae72-d251-43ec-868c-373732c2704f"
displayName = "Heidi Steen"
}
}
replacesCallId = "e5d39592-99bd-4db8-bca8-30fb894ec51d"
}
}
Move-MgCommunicationCall -CallId $callId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.calls.item.transfer.transfer_post_request_body import TransferPostRequestBody
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
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 = TransferPostRequestBody(
transfer_target = InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
user = Identity(
odata_type = "#microsoft.graph.identity",
id = "550fae72-d251-43ec-868c-373732c2704f",
display_name = "Heidi Steen",
),
),
replaces_call_id = "e5d39592-99bd-4db8-bca8-30fb894ec51d",
additional_data = {
"endpoint_type" : "default",
}
),
)
await graph_client.communications.calls.by_call_id('call-id').transfer.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 202 Accepted
Notification - transferring
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferring"
}
}
]
}
Notification - transfer accepted
Note: Transfer accepted may happen after or before media state audio inactive.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferAccepted"
}
}
]
}
Notification - transfer completed
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "terminated",
"terminationReason": "AppTransferred"
}
}
]
}
Notification - transfer failed
Note: When a call transfer fails, the call state will be established
.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "established",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 500,
"subCode": 7700,
"message": "<message>"
},
"replacesContext": "<replacesContext>"
}
}
]
}
Example 3: Call transfer from a peer-to-peer call to PSTN number
This call requires an application instance with a PSTN number assigned. For details, see Assign a phone number to your bot.
Note: Phone ID is the phone number in E.164 format.
Request
The following example shows the request.
POST https://graph.microsoft.com/v1.0/communications/calls/{id}/transfer
Content-Type: application/json
Content-Length: 430
{
"transferTarget": {
"endpointType": "default",
"identity": {
"phone": {
"@odata.type": "#microsoft.graph.identity",
"id": "+12345678901"
}
},
"languageId": "languageId-value",
"region": "region-value"
},
"clientContext": "9e90d1c1-f61e-43e7-9f75-d420159aae08"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.Calls.Item.Transfer;
using Microsoft.Graph.Models;
var requestBody = new TransferPostRequestBody
{
TransferTarget = new InvitationParticipantInfo
{
Identity = new IdentitySet
{
AdditionalData = new Dictionary<string, object>
{
{
"phone" , new Identity
{
OdataType = "#microsoft.graph.identity",
Id = "+12345678901",
}
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"endpointType" , "default"
},
{
"languageId" , "languageId-value"
},
{
"region" , "region-value"
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"clientContext" , "9e90d1c1-f61e-43e7-9f75-d420159aae08"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Communications.Calls["{call-id}"].Transfer.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc communications calls transfer post --call-id {call-id} --body '{\
"transferTarget": {\
"endpointType": "default",\
"identity": {\
"phone": {\
"@odata.type": "#microsoft.graph.identity",\
"id": "+12345678901"\
}\
},\
"languageId": "languageId-value",\
"region": "region-value"\
},\
"clientContext": "9e90d1c1-f61e-43e7-9f75-d420159aae08"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphcommunications "github.com/microsoftgraph/msgraph-sdk-go/communications"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphcommunications.NewTransferPostRequestBody()
transferTarget := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
additionalData := map[string]interface{}{
phone := graphmodels.NewIdentity()
id := "+12345678901"
phone.SetId(&id)
identity.SetPhone(phone)
}
identity.SetAdditionalData(additionalData)
transferTarget.SetIdentity(identity)
additionalData := map[string]interface{}{
"endpointType" : "default",
"languageId" : "languageId-value",
"region" : "region-value",
}
transferTarget.SetAdditionalData(additionalData)
requestBody.SetTransferTarget(transferTarget)
additionalData := map[string]interface{}{
"clientContext" : "9e90d1c1-f61e-43e7-9f75-d420159aae08",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Communications().Calls().ByCallId("call-id").Transfer().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody transferPostRequestBody = new com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody();
InvitationParticipantInfo transferTarget = new InvitationParticipantInfo();
IdentitySet identity = new IdentitySet();
HashMap<String, Object> additionalData = new HashMap<String, Object>();
Identity phone = new Identity();
phone.setOdataType("#microsoft.graph.identity");
phone.setId("+12345678901");
additionalData.put("phone", phone);
identity.setAdditionalData(additionalData);
transferTarget.setIdentity(identity);
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("endpointType", "default");
additionalData1.put("languageId", "languageId-value");
additionalData1.put("region", "region-value");
transferTarget.setAdditionalData(additionalData1);
transferPostRequestBody.setTransferTarget(transferTarget);
HashMap<String, Object> additionalData2 = new HashMap<String, Object>();
additionalData2.put("clientContext", "9e90d1c1-f61e-43e7-9f75-d420159aae08");
transferPostRequestBody.setAdditionalData(additionalData2);
graphClient.communications().calls().byCallId("{call-id}").transfer().post(transferPostRequestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const transfer = {
transferTarget: {
endpointType: 'default',
identity: {
phone: {
'@odata.type': '#microsoft.graph.identity',
id: '+12345678901'
}
},
languageId: 'languageId-value',
region: 'region-value'
},
clientContext: '9e90d1c1-f61e-43e7-9f75-d420159aae08'
};
await client.api('/communications/calls/{id}/transfer')
.post(transfer);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\Calls\Item\Transfer\TransferPostRequestBody;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TransferPostRequestBody();
$transferTarget = new InvitationParticipantInfo();
$transferTargetIdentity = new IdentitySet();
$additionalData = [
'phone' => [
'@odata.type' => '#microsoft.graph.identity',
'id' => '+12345678901',
],
];
$transferTargetIdentity->setAdditionalData($additionalData);
$transferTarget->setIdentity($transferTargetIdentity);
$additionalData = [
'endpointType' => 'default',
'languageId' => 'languageId-value',
'region' => 'region-value',
];
$transferTarget->setAdditionalData($additionalData);
$requestBody->setTransferTarget($transferTarget);
$additionalData = [
'clientContext' => '9e90d1c1-f61e-43e7-9f75-d420159aae08',
];
$requestBody->setAdditionalData($additionalData);
$graphServiceClient->communications()->calls()->byCallId('call-id')->transfer()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
transferTarget = @{
endpointType = "default"
identity = @{
phone = @{
"@odata.type" = "#microsoft.graph.identity"
id = "+12345678901"
}
}
languageId = "languageId-value"
region = "region-value"
}
clientContext = "9e90d1c1-f61e-43e7-9f75-d420159aae08"
}
Move-MgCommunicationCall -CallId $callId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.calls.item.transfer.transfer_post_request_body import TransferPostRequestBody
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
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 = TransferPostRequestBody(
transfer_target = InvitationParticipantInfo(
identity = IdentitySet(
additional_data = {
"phone" : {
"@odata_type" : "#microsoft.graph.identity",
"id" : "+12345678901",
},
}
),
additional_data = {
"endpoint_type" : "default",
"language_id" : "languageId-value",
"region" : "region-value",
}
),
additional_data = {
"client_context" : "9e90d1c1-f61e-43e7-9f75-d420159aae08",
}
)
await graph_client.communications.calls.by_call_id('call-id').transfer.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 202 Accepted
Notification - transferring
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferring"
}
}
]
}
Notification - transfer accepted
Note: Transfer accepted may happen after or before media state audio inactive.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferAccepted"
}
}
]
}
Notification - transfer completed
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "terminated",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 0,
"subcode": 7015,
"message": "GracefulTransferCompleted"
}
}
}
]
}
Notification - transfer failed
Note: When a call transfer fails, the call state will be established
.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "established",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 500,
"subCode": 7000,
"message": "<message>"
}
}
}
]
}
Example 4: Consultative transfer from a peer-to-peer call to PSTN number
This call requires an application instance with a PSTN number assigned. For details, see Assign a phone number to your bot.
Note: Phone ID is the phone number in E.164 format.
Request
The following example shows the request.
POST https://graph.microsoft.com/v1.0/communications/calls/341a0500-d4bf-4224-8b19-1581168d328b/transfer
Content-Type: application/json
{
"transferTarget": {
"@odata.type": "#microsoft.graph.invitationParticipantInfo",
"endpointType": "default",
"identity": {
"@odata.type": "#microsoft.graph.identitySet",
"phone": {
"@odata.type": "#microsoft.graph.identity",
"id": "+12345678901"
}
},
"languageId": "en-us",
"region": "amer",
"replacesCallId": "e5d39592-99bd-4db8-bca8-30fb894ec51d"
},
"clientContext": "9e90d1c1-f61e-43e7-9f75-d420159aae08"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.Calls.Item.Transfer;
using Microsoft.Graph.Models;
var requestBody = new TransferPostRequestBody
{
TransferTarget = 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",
}
},
},
},
ReplacesCallId = "e5d39592-99bd-4db8-bca8-30fb894ec51d",
AdditionalData = new Dictionary<string, object>
{
{
"endpointType" , "default"
},
{
"languageId" , "en-us"
},
{
"region" , "amer"
},
},
},
AdditionalData = new Dictionary<string, object>
{
{
"clientContext" , "9e90d1c1-f61e-43e7-9f75-d420159aae08"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Communications.Calls["{call-id}"].Transfer.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc communications calls transfer post --call-id {call-id} --body '{\
"transferTarget": {\
"@odata.type": "#microsoft.graph.invitationParticipantInfo",\
"endpointType": "default",\
"identity": {\
"@odata.type": "#microsoft.graph.identitySet",\
"phone": {\
"@odata.type": "#microsoft.graph.identity",\
"id": "+12345678901"\
}\
},\
"languageId": "en-us",\
"region": "amer",\
"replacesCallId": "e5d39592-99bd-4db8-bca8-30fb894ec51d"\
},\
"clientContext": "9e90d1c1-f61e-43e7-9f75-d420159aae08"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphcommunications "github.com/microsoftgraph/msgraph-sdk-go/communications"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphcommunications.NewTransferPostRequestBody()
transferTarget := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
additionalData := map[string]interface{}{
phone := graphmodels.NewIdentity()
id := "+12345678901"
phone.SetId(&id)
identity.SetPhone(phone)
}
identity.SetAdditionalData(additionalData)
transferTarget.SetIdentity(identity)
replacesCallId := "e5d39592-99bd-4db8-bca8-30fb894ec51d"
transferTarget.SetReplacesCallId(&replacesCallId)
additionalData := map[string]interface{}{
"endpointType" : "default",
"languageId" : "en-us",
"region" : "amer",
}
transferTarget.SetAdditionalData(additionalData)
requestBody.SetTransferTarget(transferTarget)
additionalData := map[string]interface{}{
"clientContext" : "9e90d1c1-f61e-43e7-9f75-d420159aae08",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Communications().Calls().ByCallId("call-id").Transfer().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody transferPostRequestBody = new com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody();
InvitationParticipantInfo transferTarget = new InvitationParticipantInfo();
transferTarget.setOdataType("#microsoft.graph.invitationParticipantInfo");
IdentitySet identity = new IdentitySet();
identity.setOdataType("#microsoft.graph.identitySet");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
Identity phone = new Identity();
phone.setOdataType("#microsoft.graph.identity");
phone.setId("+12345678901");
additionalData.put("phone", phone);
identity.setAdditionalData(additionalData);
transferTarget.setIdentity(identity);
transferTarget.setReplacesCallId("e5d39592-99bd-4db8-bca8-30fb894ec51d");
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("endpointType", "default");
additionalData1.put("languageId", "en-us");
additionalData1.put("region", "amer");
transferTarget.setAdditionalData(additionalData1);
transferPostRequestBody.setTransferTarget(transferTarget);
HashMap<String, Object> additionalData2 = new HashMap<String, Object>();
additionalData2.put("clientContext", "9e90d1c1-f61e-43e7-9f75-d420159aae08");
transferPostRequestBody.setAdditionalData(additionalData2);
graphClient.communications().calls().byCallId("{call-id}").transfer().post(transferPostRequestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const transfer = {
transferTarget: {
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
endpointType: 'default',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
phone: {
'@odata.type': '#microsoft.graph.identity',
id: '+12345678901'
}
},
languageId: 'en-us',
region: 'amer',
replacesCallId: 'e5d39592-99bd-4db8-bca8-30fb894ec51d'
},
clientContext: '9e90d1c1-f61e-43e7-9f75-d420159aae08'
};
await client.api('/communications/calls/341a0500-d4bf-4224-8b19-1581168d328b/transfer')
.post(transfer);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\Calls\Item\Transfer\TransferPostRequestBody;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TransferPostRequestBody();
$transferTarget = new InvitationParticipantInfo();
$transferTarget->setOdataType('#microsoft.graph.invitationParticipantInfo');
$transferTargetIdentity = new IdentitySet();
$transferTargetIdentity->setOdataType('#microsoft.graph.identitySet');
$additionalData = [
'phone' => [
'@odata.type' => '#microsoft.graph.identity',
'id' => '+12345678901',
],
];
$transferTargetIdentity->setAdditionalData($additionalData);
$transferTarget->setIdentity($transferTargetIdentity);
$transferTarget->setReplacesCallId('e5d39592-99bd-4db8-bca8-30fb894ec51d');
$additionalData = [
'endpointType' => 'default',
'languageId' => 'en-us',
'region' => 'amer',
];
$transferTarget->setAdditionalData($additionalData);
$requestBody->setTransferTarget($transferTarget);
$additionalData = [
'clientContext' => '9e90d1c1-f61e-43e7-9f75-d420159aae08',
];
$requestBody->setAdditionalData($additionalData);
$graphServiceClient->communications()->calls()->byCallId('call-id')->transfer()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
transferTarget = @{
"@odata.type" = "#microsoft.graph.invitationParticipantInfo"
endpointType = "default"
identity = @{
"@odata.type" = "#microsoft.graph.identitySet"
phone = @{
"@odata.type" = "#microsoft.graph.identity"
id = "+12345678901"
}
}
languageId = "en-us"
region = "amer"
replacesCallId = "e5d39592-99bd-4db8-bca8-30fb894ec51d"
}
clientContext = "9e90d1c1-f61e-43e7-9f75-d420159aae08"
}
Move-MgCommunicationCall -CallId $callId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.calls.item.transfer.transfer_post_request_body import TransferPostRequestBody
from msgraph.generated.models.invitation_participant_info import InvitationParticipantInfo
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 = TransferPostRequestBody(
transfer_target = InvitationParticipantInfo(
odata_type = "#microsoft.graph.invitationParticipantInfo",
identity = IdentitySet(
odata_type = "#microsoft.graph.identitySet",
additional_data = {
"phone" : {
"@odata_type" : "#microsoft.graph.identity",
"id" : "+12345678901",
},
}
),
replaces_call_id = "e5d39592-99bd-4db8-bca8-30fb894ec51d",
additional_data = {
"endpoint_type" : "default",
"language_id" : "en-us",
"region" : "amer",
}
),
additional_data = {
"client_context" : "9e90d1c1-f61e-43e7-9f75-d420159aae08",
}
)
await graph_client.communications.calls.by_call_id('call-id').transfer.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
Note: The response object shown here might be shortened for readability.
HTTP/1.1 202 Accepted
Notification - transferring
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferring"
}
}
]
}
Notification - transfer accepted
Note: Transfer accepted may happen after or before media state audio inactive.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferAccepted"
}
}
]
}
Notification - transfer completed
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "terminated",
"terminationReason": "AppTransferred"
}
}
]
}
Notification - transfer failed
Note: When a call transfer fails, the call state will be established
.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "established",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 500,
"subCode": 7700,
"message": "<message>"
}
}
}
]
}
Example 5: Call transfer from a group call
Note: To transfer from a group call, the transferee parameter is required. All other parameters are the same as those for a transfer from a peer-to-peer call. A consultative transfer from a group call or a transfer to PSTN from a group call are similar to examples 1-4, with the transferee parameter specified.
Request
The following example shows the request.
POST https://graph.microsoft.com/v1.0/communications/calls/{id}/transfer
Content-Type: application/json
Content-Length: 430
{
"transferTarget": {
"endpointType": "default",
"identity": {
"user": {
"id": "550fae72-d251-43ec-868c-373732c2704f",
"displayName": "Heidi Steen"
}
},
},
"transferee": {
"identity": {
"user": {
"id": "751f6800-3180-414d-bd94-333364659951",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
}
},
"participantId": "909c6581-5130-43e9-88f3-fcb3582cde37"
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Communications.Calls.Item.Transfer;
using Microsoft.Graph.Models;
var requestBody = new TransferPostRequestBody
{
TransferTarget = new InvitationParticipantInfo
{
Identity = new IdentitySet
{
User = new Identity
{
Id = "550fae72-d251-43ec-868c-373732c2704f",
DisplayName = "Heidi Steen",
},
},
AdditionalData = new Dictionary<string, object>
{
{
"endpointType" , "default"
},
},
},
Transferee = new ParticipantInfo
{
Identity = new IdentitySet
{
User = new Identity
{
Id = "751f6800-3180-414d-bd94-333364659951",
AdditionalData = new Dictionary<string, object>
{
{
"tenantId" , "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
},
},
},
ParticipantId = "909c6581-5130-43e9-88f3-fcb3582cde37",
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Communications.Calls["{call-id}"].Transfer.PostAsync(requestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc communications calls transfer post --call-id {call-id} --body '{\
"transferTarget": {\
"endpointType": "default",\
"identity": {\
"user": {\
"id": "550fae72-d251-43ec-868c-373732c2704f",\
"displayName": "Heidi Steen"\
}\
},\
},\
"transferee": {\
"identity": {\
"user": {\
"id": "751f6800-3180-414d-bd94-333364659951",\
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"\
}\
},\
"participantId": "909c6581-5130-43e9-88f3-fcb3582cde37"\
}\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphcommunications "github.com/microsoftgraph/msgraph-sdk-go/communications"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphcommunications.NewTransferPostRequestBody()
transferTarget := graphmodels.NewInvitationParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
id := "550fae72-d251-43ec-868c-373732c2704f"
user.SetId(&id)
displayName := "Heidi Steen"
user.SetDisplayName(&displayName)
identity.SetUser(user)
transferTarget.SetIdentity(identity)
additionalData := map[string]interface{}{
"endpointType" : "default",
}
transferTarget.SetAdditionalData(additionalData)
requestBody.SetTransferTarget(transferTarget)
transferee := graphmodels.NewParticipantInfo()
identity := graphmodels.NewIdentitySet()
user := graphmodels.NewIdentity()
id := "751f6800-3180-414d-bd94-333364659951"
user.SetId(&id)
additionalData := map[string]interface{}{
"tenantId" : "72f988bf-86f1-41af-91ab-2d7cd011db47",
}
user.SetAdditionalData(additionalData)
identity.SetUser(user)
transferee.SetIdentity(identity)
participantId := "909c6581-5130-43e9-88f3-fcb3582cde37"
transferee.SetParticipantId(&participantId)
requestBody.SetTransferee(transferee)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
graphClient.Communications().Calls().ByCallId("call-id").Transfer().Post(context.Background(), requestBody, nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody transferPostRequestBody = new com.microsoft.graph.communications.calls.item.transfer.TransferPostRequestBody();
InvitationParticipantInfo transferTarget = new InvitationParticipantInfo();
IdentitySet identity = new IdentitySet();
Identity user = new Identity();
user.setId("550fae72-d251-43ec-868c-373732c2704f");
user.setDisplayName("Heidi Steen");
identity.setUser(user);
transferTarget.setIdentity(identity);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("endpointType", "default");
transferTarget.setAdditionalData(additionalData);
transferPostRequestBody.setTransferTarget(transferTarget);
ParticipantInfo transferee = new ParticipantInfo();
IdentitySet identity1 = new IdentitySet();
Identity user1 = new Identity();
user1.setId("751f6800-3180-414d-bd94-333364659951");
HashMap<String, Object> additionalData1 = new HashMap<String, Object>();
additionalData1.put("tenantId", "72f988bf-86f1-41af-91ab-2d7cd011db47");
user1.setAdditionalData(additionalData1);
identity1.setUser(user1);
transferee.setIdentity(identity1);
transferee.setParticipantId("909c6581-5130-43e9-88f3-fcb3582cde37");
transferPostRequestBody.setTransferee(transferee);
graphClient.communications().calls().byCallId("{call-id}").transfer().post(transferPostRequestBody);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const transfer = {
transferTarget: {
endpointType: 'default',
identity: {
user: {
id: '550fae72-d251-43ec-868c-373732c2704f',
displayName: 'Heidi Steen'
}
},
},
transferee: {
identity: {
user: {
id: '751f6800-3180-414d-bd94-333364659951',
tenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47'
}
},
participantId: '909c6581-5130-43e9-88f3-fcb3582cde37'
}
};
await client.api('/communications/calls/{id}/transfer')
.post(transfer);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Communications\Calls\Item\Transfer\TransferPostRequestBody;
use Microsoft\Graph\Generated\Models\InvitationParticipantInfo;
use Microsoft\Graph\Generated\Models\IdentitySet;
use Microsoft\Graph\Generated\Models\Identity;
use Microsoft\Graph\Generated\Models\ParticipantInfo;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new TransferPostRequestBody();
$transferTarget = new InvitationParticipantInfo();
$transferTargetIdentity = new IdentitySet();
$transferTargetIdentityUser = new Identity();
$transferTargetIdentityUser->setId('550fae72-d251-43ec-868c-373732c2704f');
$transferTargetIdentityUser->setDisplayName('Heidi Steen');
$transferTargetIdentity->setUser($transferTargetIdentityUser);
$transferTarget->setIdentity($transferTargetIdentity);
$additionalData = [
'endpointType' => 'default',
];
$transferTarget->setAdditionalData($additionalData);
$requestBody->setTransferTarget($transferTarget);
$transferee = new ParticipantInfo();
$transfereeIdentity = new IdentitySet();
$transfereeIdentityUser = new Identity();
$transfereeIdentityUser->setId('751f6800-3180-414d-bd94-333364659951');
$additionalData = [
'tenantId' => '72f988bf-86f1-41af-91ab-2d7cd011db47',
];
$transfereeIdentityUser->setAdditionalData($additionalData);
$transfereeIdentity->setUser($transfereeIdentityUser);
$transferee->setIdentity($transfereeIdentity);
$transferee->setParticipantId('909c6581-5130-43e9-88f3-fcb3582cde37');
$requestBody->setTransferee($transferee);
$graphServiceClient->communications()->calls()->byCallId('call-id')->transfer()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
transferTarget = @{
endpointType = "default"
identity = @{
user = @{
id = "550fae72-d251-43ec-868c-373732c2704f"
displayName = "Heidi Steen"
}
}
}
transferee = @{
identity = @{
user = @{
id = "751f6800-3180-414d-bd94-333364659951"
tenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47"
}
}
participantId = "909c6581-5130-43e9-88f3-fcb3582cde37"
}
}
Move-MgCommunicationCall -CallId $callId -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.communications.calls.item.transfer.transfer_post_request_body import TransferPostRequestBody
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.participant_info import ParticipantInfo
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = TransferPostRequestBody(
transfer_target = InvitationParticipantInfo(
identity = IdentitySet(
user = Identity(
id = "550fae72-d251-43ec-868c-373732c2704f",
display_name = "Heidi Steen",
),
),
additional_data = {
"endpoint_type" : "default",
}
),
transferee = ParticipantInfo(
identity = IdentitySet(
user = Identity(
id = "751f6800-3180-414d-bd94-333364659951",
additional_data = {
"tenant_id" : "72f988bf-86f1-41af-91ab-2d7cd011db47",
}
),
),
participant_id = "909c6581-5130-43e9-88f3-fcb3582cde37",
),
)
await graph_client.communications.calls.by_call_id('call-id').transfer.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
HTTP/1.1 202 Accepted
Notification - transferring
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferring"
}
}
]
}
Notification - transfer accepted
Note: Transfer accepted may happen after or before media state audio inactive.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "transferAccepted"
}
}
]
}
Notification - transfer completed
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "terminated",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 0,
"subcode": 7015,
"message": "GracefulTransferCompleted"
}
}
}
]
}
Notification - transfer failed
Note: When a call transfer fails, the call state will be established
.
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/341a0500-d4bf-4224-8b19-1581168d328b",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "established",
"resultInfo": {
"@odata.type": "#microsoft.graph.resultInfo",
"code": 500,
"subCode": 7000,
"message": "<message>"
}
}
}
]
}