microsoftgraph / microsoft-graph-comms-samples

Microsoft Graph Communications Samples
MIT License
208 stars 225 forks source link

Unable to Call External Users Using Microsoft Graph Call API #720

Open alexspaeth1 opened 6 months ago

alexspaeth1 commented 6 months ago

We aim to initiate calls to external users using the Microsoft Graph Call API under the following scenarios:

Scenario 1: When we know their email address and are aware they are in Teams within a different organization.

Scenario 2: When we already have the UserId and TenantId.

What we can currently achieve:

Making phone calls (PSTN Calls). Making VOIP calls within our tenant (organization) or to guests of our organization.

We have set up an app with all the necessary permissions. Created a BOT. Link to BOT creation Created an AppInstance as a resource account and assigned it to the app. Assigned a phone number to the AppInstance. Link to phone number assignment

Currently, when attempting to call external users using the Microsoft Graph Call API, we encounter the following error:

{"code":"7505","message":"Request authorization tenant mismatch.","innerError":{"date":"2024-03-27T09:32:32","request-id":"6be56bb2-ca0c-4930-a39d-064982428363","client-request-id":"5f7db483-33fa-2b37-897f-a9b135f46b8c"}}

For the following call under POST (/communications/calls), the body looks as follows:

{
  '@odata.type': '#microsoft.graph.call',
  callbackUri: 'https://' + this.connectionProperties.host + '/microsoftgraph/callnotifications',
  source: {
    '@odata.type': '#microsoft.graph.participantInfo',
    identity: {
      '@odata.type': '#microsoft.graph.identitySet',
      appInstance: {
        '@odata.type': '#microsoft.graph.identity',
        displayName: 'App Instance Name',
        id: "<our AppInstanceID>",
        tenantId: "<our TenantID>"
      }
    },
    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',
          id: "<external UserID>",
          tenantId: "<TenantId of another organization>"
          //or id: <PrincipalName or Email>
        }
      } 
    }
  ],
  requestedModalities: [
    'audio'
  ],
  callOptions: {
    '@odata.type': '#microsoft.graph.outgoingCallOptions',
    hideBotAfterEscalation: true,
    isContentSharingNotificationEnabled: true
  },
  mediaConfig: {
    '@odata.type': '#microsoft.graph.serviceHostedMediaConfig'
  },
  tenantId: "<our TenantID>"
}

Could you please assist us in resolving this issue?