Registry /
azure / azure-communication-callautomation
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CallAutomationClient
✓ from azure.communication.callautomation import CallAutomationClient
✗ from azure.communication.callautomation.aio import CallAutomationClient
The synchronous client is in the base module; aio is for async. Ensure correct module for sync vs async.
CallConnection
✓ from azure.communication.callautomation import CallConnection
Standard import for interacting with an active call.
PhoneNumberIdentifier
✓ from azure.communication.callautomation import PhoneNumberIdentifier
✗ from azure.communication.identity import PhoneNumberIdentifier
PhoneNumberIdentifier is re-exported from callautomation; use it directly from callautomation for convenience, but also available from azure.communication.identity.
Initializes CallAutomationClient and answers an incoming call. Requires a connection string or token credential. Callback URL must be HTTPS.
import os
from azure.communication.callautomation import CallAutomationClient, AnswerCallOptions, CallInvite, PhoneNumberIdentifier
connection_string = os.environ.get('COMMUNICATION_SERVICES_CONNECTION_STRING', '')
client = CallAutomationClient.from_connection_string(connection_string)
# Example: answer an incoming call
incoming_call_context = "incomingCallContextValue" # from event
answer_options = AnswerCallOptions(callback_url="https://example.com/callback")
result = client.answer_call(incoming_call_context=incoming_call_context, options=answer_options)
print(f"Call answered: {result.call_connection_id}")
Errors
Common errors & fixes
AttributeError: 'CallAutomationClient' object has no attribute 'create_call'
Incorrect method name or trying to use sync client with async method. The correct method is 'create_call' on sync client.
fixUse 'client.create_call(call_invite=...)' for sync. For async, use async client and 'await client.create_call(...)'.
HttpResponseError: (BadRequest) The callback URI is invalid.
The callback URL provided is not HTTPS or not publicly accessible.
fixEnsure the callback URL starts with 'https://' and is reachable from the internet.
ValueError: The connection string is not a valid Azure Communication Services connection string
The connection string format is incorrect or missing.
fixUse a connection string from Azure portal, typically 'endpoint=https://...;accesskey=...'. Alternatively, use token credential.
Upgrade
Version history
1.5.0latest on PyPI · released Sep 10, 2025
Audit
Dependencies
azure-communication-identityoptionalRequired for using CommunicationIdentityClient to get tokens for call automation
azure-corerequiredRequired for core Azure SDK functionality