I'm working on integrating the Azure Communication Service calling feature into my JavaScript application. While I can successfully create outgoing calls, the incoming call event (incomingCall) is not firing. I've already walked through the official Microsoft documentation and ensured that both the token and configuration are correct. Despite my efforts, incoming calls still aren't detected.
Here's the relevant portion of my code:
import { CallClient } from "@azure/communication-calling";
import { AzureCommunicationTokenCredential } from '@azure/communication-common';
let callAgent, incomingCall;
window.initNumbers = async (userToken) => {
try {
const callClient = new CallClient();
callAgent = await callClient.createCallAgent(
new AzureCommunicationTokenCredential(userToken)
);
callAgent.on('incomingCall', (event) => {
console.log('Incoming call received.');
incomingCall = event.incomingCall;
});
} catch (error) {
console.error('Error initializing call agent:', error);
}
};
...