Skip to main content

Azure Communication Call Automation client library for Python

This package contains a Python SDK for Azure Communication Call Automation. Call Automation provides developers the ability to build server-based, intelligent call workflows, and call recording for voice and PSTN channels.

Overview of Call Automation | Product documentation

Disclaimer

Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691

Security notice: version 1.6.0 deprecated

Version 1.6.0 of azure-communication-callautomation is deprecated as of 2026-10-22 because of a recording URL validation security issue. This notice applies to version 1.6.0, not to the library as a whole.

In applications that pass attacker-influenced recording URLs to the synchronous download_recording or delete_recording methods using the default Requests transport, an ambiguous URL can bypass hostname validation and send an authenticated request to an unintended endpoint, potentially exposing a Bearer token.

Upgrade to 1.6.1 or a later fixed release to receive the security fix. Use only service-generated recording URLs received through trusted, integrity-protected events; do not pass untrusted recording URLs to these methods.

Refer to the release history and Azure SDK support policy for more information.

Getting started

Prerequisites

Installing

Install the Azure Communication Service Call Automation SDK.

pip install azure-communication-callautomation

Key concepts

Name Description
CallAutomationClient CallAutomationClient is the primary interface for developers using this client library. It can be used to initiate calls by createCall or answerCall. It can also be used to do recording actions such as startRecording
CallConnectionClient CallConnectionClient represents a ongoing call. Once the call is established with createCall or answerCall, further actions can be performed for the call, such as transfer or play_media.
Callback Events Callback events are events sent back during duration of the call. It gives information and state of the call, such as CallConnected. CallbackUrl must be provided during createCall and answerCall, and callback events will be sent to this url.
Incoming Call Event When incoming call happens (that can be answered with answerCall), incoming call eventgrid event will be sent. This is different from Callback events above, and should be setup on Azure portal. See Incoming Call for detail.

Recording URL security

download_recording and delete_recording accept only HTTPS URLs with ASCII DNS hostnames under *.asm.skype.com, *.asyncgw.teams.microsoft.com, or *.ams.gov.teams.microsoft.us. URLs containing user information, raw backslashes, whitespace, control characters, or malformed authorities are rejected with ValueError before authentication. Redirect destinations are subject to the same validation. Valid signed query parameters are preserved.

Use service-generated recording URLs from trusted, integrity-protected events.

Examples

Initialize CallAutomationClient

from azure.identity import DefaultAzureCredential
from azure.communication.callautomation import (CallAutomationClient)

# Your unique Azure Communication service endpoint
endpoint_url = '<ENDPOINT>'
credential = DefaultAzureCredential()
client = CallAutomationClient(endpoint_url, credential)

Create Call

from azure.communication.callautomation import (
    CallAutomationClient,
    CommunicationUserIdentifier
)

# target endpoint for ACS User
user = CommunicationUserIdentifier("8:acs:...")

# callback url to receive callback events
callback_url = "https://<MY-EVENT-HANDLER-URL>/events"

# send out the invitation, creating call
result = client.create_call(
    target_participant=user,
    callback_url=callback_url
)

# this id can be used to do further actions in the call
call_connection_id = result.call_connection_id

Play Media

# using call connection id, get call connection
call_connection = client.get_call_connection(call_connection_id)

# from callconnection of result above, play media to all participants
my_file = FileSource(url="https://<FILE-SOURCE>/<SOME-FILE>.wav")
call_connection.play_to_all(my_file)

Troubleshooting

Next steps

Provide Feedback

If you encounter any bugs or have suggestions, please file an issue in the Issues section of the project

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Metadata

Release files for azure-communication-callautomation 1.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azure-communication-callautomation 1.6.1
File Size Uploaded Provenance Actions
azure_communication_callautomation-1.6.1.tar.gz 162.7 kB Without provenance Details for azure_communication_callautomation-1.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for azure-communication-callautomation 1.6.1
File Interpreter ABI Platform Actions
azure_communication_callautomation-1.6.1-py3-none-any.whl Python 3 none any Details for azure_communication_callautomation-1.6.1-py3-none-any.whl

Total release size: 313.4 kB

Release files / azure_communication_callautomation-1.6.1.tar.gz

Download URL azure_communication_callautomation-1.6.1.tar.gz
Size 162.7 kB
Tags Source
SHA-256 checksum
How to use checksums
150008289db1d8492fe6b4f787546e26faa2fc46e3c749f3c3796c465e243622
BLAKE2b-256 checksum
How to use checksums
cd010ac23ab0c4e692bf9baab9b126993d16e0c1e1d9a89f1ad7a868320bfcc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / azure_communication_callautomation-1.6.1-py3-none-any.whl

Download URL azure_communication_callautomation-1.6.1-py3-none-any.whl
Size 150.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d071717b88bcaf99c15bd3bf6473fb109d1c26f7ff374cfb67128ec39490bdbb
BLAKE2b-256 checksum
How to use checksums
73cf58e2579477c3b4ea91e98531d23532fb2948260540f3056cab6cfd1e2f68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Security for azure-communication-callautomation 1.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page