Skip to content

Commit 0435d4f

Browse files
minwoolee-msftikumarapeli-msftatazimsftjuntuchen-msft
authored
[ACS] Call Automation Initial Commit of Python SDK (Azure#29273)
* Initial commit for Call Automation * Fixed test and initial input * boots trap for callautomation service client, call connection, media, and recording * add recording methods and models * Create methods and models for recognize, play, and cancelallmediaoperations (Azure#28944) * add media client * add empty call media client * add media methods and models * small fixes to get build working * add playoptions param * small fixes for play * add filesource functionality * updates after testing * add recognize event models * Juntuchen/callauotomationv4 (Azure#29059) * updated swagger * updated swagger readme.md * updated swagger * Event Parser for Python (Azure#29070) * rebase * missed merge conflicts * Improved with casting of public event Converting CommunicationIdentifier correctly * trim unnessary changes --------- Co-authored-by: Min Woo Lee 🧊 <[email protected]> * update formatting for python (Azure#29086) * remove non GA features * Juntuchen/callauotomationv4 (Azure#29113) * updated swagger * updated swagger readme.md * updated swagger * added main client methods * added signaling methods * fixed the circular import issue (Azure#29118) * fixed bug * test * updated deserialize_phone_identifier for processing the data correctly * fixed create_group_call and added media options in create calls * moved serializer to .model to avoid strange circular import issue * bug fixed * fixed bug in answer_call * fixed bug * updates in signaling methods * Initial commit for Call Automation * Fixed test and initial input * boots trap for callautomation service client, call connection, media, and recording * add recording methods and models * Create methods and models for recognize, play, and cancelallmediaoperations (Azure#28944) * add media client * add empty call media client * add media methods and models * small fixes to get build working * add playoptions param * small fixes for play * add filesource functionality * updates after testing * add recognize event models * Juntuchen/callauotomationv4 (Azure#29059) * updated swagger * updated swagger readme.md * updated swagger * remove non GA features * Event Parser for Python (Azure#29070) * rebase * missed merge conflicts * Improved with casting of public event Converting CommunicationIdentifier correctly * trim unnessary changes --------- Co-authored-by: Min Woo Lee 🧊 <[email protected]> * update formatting for python (Azure#29086) * Juntuchen/callauotomationv4 (Azure#29113) * updated swagger * updated swagger readme.md * updated swagger * added main client methods * added signaling methods * fixed the circular import issue (Azure#29118) * fixed bug * test * updated deserialize_phone_identifier for processing the data correctly * fixed create_group_call and added media options in create calls * moved serializer to .model to avoid strange circular import issue * bug fixed * fixed bug in answer_call * fixed bug * updates in signaling methods * Added ReadMe file * communicationIdentifiers serializer refactor * match dotnet sdk more closely (Azure#29250) * match dotnet sdk more closely * add missing peram * Fixing spelling, setup config, added unit testings (Azure#29243) * Fixing spelling, setup config, added unit testings * Adding CI, Adding Test, Adding Sample, Adding Changelog, Fixing bunch of lint * communicationIdentifiers serializer refactor * match dotnet sdk more closely (Azure#29250) * match dotnet sdk more closely * add missing peram * Fixing test, Fixing requirement, fixing cspell ignore, various small changes on lint * Fixing spelling, setup config, added unit testings * Adding CI, Adding Test, Adding Sample, Adding Changelog, Fixing bunch of lint * Fixing test, Fixing requirement, fixing cspell ignore, various small changes on lint * Fixing all Pylint recommandations --------- Co-authored-by: Min Woo Lee 🧊 <[email protected]> Co-authored-by: juntuchen <[email protected]> Co-authored-by: Isura Kumarapeli <[email protected]> * Fixing spelling, Fixing lint issues * Fixing links, naming * pr comments for recording (Azure#29294) * pr comments for recording * pr comments for recording * Adding description for events * update PR (Azure#29310) * removing wrong place for events, adding all models used by dev * fix CallMediaClient name and update getCallMedia description * Adding new line * fix client names * Adding all utils, fixing pylint --------- Co-authored-by: Min Woo Lee 🧊 <[email protected]> Co-authored-by: ikumarapeli <[email protected]> Co-authored-by: Adam Tazi <[email protected]> Co-authored-by: Juntu Chen <[email protected]> Co-authored-by: Isura Kumarapeli <[email protected]> Co-authored-by: Adam Tazi <[email protected]> Co-authored-by: juntuchen <[email protected]>
1 parent 744f4d0 commit 0435d4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+15295
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Release History
2+
3+
## 1.0.0b1 (Unreleased)
4+
Call Automation enables developers to build call workflows. Personalise customer interactions by listening to call events and take actions based on your business logic.
5+
6+
### Features Added
7+
- Create outbound calls to an Azure Communication Service user or a phone number.
8+
- Answer/Redirect/Reject incoming call from an Azure Communication Service user or a phone number.
9+
- Transfer the call to another participant.
10+
- List, add or remove participants from the call.
11+
- Hangup or terminate the call.
12+
- Play audio files to one or more participants in the call.
13+
- Recognize incoming DTMF in the call.
14+
- Record calls with option to start/resume/stop.
15+
- Record mixed and unmixed audio recordings.
16+
- Download recordings.
17+
- Parse various events happening in the call, such as CallConnected and PlayCompleted event.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include *.md
2+
include azure/__init__.py
3+
include azure/communication/__init__.py
4+
include LICENSE
5+
recursive-include tests *.py
6+
recursive-include samples *.py *.md
7+
include azure/communication/callautomation/py.typed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Azure Communication Call Automation client library for Python
2+
3+
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.
4+
5+
[Overview of Call Automation][overview] | [Product documentation][product_docs]
6+
7+
## _Disclaimer_
8+
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please
9+
refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
10+
11+
## Getting started
12+
### Prerequisites
13+
- Python 3.7 or later is required to use this package.
14+
- You need an [Azure subscription][azure_sub] to use this package.
15+
- A deployed Communication Services resource. You can use the [Azure Portal][azure_portal] or the [Azure PowerShell][azure_powershell] to set it up.
16+
17+
### Installing
18+
Install the Azure Communication Service Call Automation SDK.
19+
20+
```bash
21+
pip install azure-communication-callautomation
22+
```
23+
24+
## Key concepts
25+
| Name | Description |
26+
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27+
| CallAutomationClient | `CallAutomationClient` is the primary interface for developers using this client library. It can be used to initiate calls by `createCall` or `answerCall`. |
28+
| 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 `addParticipant`. |
29+
| CallMediaClient | `CallMediaClient` can be used to do media related actions, such as `play`, to play media file. This can be retrieved from established `CallConnectionClient`. |
30+
| CallRecordingClient | `CallRecordingClient` can be used to do recording related actions, such as `startRecording`. This can be retrieved from `CallAutomationClient`. |
31+
| 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. You can use `callAutomationEventParser` to parse these events when it arrives. |
32+
| 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][incomingcall] for detail. |
33+
34+
## Examples
35+
### Initialize CallAutomationClient
36+
```Python
37+
from azure.communication.callautomation import (CallAutomationClient)
38+
39+
# Your unique Azure Communication service endpoint
40+
endpoint_url = '<ENDPOINT>'
41+
client = new CallAutomationClient.from_connection_string(endpoint_url)
42+
```
43+
44+
### Create Call
45+
```Python
46+
from azure.communication.callautomation import (
47+
CallAutomationClient,
48+
CallInvite,
49+
CommunicationUserIdentifier
50+
)
51+
52+
# target endpoint for ACS User
53+
user = CommunicationUserIdentifier("8:acs:...")
54+
55+
# make invitation
56+
call_invite = CallInvite(target=user)
57+
58+
# callback url to receive callback events
59+
callback_url = "https://<MY-EVENT-HANDLER-URL>/events"
60+
61+
# send out the invitation, creating call
62+
response = client.create_call(call_invite, callback_url)
63+
```
64+
65+
### Play Media
66+
```Python
67+
# from callconnection of response above, play media of media file
68+
my_file = FileSource(uri="https://<FILE-SOURCE>/<SOME-FILE>.wav")
69+
const response = call_connection.get_call_media().play_to_all(my_file)
70+
```
71+
72+
## Troubleshooting
73+
## Next steps
74+
- [Call Automation Overview][overview]
75+
- [Incoming Call Concept][incomingcall]
76+
- [Build a customer interaction workflow using Call Automation][build1]
77+
- [Redirect inbound telephony calls with Call Automation][build2]
78+
- [Quickstart: Play action][build3]
79+
- [Quickstart: Recognize action][build4]
80+
- [Read more about Call Recording in Azure Communication Services][recording1]
81+
- [Record and download calls with Event Grid][recording2]
82+
83+
## Provide Feedback
84+
85+
If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project
86+
87+
## Contributing
88+
89+
This project welcomes contributions and suggestions. Most contributions require
90+
you to agree to a Contributor License Agreement (CLA) declaring that you have
91+
the right to, and actually do, grant us the rights to use your contribution.
92+
For details, visit https://cla.microsoft.com.
93+
94+
When you submit a pull request, a CLA-bot will automatically determine whether
95+
you need to provide a CLA and decorate the PR appropriately (e.g., label,
96+
comment). Simply follow the instructions provided by the bot. You will only
97+
need to do this once across all repos using our CLA.
98+
99+
This project has adopted the
100+
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
101+
see the Code of Conduct FAQ or contact [email protected] with any
102+
additional questions or comments.
103+
104+
<!-- LINKS -->
105+
[overview]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/call-automation
106+
[product_docs]: https://docs.microsoft.com/azure/communication-services/overview
107+
[azure_cli]: https://docs.microsoft.com/cli/azure
108+
[azure_sub]: https://azure.microsoft.com/free/
109+
[azure_portal]: https://portal.azure.com
110+
[azure_powershell]: https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice
111+
[build_doc]: https://aka.ms/AzureSDKBundling
112+
[incomingcall]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/incoming-call-notification
113+
[build1]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/callflows-for-customer-interactions?pivots=programming-language-csha
114+
[build2]: https://learn.microsoft.com/azure/communication-services/how-tos/call-automation-sdk/redirect-inbound-telephony-calls?pivots=programming-language-csharp
115+
[build3]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/play-action?pivots=programming-language-csharp
116+
[build4]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/recognize-action?pivots=programming-language-csharp
117+
[recording1]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/call-recording
118+
[recording2]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/get-started-call-recording?pivots=programming-language-csharp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
from ._version import VERSION
2+
from ._call_connection_client import CallConnectionClient
3+
from ._call_media_client import CallMediaClient
4+
from ._call_recording_client import CallRecordingClient
5+
from ._call_automation_client import (
6+
CallAutomationClient,
7+
AnswerCallResult,
8+
CreateCallResult
9+
)
10+
from ._call_automation_event_parser import CallAutomationEventParser
11+
from ._models import (
12+
RecordingStateResponse,
13+
StartRecordingOptions,
14+
ServerCallLocator,
15+
GroupCallLocator,
16+
CallInvite,
17+
RecordingFormat,
18+
RecordingContent,
19+
RecordingStorage,
20+
RecordingChannel,
21+
PlaySource,
22+
FileSource,
23+
CallMediaRecognizeOptions,
24+
CallConnectionProperties,
25+
CallParticipant,
26+
CallMediaRecognizeDtmfOptions,
27+
Gender,
28+
DtmfTone,
29+
CallRejectReason
30+
)
31+
from ._shared.models import (
32+
CommunicationIdentifier,
33+
PhoneNumberIdentifier,
34+
MicrosoftTeamsUserIdentifier,
35+
CommunicationUserIdentifier
36+
)
37+
from ._events import (
38+
AddParticipantSucceeded,
39+
AddParticipantFailed,
40+
CallConnected,
41+
CallDisconnected,
42+
CallTransferAccepted,
43+
CallTransferFailed,
44+
ParticipantsUpdated,
45+
RecordingStateChanged,
46+
PlayCompleted,
47+
PlayFailed,
48+
PlayCanceled,
49+
RecognizeCompleted,
50+
RecognizeCanceled,
51+
RecognizeFailed
52+
)
53+
from ._generated.models import (
54+
GetParticipantsResponse,
55+
TransferCallResponse,
56+
AddParticipantResponse,
57+
CustomContext,
58+
RemoveParticipantResponse
59+
)
60+
61+
__all__ = [
62+
'CallAutomationClient',
63+
'RecordingFormat',
64+
'RecordingContent',
65+
'RecordingStorage',
66+
'RecordingChannel',
67+
'CallConnectionClient',
68+
'CallMediaClient',
69+
'CallRecordingClient',
70+
"StartRecordingOptions",
71+
"RecordingStateResponse",
72+
"ServerCallLocator",
73+
"GroupCallLocator",
74+
"CallAutomationEventParser",
75+
"AddParticipantSucceeded",
76+
"AddParticipantFailed",
77+
"CallConnected",
78+
"CallDisconnected",
79+
"CallTransferAccepted",
80+
"CallTransferFailed",
81+
"ParticipantsUpdated",
82+
"RecordingStateChanged",
83+
"PlayCompleted",
84+
"PlayFailed",
85+
"PlayCanceled",
86+
"RecognizeCompleted",
87+
"RecognizeCanceled",
88+
"RecognizeFailed",
89+
"CallInvite",
90+
"CommunicationIdentifier",
91+
"CommunicationUserIdentifier",
92+
"PhoneNumberIdentifier",
93+
"MicrosoftTeamsUserIdentifier",
94+
"PlaySource",
95+
"FileSource",
96+
"CallMediaRecognizeOptions",
97+
"CallMediaRecognizeDtmfOptions",
98+
"AnswerCallResult",
99+
"CreateCallResult",
100+
"CallConnectionProperties",
101+
"CallParticipant",
102+
"GetParticipantsResponse",
103+
"TransferCallResponse",
104+
"AddParticipantResponse",
105+
"CustomContext",
106+
"RemoveParticipantResponse",
107+
"Gender",
108+
"DtmfTone",
109+
"CallRejectReason"
110+
]
111+
__version__ = VERSION
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ------------------------------------
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT License.
4+
# ------------------------------------
5+
6+
from enum import Enum
7+
from azure.core import CaseInsensitiveEnumMeta
8+
9+
class ApiVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta):
10+
V2023_01_15_PREVIEW = "2023-01-15-preview"
11+
12+
DEFAULT_VERSION = ApiVersion.V2023_01_15_PREVIEW

0 commit comments

Comments
 (0)