Background
I am developing a bot that will have the ability to initiate a call between 2 people. In the current ability of the app, it is able to initiate calls between User A and User B. When the call initialization is done the bot joins the call and both users get a ring that Bot_Name is calling. If both users accept the call, both can connect over a call that was initiated by a Bot.
Problem
After both people join the call, out of the participants list there is no presenter there. Both User A and User B are unable to present the screen or turn their video on. If during call receiving if User A clicks on receive video call button then their video is visible to User B but User B's video is not visible to A and screen sharing is also not possible.
Code/Function
Code implementation as per: Create service based VoIP calls documentation
async makeCall(data) {
let targetMembers: callTarget[] = [
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
displayName: data.userA.name,
id: data.userA.aadObjectId,
tenantId: data.userA.tenantId
}
}
},
{
'@odata.type': '#microsoft.graph.invitationParticipantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
user: {
'@odata.type': '#microsoft.graph.identity',
displayName: data.userB.name,
id: data.userB.aadObjectId,
tenantId: data.userB.tenantId
}
}
}
]
const call = {
'@odata.type': '#microsoft.graph.call',
direction: 'outgoing',
subject: data.topic,
callbackUri: config.callBackUri + "/call-callback",
source: {
'@odata.type': '#microsoft.graph.participantInfo',
identity: {
'@odata.type': '#microsoft.graph.identitySet',
application: {
'@odata.type': '#microsoft.graph.identity',
displayName: 'App for Teams',
id: 'xxxxxx-xxxx-xxxx-xxxx-botIdxxxxb23'
}
}
},
targets: targetMembers,
requestedModalities: ['audio', 'video', 'videoBasedScreenSharing'],
mediaConfig: {
'@odata.type': '#microsoft.graph.serviceHostedMediaConfig',
removeFromDefaultAudioGroup: false
},
tenantId: 'xxxxxx-xxxx-xxxx-xxxx-xxxxxtenentId'
};
try {
const response = await this.graphClient.api('/communications/calls').post(call);
} catch (error) {
console.log(error);
}
}
Using the above method we are able to initialize the call successfully. Issues are with video and screen sharing.
What we tried.
- Adding ['audio', 'video', 'videoBasedScreenSharing'] in requested modalities and also in active modalities
- Adding user as co-organizer
- Additional function that takes id as a parameter and makes a patch for sharing content. As per the documentation given here
async enableSharing(callId) {
const changeScreenSharingRole = {
role: 'sharer'
};
try {
const response = await this.graphClient.api(`/communications/calls/${callId}/changeScreenSharingRole`).post(changeScreenSharingRole);
console.log(response);
} catch (error) {
console.log(error); // Handle any errors that occur during the API call
}
}
In this case also I am getting error 500 with code 999
GraphError: Encountered exception during changing screen sharing role.
at new GraphError (E:\CallngBot\Deployment\CallngBot\bot\node_modules\@microsoft\microsoft-graph-client\src\GraphError.ts:63:3)
at Function.GraphErrorHandler.constructErrorFromResponse (E:\CallngBot\Deployment\CallngBot\bot\node_modules\@microsoft\microsoft-graph-client\src\GraphErrorHandler.ts:77:18)
at Function.<anonymous> (E:\CallngBot\Deployment\CallngBot\bot\node_modules\@microsoft\microsoft-graph-client\src\GraphErrorHandler.ts:104:31)
at step (E:\CallngBot\Deployment\CallngBot\bot\node_modules\tslib\tslib.js:193:27)
at Object.next (E:\CallngBot\Deployment\CallngBot\bot\node_modules\tslib\tslib.js:174:57)
at E:\CallngBot\Deployment\CallngBot\bot\node_modules\tslib\tslib.js:167:75
at new Promise (<anonymous>)
at Object.__awaiter (E:\CallngBot\Deployment\CallngBot\bot\node_modules\tslib\tslib.js:163:16)
at Function.GraphErrorHandler.getError (E:\CallngBot\Deployment\CallngBot\bot\node_modules\@microsoft\microsoft-graph-client\lib\src\GraphErrorHandler.js:87:24)
at GraphRequest.<anonymous> (E:\CallngBot\Deployment\CallngBot\bot\node_modules\@microsoft\microsoft-graph-client\src\GraphRequest.ts:391:55) {
statusCode: 500,
code: '9999',
requestId: 'dee2344b-6341-439d-bd04-8b2a7dc1e795',
date: 2023-07-31T21:39:01.000Z,
body: '{"code":"9999","message":"Encountered exception during changing screen sharing role.","innerError":{"date":"2023-08-01T03:09:01","request-id":"dee2344b-6341-439d-bd04-8b2a7dc1e795","client-request-id":"7a5551fc-6fed-3d1e-5ddf-361c327dca5b"}}',
headers: Headers {
[Symbol(map)]: [Object: null prototype] {
'transfer-encoding': [Array],
'content-type': [Array],
'content-encoding': [Array],
vary: [Array],
'strict-transport-security': [Array],
'request-id': [Array],
'client-request-id': [Array],
'x-ms-ags-diagnostic': [Array],
date: [Array],
connection: [Array]
}
}
}
Requirement / Questions
- How to create a service-based VoIP call? if the documentation has some issues please suggest suitable changes.
- How to enable screen sharing in a call created by an app?
- How can we make such a bot work cross-tenant? Do we have to make modifications in tenant id like instead of ID we have to keep it
common
? Here cross tenant means, If the app is developed in Organization A then when globally deployed Organization B should be able to use it. - There are details missing in the documentation about additional parameters that need to pass in case additional enabling sharing and camera later. Please provide a detailed function if exists else suggest changes in the function provided above.
This issue is raised on GitHub as well but no solutions yet. Link to issue
Thanks for your time and support in advance. Hope we can find a solution to this.