Azure communication- not able to initiate second call if first call is active

Anonymous
2022-09-13T13:43:21.567+00:00

I have a requirement to initiate another call while user is on first call. In this scenario first call's video will be turned off but audio will be on, User can mute/unmute audio.
When I am trying to initiate the second call , it throws error saying : CallingCommunicationError: Failed to create call agent, call agent for this ACS Id already exists

however in the azure documentation - its mentioned : You can create a new CallClient instance to create a new CallAgent. I am doing the same (creating new instance of CallClient for second call and then create callAgent using this newly created CallClient instance) but still it throws error saying call agent for this ACS Id already exists and I am not sure what exactly this ACS Id is? below is the code snippet

const callClient = new CallClient()
const credential = new AzureCommunicationTokenCredential(avToken)
this.callAgent = await callClient.createCallAgent(credential, { displayName: userId })
this.deviceManager = await callClient.getDeviceManager()

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
1,245 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2022-09-15T03:43:23.81+00:00

    Thanks for reaching here! It seems you are trying to have two active call agents with the same identity in the same app, this is not allowed. Each active Call Agent must be its own identity. Also, only one active CallAgent obj is allowed under per CallClient obj.

    Please try the following:

    const cc1 = new CallClient()  
    const cc2 = new CallClient()  
    const ca1 = await cc1.createCallAgent(tokenA);  
    const ca2 = await cc2.createCallAgent(tokenB);  
    

    Let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.