Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.03k stars 1.19k forks source link

Azure Communication Services: Our services aren't available right now We're working to restore all services as soon as possible Please check back soon #30435

Open Hamza-TE opened 1 month ago

Hamza-TE commented 1 month ago

I am trying to use Azure Communication Services to create a user identity and then fetch relay configuration for network traversal. Here is the code:

const { CommunicationIdentityClient } = require("@azure/communication-identity");
const { CommunicationRelayClient } = require("@azure/communication-network-traversal");;

const main = async () => {
  console.log("Azure Communication Services - Relay Token Quickstart")

  const connectionString = "CONNECTION STRING"
 // Instantiate the identity client
  const identityClient = new CommunicationIdentityClient(connectionString);

  let identityResponse = await identityClient.createUser();
  console.log(`\nCreated an identity with ID: ${identityResponse.communicationUserId}`);

  const relayClient = new CommunicationRelayClient(connectionString);
  console.log("Getting relay configuration");

  const config = await relayClient.getRelayConfiguration(identityResponse);
  console.log("RelayConfig", config);

  console.log("Printing entire thing ",config.iceServers);  
};

main().catch((error) => {
  console.log("Encountered and error");
  console.log(error);
})

I got error as

<h2>Our services aren't available right now</h2><p>We're working to restore all services as soon as possible. Please check back soon.</p>

I searched on community forum and tried to implement the solution but got the same error.

**Solution: "we cannot directly access the endpoint as a rest API endpoint there are extensions to it that we need to add so that we can reach the correct destination like in order to place a call using Azure communication services we need to use this endpoint.

{endpoint}/calling/callConnections?api-version=2021-08-30-preview

FYI this will not work until you provide the access token"**

const { CommunicationIdentityClient } = require("@azure/communication-identity");
const { CommunicationRelayClient } = require("@azure/communication-network-traversal");
const axios = require('axios');

const main = async () => {
  console.log("Azure Communication Services - Relay Token Quickstart");

  const connectionString = "endpoint=https://aiavatarr.unitedstates.communication.azure.com/;accesskey=5CABEZrJGctEL4379T4irTtGPd5E0jmHqQJWLGkeKVHHpRJZC0uJJQQJ99AGACULyCpDPb7DAAAAAZCSRojg";
  const endpoint = connectionString.match(/endpoint=(.*?);/)[1];
  // Instantiate the identity client
  const identityClient = new CommunicationIdentityClient(connectionString);

  try {
    let identityResponse = await identityClient.createUser();
    console.log(`\nCreated an identity with ID: ${identityResponse.communicationUserId}`);

    const relayClient = new CommunicationRelayClient(`${connectionString}/networkTraversal/:issueRelayConfiguration?api-version=2022-03-01-preview`);
    console.log("Getting relay configuration",relayClient);

    const config = await relayClient.getRelayConfiguration(identityResponse);
    console.log("RelayConfig", config);

  } catch (error) {
    console.log("Encountered an error");
    console.log(error.response ? error.response.data : error.message);
  }
};

main().catch((error) => {
  console.log("Encountered an error");
  console.log(error);
});

Still I get the SAME error.

github-actions[bot] commented 1 month ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @acsdevx-msft.