Azure/azure-sdk-for-js

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

Opened this issue · 1 comments

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.

  • The SOLUTION described was:

**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"**

  • To which i modified the code as:
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.

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