Skip to content

Commit 728ab89

Browse files
authored
Java Added backupCognitiveServicesEndpoint to CallIntelligenceOptions (Azure#43826)
* Added backupCognitiveServicesEndpoint to CallIntelligenceOptions * Updated backup cognitive service
1 parent 76fa8c6 commit 728ab89

File tree

15 files changed

+1095
-12
lines changed

15 files changed

+1095
-12
lines changed

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/CallAutomationAsyncClient.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ private CreateCallRequestInternal getCreateCallRequestInternal(CreateCallOptions
230230
callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal();
231231
callIntelligenceOptionsInternal.setCognitiveServicesEndpoint(
232232
createCallOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint());
233+
234+
if (createCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) {
235+
callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint(
236+
createCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint());
237+
}
233238
}
234239

235240
CreateCallRequestInternal request = new CreateCallRequestInternal()
@@ -278,6 +283,11 @@ private CreateCallRequestInternal getCreateCallRequestInternal(CreateGroupCallOp
278283
callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal();
279284
callIntelligenceOptionsInternal.setCognitiveServicesEndpoint(
280285
createCallGroupOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint());
286+
287+
if (createCallGroupOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) {
288+
callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint(
289+
createCallGroupOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint());
290+
}
281291
}
282292

283293
CreateCallRequestInternal request = new CreateCallRequestInternal()
@@ -383,6 +393,12 @@ Mono<Response<AnswerCallResult>> answerCallWithResponseInternal(AnswerCallOption
383393
CallIntelligenceOptionsInternal callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal();
384394
callIntelligenceOptionsInternal.setCognitiveServicesEndpoint(
385395
answerCallOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint());
396+
397+
if (answerCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) {
398+
callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint(
399+
answerCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint());
400+
}
401+
386402
request.setCallIntelligenceOptions(callIntelligenceOptionsInternal);
387403
}
388404

@@ -581,6 +597,12 @@ Mono<Response<ConnectCallResult>> connectCallWithResponseInternal(ConnectCallOpt
581597
CallIntelligenceOptionsInternal callIntelligenceOptionsInternal = new CallIntelligenceOptionsInternal();
582598
callIntelligenceOptionsInternal.setCognitiveServicesEndpoint(
583599
connectCallOptions.getCallIntelligenceOptions().getCognitiveServicesEndpoint());
600+
601+
if (connectCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint() != null) {
602+
callIntelligenceOptionsInternal.setBackupCognitiveServicesEndpoint(
603+
connectCallOptions.getCallIntelligenceOptions().getBackupCognitiveServicesEndpoint());
604+
}
605+
584606
request.setCallIntelligenceOptions(callIntelligenceOptionsInternal);
585607
}
586608

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/CallRecordingsImpl.java

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package com.azure.communication.callautomation.implementation;
66

77
import com.azure.communication.callautomation.implementation.models.CommunicationErrorResponseException;
8+
import com.azure.communication.callautomation.implementation.models.RecordingResultResponse;
89
import com.azure.communication.callautomation.implementation.models.RecordingStateResponseInternal;
910
import com.azure.communication.callautomation.implementation.models.StartCallRecordingRequestInternal;
1011
import com.azure.core.annotation.BodyParam;
@@ -63,7 +64,7 @@ public final class CallRecordingsImpl {
6364
@ServiceInterface(name = "AzureCommunicationCa")
6465
public interface CallRecordingsService {
6566
@Post("/calling/recordings")
66-
@ExpectedResponses({ 200, 202 })
67+
@ExpectedResponses({ 200 })
6768
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
6869
Mono<Response<RecordingStateResponseInternal>> startRecording(@HostParam("endpoint") String endpoint,
6970
@QueryParam("api-version") String apiVersion,
@@ -99,6 +100,13 @@ Mono<Response<Void>> pauseRecording(@HostParam("endpoint") String endpoint,
99100
Mono<Response<Void>> resumeRecording(@HostParam("endpoint") String endpoint,
100101
@PathParam("recordingId") String recordingId, @QueryParam("api-version") String apiVersion,
101102
@HeaderParam("Accept") String accept, Context context);
103+
104+
@Get("/calling/recordings/{recordingId}/result")
105+
@ExpectedResponses({ 200 })
106+
@UnexpectedResponseExceptionType(CommunicationErrorResponseException.class)
107+
Mono<Response<RecordingResultResponse>> getRecordingResult(@HostParam("endpoint") String endpoint,
108+
@PathParam("recordingId") String recordingId, @QueryParam("api-version") String apiVersion,
109+
@HeaderParam("Accept") String accept, Context context);
102110
}
103111

104112
/**
@@ -566,4 +574,97 @@ public Response<Void> resumeRecordingWithResponse(String recordingId, Context co
566574
public void resumeRecording(String recordingId) {
567575
resumeRecordingWithResponse(recordingId, Context.NONE);
568576
}
577+
578+
/**
579+
* Get recording result. This includes the download URLs for the recording chunks.
580+
*
581+
* @param recordingId The recording id.
582+
* @throws IllegalArgumentException thrown if parameters fail the validation.
583+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
584+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
585+
* @return recording result along with {@link Response} on successful completion of {@link Mono}.
586+
*/
587+
@ServiceMethod(returns = ReturnType.SINGLE)
588+
public Mono<Response<RecordingResultResponse>> getRecordingResultWithResponseAsync(String recordingId) {
589+
final String accept = "application/json";
590+
return FluxUtil.withContext(context -> service.getRecordingResult(this.client.getEndpoint(), recordingId,
591+
this.client.getApiVersion(), accept, context));
592+
}
593+
594+
/**
595+
* Get recording result. This includes the download URLs for the recording chunks.
596+
*
597+
* @param recordingId The recording id.
598+
* @param context The context to associate with this operation.
599+
* @throws IllegalArgumentException thrown if parameters fail the validation.
600+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
601+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
602+
* @return recording result along with {@link Response} on successful completion of {@link Mono}.
603+
*/
604+
@ServiceMethod(returns = ReturnType.SINGLE)
605+
public Mono<Response<RecordingResultResponse>> getRecordingResultWithResponseAsync(String recordingId,
606+
Context context) {
607+
final String accept = "application/json";
608+
return service.getRecordingResult(this.client.getEndpoint(), recordingId, this.client.getApiVersion(), accept,
609+
context);
610+
}
611+
612+
/**
613+
* Get recording result. This includes the download URLs for the recording chunks.
614+
*
615+
* @param recordingId The recording id.
616+
* @throws IllegalArgumentException thrown if parameters fail the validation.
617+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
618+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
619+
* @return recording result on successful completion of {@link Mono}.
620+
*/
621+
@ServiceMethod(returns = ReturnType.SINGLE)
622+
public Mono<RecordingResultResponse> getRecordingResultAsync(String recordingId) {
623+
return getRecordingResultWithResponseAsync(recordingId).flatMap(res -> Mono.justOrEmpty(res.getValue()));
624+
}
625+
626+
/**
627+
* Get recording result. This includes the download URLs for the recording chunks.
628+
*
629+
* @param recordingId The recording id.
630+
* @param context The context to associate with this operation.
631+
* @throws IllegalArgumentException thrown if parameters fail the validation.
632+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
633+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
634+
* @return recording result on successful completion of {@link Mono}.
635+
*/
636+
@ServiceMethod(returns = ReturnType.SINGLE)
637+
public Mono<RecordingResultResponse> getRecordingResultAsync(String recordingId, Context context) {
638+
return getRecordingResultWithResponseAsync(recordingId, context)
639+
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
640+
}
641+
642+
/**
643+
* Get recording result. This includes the download URLs for the recording chunks.
644+
*
645+
* @param recordingId The recording id.
646+
* @param context The context to associate with this operation.
647+
* @throws IllegalArgumentException thrown if parameters fail the validation.
648+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
649+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
650+
* @return recording result along with {@link Response}.
651+
*/
652+
@ServiceMethod(returns = ReturnType.SINGLE)
653+
public Response<RecordingResultResponse> getRecordingResultWithResponse(String recordingId, Context context) {
654+
return getRecordingResultWithResponseAsync(recordingId, context).block();
655+
}
656+
657+
/**
658+
* Get recording result. This includes the download URLs for the recording chunks.
659+
*
660+
* @param recordingId The recording id.
661+
* @throws IllegalArgumentException thrown if parameters fail the validation.
662+
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
663+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
664+
* @return recording result.
665+
*/
666+
@ServiceMethod(returns = ReturnType.SINGLE)
667+
public RecordingResultResponse getRecordingResult(String recordingId) {
668+
return getRecordingResultWithResponse(recordingId, Context.NONE).getValue();
669+
}
569670
}

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallIntelligenceOptionsInternal.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public final class CallIntelligenceOptionsInternal implements JsonSerializable<C
2121
*/
2222
private String cognitiveServicesEndpoint;
2323

24+
/*
25+
* A backup identifier of the Cognitive Service resource assigned to this call.
26+
*/
27+
private String backupCognitiveServicesEndpoint;
28+
2429
/**
2530
* Creates an instance of CallIntelligenceOptionsInternal class.
2631
*/
@@ -49,13 +54,36 @@ public CallIntelligenceOptionsInternal setCognitiveServicesEndpoint(String cogni
4954
return this;
5055
}
5156

57+
/**
58+
* Get the backupCognitiveServicesEndpoint property: A backup identifier of the Cognitive Service resource assigned
59+
* to this call.
60+
*
61+
* @return the backupCognitiveServicesEndpoint value.
62+
*/
63+
public String getBackupCognitiveServicesEndpoint() {
64+
return this.backupCognitiveServicesEndpoint;
65+
}
66+
67+
/**
68+
* Set the backupCognitiveServicesEndpoint property: A backup identifier of the Cognitive Service resource assigned
69+
* to this call.
70+
*
71+
* @param backupCognitiveServicesEndpoint the backupCognitiveServicesEndpoint value to set.
72+
* @return the CallIntelligenceOptionsInternal object itself.
73+
*/
74+
public CallIntelligenceOptionsInternal setBackupCognitiveServicesEndpoint(String backupCognitiveServicesEndpoint) {
75+
this.backupCognitiveServicesEndpoint = backupCognitiveServicesEndpoint;
76+
return this;
77+
}
78+
5279
/**
5380
* {@inheritDoc}
5481
*/
5582
@Override
5683
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
5784
jsonWriter.writeStartObject();
5885
jsonWriter.writeStringField("cognitiveServicesEndpoint", this.cognitiveServicesEndpoint);
86+
jsonWriter.writeStringField("backupCognitiveServicesEndpoint", this.backupCognitiveServicesEndpoint);
5987
return jsonWriter.writeEndObject();
6088
}
6189

@@ -77,6 +105,8 @@ public static CallIntelligenceOptionsInternal fromJson(JsonReader jsonReader) th
77105

78106
if ("cognitiveServicesEndpoint".equals(fieldName)) {
79107
deserializedCallIntelligenceOptionsInternal.cognitiveServicesEndpoint = reader.getString();
108+
} else if ("backupCognitiveServicesEndpoint".equals(fieldName)) {
109+
deserializedCallIntelligenceOptionsInternal.backupCognitiveServicesEndpoint = reader.getString();
80110
} else {
81111
reader.skipChildren();
82112
}

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallLocatorInternal.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public final class CallLocatorInternal implements JsonSerializable<CallLocatorIn
2727
private String serverCallId;
2828

2929
/*
30-
* The Acs room id
30+
* The Acs room id. (Not supported for Start Recording)
3131
*/
3232
private String roomId;
3333

@@ -83,7 +83,7 @@ public CallLocatorInternal setServerCallId(String serverCallId) {
8383
}
8484

8585
/**
86-
* Get the roomId property: The Acs room id.
86+
* Get the roomId property: The Acs room id. (Not supported for Start Recording).
8787
*
8888
* @return the roomId value.
8989
*/
@@ -92,7 +92,7 @@ public String getRoomId() {
9292
}
9393

9494
/**
95-
* Set the roomId property: The Acs room id.
95+
* Set the roomId property: The Acs room id. (Not supported for Start Recording).
9696
*
9797
* @param roomId the roomId value to set.
9898
* @return the CallLocatorInternal object itself.

sdk/communication/azure-communication-callautomation/src/main/java/com/azure/communication/callautomation/implementation/models/CallLocatorKindInternal.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111
* The call locator kind.
1212
*/
1313
public final class CallLocatorKindInternal extends ExpandableStringEnum<CallLocatorKindInternal> {
14-
/**
15-
* Static value unknown for CallLocatorKindInternal.
16-
*/
17-
public static final CallLocatorKindInternal UNKNOWN = fromString("unknown");
18-
1914
/**
2015
* Static value groupCallLocator for CallLocatorKindInternal.
2116
*/

0 commit comments

Comments
 (0)