Skip to content

Commit

Permalink
Added new models for Mixed Audio Feature (#23840)
Browse files Browse the repository at this point in the history
* Added model changes for Mixed Audio feature.

* Updated Server Client to take Mixed Audio params

* Recorded live tests for the changes in Mixed Audio feature

* Recorded more live tests

* Recorded live tests for java sdk

* Updated live tests and exposed models to public APIs

* Changed the imports for new models

* Fixed an import

* recorded test and merge with main

* updating a test record session

* Updating javadoc

* Indentation resolved

* indentation issue resolved

Co-authored-by: Ninika Sharma <ninsharm@microsoft.com>
  • Loading branch information
ninikasharma and ninsharm authored Sep 10, 2021
1 parent bb2763e commit 54bcb45
Show file tree
Hide file tree
Showing 45 changed files with 1,061 additions and 654 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.0.0-beta.6 (Unreleased)
### Features Added
- Add support for TokenCredential authentication with CallingServerClientBuilder.
- Added support for custom options(Recordingcontenttype, Recordingchanneltype, Recordingformattype) for Mixed Audio feature

## 1.0.0-beta.5 (2021-08-30)
### Dependency updates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
* Versions of CallingServer service supported by this client library.
*/
public enum CallingServerServiceVersion implements ServiceVersion {
V2021_06_15_PREVIEW("2021-06-15-preview");
V2021_06_15_PREVIEW("2021-06-15-preview"),
V2021_08_30_PREVIEW("2021-08-30-preview");

private final String version;

Expand All @@ -31,6 +32,6 @@ public String getVersion() {
* @return The latest {@link CallingServerServiceVersion} object.
*/
public static CallingServerServiceVersion getLatest() {
return V2021_06_15_PREVIEW;
return V2021_08_30_PREVIEW;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

package com.azure.communication.callingserver;

import com.azure.communication.callingserver.models.RecordingChannelType;
import com.azure.communication.callingserver.models.RecordingContentType;
import com.azure.communication.callingserver.models.RecordingFormatType;
import com.azure.communication.callingserver.models.AddParticipantResult;
import com.azure.communication.callingserver.models.CallRecordingProperties;
import com.azure.communication.callingserver.models.CallingServerErrorException;
Expand Down Expand Up @@ -117,7 +120,26 @@ public Response<Void> removeParticipantWithResponse(String participantId, final
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public StartCallRecordingResult startRecording(String recordingStateCallbackUri) {
return serverCallAsync.startRecording(recordingStateCallbackUri).block();
return startRecording(recordingStateCallbackUri, null, null, null);
}

/**
* Start recording of the call.
*
* @param recordingStateCallbackUri Uri to send state change callbacks.
* @param recordingChannelType recordingChannelType to send custom options
* @param recordingContentType recordingContentType to send custom options
* @param recordingFormatType recordingFormatType to send custom options
* @throws CallingServerErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return Result for a successful start recording request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public StartCallRecordingResult startRecording(String recordingStateCallbackUri,
RecordingChannelType recordingChannelType,
RecordingContentType recordingContentType,
RecordingFormatType recordingFormatType) {
return serverCallAsync.startRecording(recordingStateCallbackUri, recordingChannelType, recordingContentType, recordingFormatType).block();
}

/**
Expand All @@ -133,7 +155,29 @@ public StartCallRecordingResult startRecording(String recordingStateCallbackUri)
public Response<StartCallRecordingResult> startRecordingWithResponse(
String recordingStateCallbackUri,
final Context context) {
return serverCallAsync.startRecordingWithResponse(recordingStateCallbackUri, context).block();
return serverCallAsync.startRecordingWithResponse(recordingStateCallbackUri, context, null, null, null).block();
}

/**
* Start recording of the call.
*
* @param recordingStateCallbackUri Uri to send state change callbacks.
* @param recordingChannelType recordingChannelType to send custom options
* @param recordingContentType recordingContentType to send custom options
* @param recordingFormatType recordingFormatType to send custom options
* @param context A {@link Context} representing the request context.
* @throws CallingServerErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return Result for a successful start recording request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<StartCallRecordingResult> startRecordingWithResponse(
String recordingStateCallbackUri,
final Context context,
RecordingChannelType recordingChannelType,
RecordingContentType recordingContentType,
RecordingFormatType recordingFormatType) {
return serverCallAsync.startRecordingWithResponse(recordingStateCallbackUri, context, recordingChannelType, recordingContentType, recordingFormatType).block();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import com.azure.communication.callingserver.implementation.models.AddParticipantRequest;
import com.azure.communication.callingserver.implementation.models.CommunicationErrorResponseException;
import com.azure.communication.callingserver.implementation.models.PlayAudioRequest;
import com.azure.communication.callingserver.models.RecordingChannelType;
import com.azure.communication.callingserver.models.RecordingContentType;
import com.azure.communication.callingserver.models.RecordingFormatType;
import com.azure.communication.callingserver.implementation.models.StartCallRecordingRequest;
import com.azure.communication.callingserver.models.AddParticipantResult;
import com.azure.communication.callingserver.models.CallRecordingProperties;
Expand Down Expand Up @@ -196,13 +199,36 @@ Mono<Response<Void>> removeParticipantWithResponse(String participantId, Context
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<StartCallRecordingResult> startRecording(String recordingStateCallbackUri) {
return startRecording(recordingStateCallbackUri, null, null, null);
}

/**
* Start recording of the call.
*
* @param recordingStateCallbackUri Uri to send state change callbacks.
* @param recordingChannelType recordingChannelType to send custom options
* @param recordingContentType recordingContentType to send custom options
* @param recordingFormatType recordingFormatType to send custom options
* @throws InvalidParameterException is recordingStateCallbackUri is absolute uri.
* @throws CallingServerErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return Response for a successful start recording request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<StartCallRecordingResult> startRecording(String recordingStateCallbackUri,
RecordingChannelType recordingChannelType,
RecordingContentType recordingContentType,
RecordingFormatType recordingFormatType) {
try {
Objects.requireNonNull(recordingStateCallbackUri, "'recordingStateCallbackUri' cannot be null.");
if (!Boolean.TRUE.equals(new URI(recordingStateCallbackUri).isAbsolute())) {
throw logger.logExceptionAsError(new InvalidParameterException("'recordingStateCallbackUri' has to be an absolute Uri"));
}
StartCallRecordingRequest request = new StartCallRecordingRequest();
request.setRecordingStateCallbackUri(recordingStateCallbackUri);
request.setRecordingChannelType(recordingChannelType);
request.setRecordingContentType(recordingContentType);
request.setRecordingFormatType(recordingFormatType);
return serverCallInternal.startRecordingAsync(serverCallId, request)
.onErrorMap(CommunicationErrorResponseException.class, CallingServerErrorConverter::translateException)
.flatMap(result -> Mono.just(new StartCallRecordingResult(result.getRecordingId())));
Expand All @@ -224,19 +250,25 @@ public Mono<StartCallRecordingResult> startRecording(String recordingStateCallba
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<StartCallRecordingResult>> startRecordingWithResponse(String recordingStateCallbackUri) {
return startRecordingWithResponse(recordingStateCallbackUri, null);
return startRecordingWithResponse(recordingStateCallbackUri, null, null, null, null);
}

Mono<Response<StartCallRecordingResult>> startRecordingWithResponse(
String recordingStateCallbackUri,
Context context) {
Context context,
RecordingChannelType recordingChannelType,
RecordingContentType recordingContentType,
RecordingFormatType recordingFormatType) {
try {
Objects.requireNonNull(recordingStateCallbackUri, "'recordingStateCallbackUri' cannot be null.");
if (!Boolean.TRUE.equals(new URI(recordingStateCallbackUri).isAbsolute())) {
throw logger.logExceptionAsError(new InvalidParameterException("'recordingStateCallbackUri' has to be an absolute Uri"));
}
StartCallRecordingRequest request = new StartCallRecordingRequest();
request.setRecordingStateCallbackUri(recordingStateCallbackUri);
request.setRecordingChannelType(recordingChannelType);
request.setRecordingContentType(recordingContentType);
request.setRecordingFormatType(recordingFormatType);
return withContext(contextValue -> {
contextValue = context == null ? contextValue : context;
return serverCallInternal
Expand Down Expand Up @@ -274,7 +306,7 @@ public Mono<Void> stopRecording(String recordingId) {
/**
* Stop recording of the call.
*
* @param recordingId Recording id to stop.
* @param recordingId Recording id to stop.
* @throws CallingServerErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return Response for a successful stop recording request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public AzureCommunicationCallingServerServiceImplBuilder addPolicy(HttpPipelineP
*/
public AzureCommunicationCallingServerServiceImpl buildClient() {
if (apiVersion == null) {
this.apiVersion = "2021-06-15-preview";
this.apiVersion = "2021-08-30-preview";
}
if (pipeline == null) {
this.pipeline = createHttpPipeline();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.communication.callingserver.implementation.models;

import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;

/** Defines values for RecordingChannelType. */
public final class RecordingChannelType extends ExpandableStringEnum<RecordingChannelType> {
/** Static value mixed for RecordingChannelType. */
public static final RecordingChannelType MIXED = fromString("mixed");

/** Static value unmixed for RecordingChannelType. */
public static final RecordingChannelType UNMIXED = fromString("unmixed");

/**
* Creates or finds a RecordingChannelType from its string representation.
*
* @param name a name to look for.
* @return the corresponding RecordingChannelType.
*/
@JsonCreator
public static RecordingChannelType fromString(String name) {
return fromString(name, RecordingChannelType.class);
}

/** @return known RecordingChannelType values. */
public static Collection<RecordingChannelType> values() {
return values(RecordingChannelType.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.communication.callingserver.implementation.models;

import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;

/** Defines values for RecordingContentType. */
public final class RecordingContentType extends ExpandableStringEnum<RecordingContentType> {
/** Static value audio for RecordingContentType. */
public static final RecordingContentType AUDIO = fromString("audio");

/** Static value audioVideo for RecordingContentType. */
public static final RecordingContentType AUDIO_VIDEO = fromString("audioVideo");

/**
* Creates or finds a RecordingContentType from its string representation.
*
* @param name a name to look for.
* @return the corresponding RecordingContentType.
*/
@JsonCreator
public static RecordingContentType fromString(String name) {
return fromString(name, RecordingContentType.class);
}

/** @return known RecordingContentType values. */
public static Collection<RecordingContentType> values() {
return values(RecordingContentType.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.communication.callingserver.implementation.models;

import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;

/** Defines values for RecordingFormatType. */
public final class RecordingFormatType extends ExpandableStringEnum<RecordingFormatType> {
/** Static value wav for RecordingFormatType. */
public static final RecordingFormatType WAV = fromString("wav");

/** Static value mp3 for RecordingFormatType. */
public static final RecordingFormatType MP3 = fromString("mp3");

/** Static value mp4 for RecordingFormatType. */
public static final RecordingFormatType MP4 = fromString("mp4");

/**
* Creates or finds a RecordingFormatType from its string representation.
*
* @param name a name to look for.
* @return the corresponding RecordingFormatType.
*/
@JsonCreator
public static RecordingFormatType fromString(String name) {
return fromString(name, RecordingFormatType.class);
}

/** @return known RecordingFormatType values. */
public static Collection<RecordingFormatType> values() {
return values(RecordingFormatType.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

package com.azure.communication.callingserver.implementation.models;

import com.azure.communication.callingserver.models.RecordingChannelType;
import com.azure.communication.callingserver.models.RecordingContentType;
import com.azure.communication.callingserver.models.RecordingFormatType;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

Expand All @@ -16,6 +19,24 @@ public final class StartCallRecordingRequest {
@JsonProperty(value = "recordingStateCallbackUri")
private String recordingStateCallbackUri;

/*
* Optional, audioVideo by default
*/
@JsonProperty(value = "recordingContentType")
private RecordingContentType recordingContentType;

/*
* Optional, mixed by default
*/
@JsonProperty(value = "recordingChannelType")
private RecordingChannelType recordingChannelType;

/*
* Optional, mp4 by default
*/
@JsonProperty(value = "recordingFormatType")
private RecordingFormatType recordingFormatType;

/**
* Get the recordingStateCallbackUri property: The uri to send notifications to.
*
Expand All @@ -35,4 +56,64 @@ public StartCallRecordingRequest setRecordingStateCallbackUri(String recordingSt
this.recordingStateCallbackUri = recordingStateCallbackUri;
return this;
}

/**
* Get the recordingContentType property: Optional, audioVideo by default.
*
* @return the recordingContentType value.
*/
public RecordingContentType getRecordingContentType() {
return this.recordingContentType;
}

/**
* Set the recordingContentType property: Optional, audioVideo by default.
*
* @param recordingContentType the recordingContentType value to set.
* @return the StartCallRecordingRequest object itself.
*/
public StartCallRecordingRequest setRecordingContentType(RecordingContentType recordingContentType) {
this.recordingContentType = recordingContentType;
return this;
}

/**
* Get the recordingChannelType property: Optional, mixed by default.
*
* @return the recordingChannelType value.
*/
public RecordingChannelType getRecordingChannelType() {
return this.recordingChannelType;
}

/**
* Set the recordingChannelType property: Optional, mixed by default.
*
* @param recordingChannelType the recordingChannelType value to set.
* @return the StartCallRecordingRequest object itself.
*/
public StartCallRecordingRequest setRecordingChannelType(RecordingChannelType recordingChannelType) {
this.recordingChannelType = recordingChannelType;
return this;
}

/**
* Get the recordingFormatType property: Optional, mp4 by default.
*
* @return the recordingFormatType value.
*/
public RecordingFormatType getRecordingFormatType() {
return this.recordingFormatType;
}

/**
* Set the recordingFormatType property: Optional, mp4 by default.
*
* @param recordingFormatType the recordingFormatType value to set.
* @return the StartCallRecordingRequest object itself.
*/
public StartCallRecordingRequest setRecordingFormatType(RecordingFormatType recordingFormatType) {
this.recordingFormatType = recordingFormatType;
return this;
}
}
Loading

0 comments on commit 54bcb45

Please sign in to comment.