This is a sample application. It highlights an integration of Azure Communication Services with Semantic Kernel, using the Azure OpenAI Service to enable intelligent conversational agents.
Original code for this sample can be found here.
- An Azure account with an active subscription. Create an account for free.
- A deployed Communication Services resource. Create a Communication Services resource.
- A phone number in your Azure Communication Services resource that can get inbound calls. NB: phone numbers are not available in free subscriptions.
- Python 3.9 or above.
- An Azure OpenAI Resource and Deployed Model. See instructions.
- Install
uv
, see the uv docs.
- 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/microsoft/semantic-kernel.git
. - Navigate to
python/samples/demos/call_automation
folder
Azure DevTunnels is an Azure service that enables you to share local web services hosted on the internet. Use the commands below 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 will then 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
Copy the .env.example
file to .env
and update the following values:
ACS_CONNECTION_STRING
: Azure Communication Service resource's connection string.CALLBACK_URI_HOST
: Base url of the app. (For local development use the dev tunnel url from the step above)AZURE_OPENAI_ENDPOINT
: Azure Open AI service endpointAZURE_OPENAI_REALTIME_DEPLOYMENT_NAME
: Azure Open AI deployment nameAZURE_OPENAI_API_VERSION
: Azure Open AI API version, this should be one that includes the realtime api, for instance '2024-10-01-preview'AZURE_OPENAI_API_KEY
: Azure Open AI API key, optionally, you can also use Entra Auth.
- Navigate to
call_automation
folder and do one of the following to start the main application:- run
call_automation.py
in debug mode from your IDE (VSCode will load your .env variables into the environment automatically, other IDE's might need an extra step). - execute
uv run --env-file .env call_automation.py
directly in your terminal (this usesuv
, which will then install the requirements in a temporary virtual environment, see uv docs for more info).
- run
- Browser should pop up with a simple page. If not navigate it to
http://localhost:8080/
or your dev tunnel url. - Register an EventGrid Webhook for the IncomingCall(
https://<devtunnelurl>/api/incomingCall
) event that points to your devtunnel URI. Instructions here.
Once that's completed you should have a running application. The way to test this is to place a call to your ACS phone number and talk to your intelligent agent!
In the terminal you should see all sorts of logs from both ACS and Semantic Kernel.