Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This sample application was demonstrated during Microsoft Ignite 2024. It highlights an integration of Azure Communication Services with Azure OpenAI Service to enable intelligent conversational agents.
In this sample, we cover off what this sample does and what you need as prerequisites before we run this sample locally on your machine.
Download code
Find the project for this sample on GitHub. You can download this code and run it locally to try it for yourself.
Overview
This server-side application helps create a virtual assistant that can handle phone calls and respond to customers using Azure OpenAI services, providing quick and real-time answers.
Prerequisites
- Create an Azure account with an active subscription. For details, see Create an account for free
- Create an Azure Communication Services resource. For details, see Create an Azure Communication Resource. You need to record your resource connection string for this sample.
- A Calling-enabled telephone number. Get a phone number.
- Azure Dev Tunnels. For details, see Enable dev tunnel
- An Azure OpenAI Resource and Deployed Model. See instructions.
Note
Bidirectional Streaming in Azure Communication Services is generally available, but the Azure OpenAI real-time API has its own release schedule. For up-to-date info on the API’s availability, check out the official docs.
Set up instructions
Before running this sample, you need to set up the resources with the following configuration updates:
1. Set up and host your Azure DevTunnel
Azure DevTunnels is an Azure service that enables you to share local web services hosted on the internet. Use the commands to connect your local development environment to the public internet. This creates a tunnel with a persistent endpoint URL and which allows anonymous access. We use this endpoint to notify your application of calling events from the ACS Call Automation service.
devtunnel create --allow-anonymous
devtunnel port create -p 5165
devtunnel host
2. Add the required API Keys and endpoints
Open the appsettings.json file to configure the following settings:
- DevTunnelUri: your dev tunnel endpoint
- AcsConnectionString: Azure Communication Service resource's connection string.
- AzureOpenAIServiceKey: Open AI's Service Key
- AzureOpenAIServiceEndpoint: Open AI's Service Endpoint
- AzureOpenAIDeploymentModelName: Open AI's Model name
Running the application
- Azure DevTunnel: Ensure your AzureDevTunnel URI is active and points to the correct port of your localhost application
- Run
dotnet run
to build and run the sample application - Register an Event Grid Webhook for the IncomingCall Event that points to your DevTunnel URI. Instructions here. For example:
https://<devtunelurl>/api/incomingCall
Once that's completed, you should have a running application. The best way to test this is to place a call to your ACS phone number and talk to your intelligent agent.
Next steps
- Learn more about Call Automation.
- Learn more about Bidirectional streaming
Download code
Find the project for this sample on GitHub. You can download this code and run it locally to try it for yourself.
Overview
This server-side application helps create a virtual assistant that can handle phone calls and respond to customers using Azure OpenAI services, providing quick and real-time answers.
Prerequisites
- Create an Azure account with an active subscription. For details, see Create an account for free
- Visual Studio Code installed
- Node.js installed
- Create an Azure Communication Services resource. For details, see Create an Azure Communication Resource. You need to record your resource connection string for this sample.
- Get a phone number for your new Azure Communication Services resource. For details, see Get a phone number.
- Azure Dev Tunnels. For details, see Enable dev tunnel
- An Azure OpenAI Resource and Deployed Model. See instructions.
Note
Bidirectional Streaming in Azure Communication Services is generally available, but the Azure OpenAI real-time API has its own release schedule. For up-to-date info on the API’s availability, check out the official docs.
Before running the sample for the first time
- Open an instance of PowerShell, Windows Terminal, Command Prompt, or equivalent and navigate to the directory that you would like to clone the sample to.
- git clone
https://github.com/Azure-Samples/communication-services-javascript-quickstarts.git
. - cd into the
callautomation-az-openai-voice
folder. - From the root of the folder, and with node installed, run
npm install
1. Set up and host your Azure DevTunnel
Azure DevTunnels is an Azure service that enables you to share local web services hosted on the internet. Use the commands to connect your local development environment to the public internet. This creates a tunnel with a persistent endpoint URL and which allows anonymous access. We use this endpoint to notify your application of calling events from the ACS Call Automation service.
devtunnel create --allow-anonymous
devtunnel port create -p 8080
devtunnel host
2. Add the required API Keys and endpoints
Open the .env
file to configure the following settings
CONNECTION_STRING
: Azure Communication Service resource's connection string.CALLBACK_URI
: Base url of the app. (For local developments replace the dev tunnel url)AZURE_OPENAI_SERVICE_KEY
: Azure OpenAI service keyAZURE_OPENAI_SERVICE_ENDPOINT
: Azure OpenAI endpointAZURE_OPENAI_DEPLOYMENT_MODEL_NAME
: Azure OpenAI deployment name
Running the application
Run app locally
- Open a new PowerShell window, cd into the
callautomation-az-openai-voice
folder and runnpm run dev
- Browser should pop up with a page. If not, navigate it to
http://localhost:8080/
- Register an Event Grid Webhook for the IncomingCall Event that points to your 8080 port URI. Instructions here. For example:
https://<devtunelurl>/api/incomingCall
Once that's completed, you have a running application. The best way to test this is to place a call to your ACS phone number and talk to your intelligent agent.
Next steps
- Learn more about Call Automation.
- Learn more about Bidirectional streaming