{"id":26765,"library":"azure-communication-callautomation","title":"Azure Communication Call Automation Client Library for Python","description":"Microsoft Azure Communication Call Automation Client Library for Python, version 1.5.0. Provides APIs to manage and automate voice calls, including answering, connecting, and playing audio. Released monthly with the Azure SDK for Python.","status":"active","version":"1.5.0","language":"python","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python","tags":["azure","communication","call-automation","telephony","voip"],"install":[{"cmd":"pip install azure-communication-callautomation","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for using CommunicationIdentityClient to get tokens for call automation","package":"azure-communication-identity","optional":true},{"reason":"Required for core Azure SDK functionality","package":"azure-core","optional":false}],"imports":[{"note":"The synchronous client is in the base module; aio is for async. Ensure correct module for sync vs async.","wrong":"from azure.communication.callautomation.aio import CallAutomationClient","symbol":"CallAutomationClient","correct":"from azure.communication.callautomation import CallAutomationClient"},{"note":"Standard import for interacting with an active call.","wrong":null,"symbol":"CallConnection","correct":"from azure.communication.callautomation import CallConnection"},{"note":"PhoneNumberIdentifier is re-exported from callautomation; use it directly from callautomation for convenience, but also available from azure.communication.identity.","wrong":"from azure.communication.identity import PhoneNumberIdentifier","symbol":"PhoneNumberIdentifier","correct":"from azure.communication.callautomation import PhoneNumberIdentifier"}],"quickstart":{"code":"import os\nfrom azure.communication.callautomation import CallAutomationClient, AnswerCallOptions, CallInvite, PhoneNumberIdentifier\n\nconnection_string = os.environ.get('COMMUNICATION_SERVICES_CONNECTION_STRING', '')\nclient = CallAutomationClient.from_connection_string(connection_string)\n\n# Example: answer an incoming call\nincoming_call_context = \"incomingCallContextValue\"  # from event\nanswer_options = AnswerCallOptions(callback_url=\"https://example.com/callback\")\nresult = client.answer_call(incoming_call_context=incoming_call_context, options=answer_options)\nprint(f\"Call answered: {result.call_connection_id}\")","lang":"python","description":"Initializes CallAutomationClient and answers an incoming call. Requires a connection string or token credential. Callback URL must be HTTPS."},"warnings":[{"fix":"Provide callback_url when creating AnswerCallOptions. Do not pass operation_context.","message":"In version 1.5.0, the 'AnswerCallOptions' constructor changed: 'callback_url' is now required, and 'operation_context' is deprecated. Use 'options' parameter in answer_call.","severity":"breaking","affected_versions":"1.5.0"},{"fix":"Use a publicly accessible HTTPS endpoint. For local development, use tools like ngrok.","message":"The 'CallAutomationClient' requires a valid 'callback_url' for all operations that receive events (answer, createCall, etc.). The callback URL must be publicly accessible HTTPS endpoint. Localhost will not work.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace PlayAudioOptions with PlayOptions and set 'loop' accordingly.","message":"Using 'PlayAudioOptions' with 'loop' parameter is deprecated in 1.5.0. Use 'PlayOptions' with 'loop' parameter instead.","severity":"deprecated","affected_versions":">=1.5.0"},{"fix":"Store call connection id and recreate CallConnection if needed. Listen for call disconnect events to clean up.","message":"The 'CallConnection' object is only valid for the duration of the call. Once the call is disconnected, any method call on it will raise an exception.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'client.create_call(call_invite=...)' for sync. For async, use async client and 'await client.create_call(...)'.","cause":"Incorrect method name or trying to use sync client with async method. The correct method is 'create_call' on sync client.","error":"AttributeError: 'CallAutomationClient' object has no attribute 'create_call'"},{"fix":"Ensure the callback URL starts with 'https://' and is reachable from the internet.","cause":"The callback URL provided is not HTTPS or not publicly accessible.","error":"HttpResponseError: (BadRequest) The callback URI is invalid."},{"fix":"Use a connection string from Azure portal, typically 'endpoint=https://...;accesskey=...'. Alternatively, use token credential.","cause":"The connection string format is incorrect or missing.","error":"ValueError: The connection string is not a valid Azure Communication Services connection string"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}