This commit is contained in:
azure-sdk 2024-08-07 01:53:07 +00:00
Родитель aea365d773
Коммит fe8d46254b
2 изменённых файлов: 61 добавлений и 7 удалений

Просмотреть файл

@ -1,12 +1,12 @@
--- ---
title: Azure Communication Call Automation Service client library for Java title: Azure Communication Call Automation Service client library for Java
keywords: Azure, java, SDK, API, azure-communication-callautomation, communication keywords: Azure, java, SDK, API, azure-communication-callautomation, communication
ms.date: 08/17/2023 ms.date: 08/07/2024
ms.topic: reference ms.topic: reference
ms.devlang: java ms.devlang: java
ms.service: communication ms.service: communication
--- ---
# Azure Communication Call Automation Service client library for Java - version 1.1.0-beta.1 # Azure Communication Call Automation Service client library for Java - version 1.3.0-beta.1
This package contains a Java SDK for Azure Communication Call Automation Service. This package contains a Java SDK for Azure Communication Call Automation Service.
@ -26,13 +26,15 @@ This package contains a Java SDK for Azure Communication Call Automation Service
### Include the package ### Include the package
[//]: # ({x-version-update-start;com.azure:azure-communication-callautomation;current}) [//]: # ({x-version-update-start;com.azure:azure-communication-callautomation;current})
```xml ```xml
<dependency> <dependency>
<groupId>com.azure</groupId> <groupId>com.azure</groupId>
<artifactId>azure-communication-callautomation</artifactId> <artifactId>azure-communication-callautomation</artifactId>
<version>1.1.0-beta.1</version> <version>1.1.0</version>
</dependency> </dependency>
``` ```
[//]: # ({x-version-update-end}) [//]: # ({x-version-update-end})
## Key concepts ## Key concepts
@ -50,7 +52,58 @@ This is the restart of Call Automation Service. It is renamed to Call Automation
## Examples ## Examples
To be determined. ### Handle Mid-Connection events with CallAutomation's EventProcessor
To easily handle mid-connection events, Call Automation's SDK provides easier way to handle these events.
Take a look at `CallAutomationEventProcessor`. This will ensure correlation between call and events more easily.
```Java
@RestController
public class ActionController {
// Controller implementation...
@RequestMapping(value = "/api/events", method = POST)
public ResponseEntity<?> handleCallEvents(@RequestBody String requestBody) {
try {
CallAutomationAsyncClient client = getCallAutomationAsyncClient();
client.getEventProcessor().processEvents(requestBody);
return new ResponseEntity<>(HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}
```
`processEvents` is required for EventProcessor to work.
After event is being consumed by EventProcessor, you can start using its feature.
See below for example: where you are making a call with `CreateCall`, and wait for `CallConnected` event of the call.
```Java
public class commandClass {
// Class implementation...
public void createCallCommand() {
CallAutomationAsyncClient client = getCallAutomationAsyncClient(); // Should be the same instance as the one used in the example above.
String callbackUrl = "<YOUR_CALL_BACK_URL>";
CallInvite callInvite = new CallInvite(new CommunicationUserIdentifier("<TARGET_USER_ID>"));
CreateCallResult result = client.createCall(callInvite, callbackUrl).block();
try {
// This will wait until CallConnected event is arrived or Timesout!
CreateCallEventResult eventResult = result.waitForEventProcessorAsync(Duration.ofSeconds(30)).block();
CallConnected returnedEvent = eventResult.successResult();
} catch (Exception e) {
// Timeout exception happend!
// Call likely was never answered.
}
}
}
```
If timeout was not set when calling "waitForEventProcessorAsync", the default timeout is 4 minutes.
## Troubleshooting ## Troubleshooting
@ -69,6 +122,7 @@ When you submit a pull request, a CLA-bot will automatically determine whether y
This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments. This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact [opencode@microsoft.com][coc_contact] with any additional questions or comments.
## Next steps ## Next steps
- [Call Automation Overview][overview] - [Call Automation Overview][overview]
- [Incoming Call Concept][incomingcall] - [Incoming Call Concept][incomingcall]
- [Build a customer interaction workflow using Call Automation][build1] - [Build a customer interaction workflow using Call Automation][build1]
@ -87,7 +141,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[product_docs]: /azure/communication-services/ [product_docs]: /azure/communication-services/
[package]: https://dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-for-java-communication-interaction [package]: https://dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-for-java-communication-interaction
[api_documentation]: https://aka.ms/java-docs [api_documentation]: https://aka.ms/java-docs
[source]: https://github.com/Azure/azure-sdk-for-java/tree/azure-communication-callautomation_1.1.0-beta.1/sdk/communication/azure-communication-callautomation/src [source]: https://github.com/Azure/azure-sdk-for-java/tree/azure-communication-callautomation_1.3.0-beta.1/sdk/communication/azure-communication-callautomation/src
[overview]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/call-automation [overview]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/call-automation
[incomingcall]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/incoming-call-notification [incomingcall]: https://learn.microsoft.com/azure/communication-services/concepts/voice-video-calling/incoming-call-notification
[build1]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/callflows-for-customer-interactions?pivots=programming-language-java [build1]: https://learn.microsoft.com/azure/communication-services/quickstarts/voice-video-calling/callflows-for-customer-interactions?pivots=programming-language-java

Просмотреть файл

@ -1,6 +1,6 @@
{ {
"Name": "azure-communication-callautomation", "Name": "azure-communication-callautomation",
"Version": "1.1.0-beta.1", "Version": "1.3.0-beta.1",
"DevVersion": null, "DevVersion": null,
"DirectoryPath": "sdk/communication/azure-communication-callautomation", "DirectoryPath": "sdk/communication/azure-communication-callautomation",
"ServiceDirectory": "communication", "ServiceDirectory": "communication",
@ -10,7 +10,7 @@
"SdkType": "client", "SdkType": "client",
"IsNewSdk": true, "IsNewSdk": true,
"ArtifactName": "azure-communication-callautomation", "ArtifactName": "azure-communication-callautomation",
"ReleaseStatus": "2023-08-17", "ReleaseStatus": "2024-08-06",
"Namespaces": [ "Namespaces": [
"com.azure.communication.callautomation", "com.azure.communication.callautomation",
"com.azure.communication.callautomation.models", "com.azure.communication.callautomation.models",