'"Request Authorization Tenant Mismatch" when creating Teams Call and notification is not working?

I am using Microsoft graph API "https://graph.microsoft.com/beta/communications/calls" to make calls to teams but it gives me tenant error as per multiple answer available here I tried to pass the tenantid in the request but it does not work. I am using the new API version and basic example for create call.

Below is the code example I am using.

const client = await getApplicationClient(accessToken);
    const call = {
        '@odata.type': '#microsoft.graph.call',
        callbackUri: 'https://api.helpaas.com/v1/api/users/handleCallCallback',
        //   },
        targets: [
          {
            '@odata.type': '#microsoft.graph.invitationParticipantInfo',
            identity: {
              '@odata.type': '#microsoft.graph.identitySet',
              user: {
                '@odata.type': '#microsoft.graph.identity',
                    id: id.AAD_UserGuid, // sending from azure user object
                    displayName : id.DisplayName,
                    "tenantId" : "<subcription tenant_id>",
              }
            }
          }
        ],
        requestedModalities: [
          'audio'
        ],
        "allowConversationWithoutHost": true,
        mediaConfig: {
          '@odata.type': '#microsoft.graph.serviceHostedMediaConfig',   
        },
        "tenantId" : "<subcription tenant_id>",
        "toneInfo": {
            "@odata.type": "#microsoft.graph.toneInfo",
            "sequenceId": 1024,
            "tone": "tone0" }
      };
    const response = client.api(`/communications/calls`)
    .post(call);

Also Please explain

  1. When call is made notification pops-up in Teams Web but with teams app its not working How to fix that?
  2. What is the difference between "serviceHostedMediaConfig" and "appHostedMediaConfig" and how to choose between them?


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source