Incoming Call listener on callagent not firing.

PK 0 Reputation points
2025-02-08T03:41:00.0966667+00:00
this.callAgent = await new CallClient().createCallAgent(
            new AzureCommunicationTokenCredential(token)
        );
 this.callAgent.on('incomingCall', async ({ incomingCall }) => {

            console.log('Incoming call received', incomingCall);

            })

With the above call agent I am able to make outbound calls, but inbound calls aren't coming through. In Acs, I have the phone number set to make and receive calls.

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
998 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bhargavi Naragani 650 Reputation points Microsoft Vendor
    2025-02-10T08:03:05.8666667+00:00

    Hi @PK,
    Welcome to the Microsoft Q&A Platform!

    It seems like you're facing an issue where your incoming call event listener isn't triggering for inbound calls in Azure Communication Services (ACS), but your outbound calls are working fine, the problem is probably related to permissions, configuration, or the way the event listener is set up.

    1. Ensure the token you are using to create the 'CallAgent' is properly permitted to process incoming calls. The token must include the 'voip' scope, and you can verify this by decoding it using a utility such as jwt.io.
    2. Check your Azure Communication Services (ACS) configuration to ensure the phone number is properly set up to receive calls and mapped to the proper resource.
    3. Ensure the number is enabled for incoming and outgoing calls in the Azure portal and is not in a "pending" or "unassigned" state.
    4. Ensure that the 'incomingCall' event listener is properly set up and activated before any incoming calls are expected.
    5. Add logging to ensure the 'CallAgent' is created successfully, and the event listener is activated.
    6. Network or firewall issues can also be blocking incoming calls, so ensure your environment is accessible to the ACS service.
    7. Double-check the call routing configuration to make sure the phone number is correctly routed to your ACS resource.
    8. In debugging mode, include more logging on the 'incomingCall' event to ensure it's being called, and monitor the call state transitions.
    9. In case the event is not being called, there can be issues with the token, ACS configuration, or network. Test incoming calls using another client, like the ACS UI Library, to rule out implementation issues.
    10. Use Azure Monitor or Log Analytics to review ACS logs for incoming call errors, like call routing or token validation errors. If the issue persists, regenerate the token to ensure it's fresh and valid.

    Overview:
    https://learn.microsoft.com/en-us/azure/communication-services/concepts/call-automation/incoming-call-notification#calling-scenarios
    Hope the above provided information help in better understanding and help you resolve the issue, if you have any further concerns or queries, please feel free to reach out to us.
    If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.

    0 comments No comments

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.