Reputation: 465
I am using the graph API to place an outgoing call from a BOT to a Teams user, with this API :
ret = await graphServiceClient.Communications.Calls
.Request()
.AddAsync(call);
This works OK, and I receive callbacks to say the call is a) establishing and then b) established.
However, if I wish to place this call on Hold from the BOT using the "Participant.StartHoldMusic" call, (see https://learn.microsoft.com/en-us/graph/api/participant-startholdmusic?view=graph-rest-1.0&tabs=csharp#request)
this does not appear possible, because the participant id is needed and this is not being passed with either of the two callbacks mentioned :
Establishing
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resource": "/app/calls/a41f5d00-0825-4221-9fd2-2924e62e55a3",
"resourceUrl": "/communications/calls/a41f5d00-0825-4221-9fd2-2924e62e55a3",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "establishing",
"callChainId": "fe6f4ad4-2187-45d0-967a-af93b0d9bca6"
}
}
]
}
Established:
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "updated",
"resource": "/app/calls/a41f5d00-0825-4221-9fd2-2924e62e55a3",
"resourceUrl": "/communications/calls/a41f5d00-0825-4221-9fd2-2924e62e55a3",
"resourceData": {
"@odata.type": "#microsoft.graph.call",
"state": "established",
"mediaState": {
"@odata.type": "#microsoft.graph.callMediaState",
"audio": "active"
},
"callChainId": "fe6f4ad4-2187-45d0-967a-af93b0d9bca6"
}
}
]
}
Also if I look at the object returned from the API to create the call (ret) it shows :
i.e. the target participant id is null.
Furthermore if I try to poll the call object to obtain the participants using the API
graphServiceClient.Communications.Calls[callid].Participants
.Request()
.GetAsync();
The participants collection comes back as null.
How can I place a call on hold using the graph API, if I have no Participant id ?
Update:
It was suggested that I treat the "MyParticipantId" as the participantid of the external party. After establishing a call to a user I tried to hold the call using the MyParticipantId field of the call, with
This results in an exception, code 8522 "Participant not found"
Upvotes: 1
Views: 494
Reputation: 1458
This startHoldMusic API only supports group call.
For P2P call (bot calling a Teams user) its not supported.
For group call, roster update will always happen so that bot is able to get participant id for any of the participants in the call.
This hold music feature is not to put user's Teams client on hold. The target Teams user will still be "active" in the call, but start hearing music instead of others talking.
To make P2P working in this way, bot can just call PlayPrompt API to play audio, since there is no other people in the call.
Upvotes: 1