Skip to main content

Microsoft Azure Communication Call Automation Client Library for Python

Project description

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

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.

Examples

Initialize CallAutomationClient

from azure.communication.callautomation import (CallAutomationClient)

# Your unique Azure Communication service endpoint
endpoint_url = '<ENDPOINT>'
client = CallAutomationClient.from_connection_string(endpoint_url)

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(user, 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_media(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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure-communication-callautomation-1.1.0b1.zip (149.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file azure-communication-callautomation-1.1.0b1.zip.

File metadata

File hashes

Hashes for azure-communication-callautomation-1.1.0b1.zip
Algorithm Hash digest
SHA256 54b0a59c81d9d7c61de048936b1f884252f72ad70fb2a6f6286d0f1d2b9bfbb2
MD5 5915de23a75879c8e39c6d697b6bc100
BLAKE2b-256 9930f4abab7a7b9ab7533c7cd1c618394f70114ea684b72da519df5d59241bdb

See more details on using hashes here.

File details

Details for the file azure_communication_callautomation-1.1.0b1-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_communication_callautomation-1.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 88ba84ba2853c3222e8fd618bc1f053ee52b763aca416d7e7327df154ffecb21
MD5 ed90f2589dd69d5c6f6fa7325c20a5c0
BLAKE2b-256 df91ac86df837e6596f21b9e756e2f4009bc520e91717109d64fce53294700d6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page