Azure Communication CallAutomationClient CloudEvents are empty

Simon Dix 80 Reputation points
2023-12-22T14:08:53.09+00:00

I have followed the quickstart here https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/call-automation/quickstart-make-an-outbound-call?tabs=visual-studio-code&pivots=programming-language-csharp and cloned the CallAutomation_OutboundCalling project and it runs successfully.

I have an existing web application (.NET 6) that uses Twilio and am looking to move to Azure, so have lifted the core code from the above to be the basis of the new solution. I have got the CallAutomationClient to make the outbound call but when the callback endpoint is hit the CloudEvents array is empty - the endpoint is defined as below:

[HttpPost("[action]")]
public async Task<IActionResult> Callbacks(CloudEvent[] cloudEvents)
{
}

The endpoint is hit for both the call being connected and when I hang up but the CloudEvents are always empty.

Any help would be greatly appreciated.

Thank you.

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

Accepted answer
  1. brtrach-MSFT 16,431 Reputation points Microsoft Employee
    2023-12-22T18:46:06.35+00:00

    @Simon Dix It's great to hear that you were able to successfully run the CallAutomation_OutboundCalling project. Regarding the issue you are facing with the CloudEvents array being empty, there could be a few reasons why this is happening.

    Firstly, make sure that the callback endpoint is configured correctly in the Azure Communication Services resource. You can check this by going to the Azure portal, selecting your Communication Services resource, and navigating to the "Events" tab. Make sure that the "Event Subscription" is created and that the "Endpoint URL" is set to the correct URL of your callback endpoint.

    Secondly, make sure that the CloudEvents are being sent correctly from the Azure Communication Services resource. You can check this by using a tool like ngrok to expose your local endpoint to the internet and then using the ngrok URL as the "Endpoint URL" in the Azure Communication Services resource. Then, you can use a tool like Postman to send a test CloudEvent to the ngrok URL and see if it is being received correctly by your callback endpoint.

    If the CloudEvents are being sent correctly from the Azure Communication Services resource and the callback endpoint is configured correctly, then it's possible that there is an issue with the CloudEvent deserialization in your code. You can try using a tool like Fiddler to inspect the HTTP request and response and see if the CloudEvents are being sent correctly and if there are any issues with the deserialization.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.