Inbound call fails with HMAC-SHA256 validation error (Tunisian caller → US ACS number). Also outbound from Azure portal to Tunisia fails. Do I need a French number? How to properly configure inbound Call Automation?

Author: ChoucheneeeeCreated May 26, 2026Updated May 26, 2026

I am trying to run the call-center-ai project to answer incoming phone calls using Azure Communication Services (ACS). My setup:

  • I am located in Tunisia.
  • My ACS resource is in France Central.
  • I have purchased a US phone number (+15059389863) from ACS.
  • I want to receive calls from Tunisian numbers (e.g., +21626311777, +21622447059) on that US number, and let the bot answer.

The problems

Problem 1 – Inbound call fails with authentication error

When I call +15059389863 from my Tunisian mobile, the server receives the incoming call event, but when the bot tries to answer the call, I get:

azure.core.exceptions.ClientAuthenticationError: Operation returned an invalid status 'Unauthorized'
Content: {"Error":{"Code":"7509","Message":"HMAC-SHA256 validation failed","Target":"/calling/callConnections:answer"}}
  • The connection string is valid (tested in a standalone script).
  • I modified the code to use CallAutomationClient.from_connection_string().
  • Logs show Creating Automation Client with connection string prefix: endpoint=https://... – so the client is built correctly.
  • The phone number +15059389863 is assigned to the ACS resource, and in the portal Inbound calling is Enabled with Call Automation selected.
  • Still the same error.

Problem 2 – Outbound test from Azure portal to Tunisia fails

When using the Azure portal’s “Try Phone Calling” feature (outbound) from +15059389863 to +21622447059, I get:

Call failed - undefined
SIP code 400 undefined
subcode 580040

The sample code generated by the portal also fails (same error).

What I have done so far

  • Verified ACS credentials (connection string, access key) are correct.
  • Added connection_string to the Pydantic model and config.yaml.
  • Replaced _use_automation_client() to use from_connection_string().
  • Restarted server many times.
  • Checked that the phone number is provisioned for inbound Call Automation (portal says yes).

My questions (to the maintainers / community)

  1. Is the HMAC-SHA256 error actually a phone number provisioning issue?
    Could it be that a US number (+1...) cannot receive calls from Tunisia (or any non-US country) unless some international inbound feature is enabled? Is there a region restriction for inbound calling?

  2. Do I need to buy a French number (+33...) because my ACS resource is in France Central?
    Even though the portal shows the US number as “assigned”, does ACS only properly handle inbound calls from numbers in the same geographic region as the resource?

  3. Why does the outbound test to Tunisia fail with SIP 400 / subcode 580040?
    Does ACS block outbound calls to Tunisian numbers by default? If so, is there a way to enable them (e.g., request international calling, add to verified numbers)?

  4. Is the inbound HMAC error possibly due to the callback or WebSocket URLs being unreachable from ACS?
    I am using ngrok (free domain) for public endpoints. The error says HMAC-SHA256 validation failed – that sounds like an authentication header issue, not a connectivity issue. But could ACS reject the answer_call request if the callback URLs are not reachable or not HTTPS?

  5. Could there be a missing role assignment on the ACS resource?
    I am using the connection string (access key) directly. Is that sufficient for answering inbound calls, or does the app need an RBAC role like “Call Automation Contributor”?

  6. Has anyone successfully run this project with a US number receiving calls from outside the US?
    I’d appreciate any working examples or known constraints.

Environment summary

  • Location: Tunisia (caller)
  • ACS resource location: France Central
  • Phone number used: +15059389863 (US)
  • Caller numbers: +21626311777, +21622447059 (Tunisia)
  • Project: call-center-ai (latest from main)
  • Python: 3.13
  • SDK: azure-communication-callautomation
  • Public endpoint: ngrok (free tier)

What I need help with

  • Clarification on whether a French phone number is mandatory for a France Central ACS resource when the bot is hosted in France (even though the number is just a logical endpoint).
  • Steps to correctly provision a phone number for international inbound calling.
  • Any additional configuration (e.g., outbound dialing permissions, verified numbers) needed to make this work.

Thank you for your time – I’ve been stuck on this for days.

Source: microsoft/call-center-ai