Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR review fixes #22264

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

package com.azure.communication.callingserver;

import com.azure.communication.callingserver.implementation.converters.PlayAudioConverter;
import com.azure.communication.callingserver.implementation.models.PlayAudioRequest;
import com.azure.communication.callingserver.models.CancelAllMediaOperationsResult;
import com.azure.communication.callingserver.models.PlayAudioOptions;
import com.azure.communication.callingserver.models.PlayAudioResult;
Expand Down Expand Up @@ -44,23 +42,19 @@ public String getCallConnectionId() {
* @param loop The flag indicating whether audio file needs to be played in loop or not.
* @param audioFileId An id for the media in the AudioFileUri, using which we cache the media.
* @param callbackUri call back uri to receive notifications.
* @param operationContext The value to identify context of the operation.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PlayAudioResult playAudio(String audioFileUri,
boolean loop,
String audioFileId,
String callbackUri,
String operationContext) {
PlayAudioRequest playAudioRequest =
new PlayAudioRequest()
.setAudioFileUri(audioFileUri)
.setLoop(loop)
.setAudioFileId(audioFileId)
.setOperationContext(operationContext)
.setCallbackUri(callbackUri);
return callConnectionAsync.playAudio(playAudioRequest).block();
public PlayAudioResult playAudio(
String audioFileUri,
boolean loop,
String audioFileId,
String callbackUri,
String operationContext) {
return callConnectionAsync
.playAudioInternal(audioFileUri, loop, audioFileId, callbackUri, operationContext).block();
}

/**
Expand All @@ -69,28 +63,12 @@ public PlayAudioResult playAudio(String audioFileUri,
* @param audioFileUri The media resource uri of the play audio request. Currently only Wave file (.wav) format
* audio prompts are supported. More specifically, the audio content in the wave file must
* be mono (single-channel), 16-bit samples with a 16,000 (16KHz) sampling rate.
* @param loop The flag indicating whether audio file needs to be played in loop or not.
* @param audioFileId An id for the media in the AudioFileUri, using which we cache the media.
* @param callbackUri call back uri to receive notifications.
* @param operationContext The value to identify context of the operation.
* @param context A {@link Context} representing the request context.
* @param playAudioOptions Options for play audio.
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<PlayAudioResult> playAudioWithResponse(String audioFileUri,
boolean loop,
String audioFileId,
String callbackUri,
String operationContext,
Context context) {
PlayAudioRequest playAudioRequest =
new PlayAudioRequest()
.setAudioFileUri(audioFileUri)
.setLoop(loop)
.setAudioFileId(audioFileId)
.setOperationContext(operationContext)
.setCallbackUri(callbackUri);
return callConnectionAsync.playAudioWithResponse(playAudioRequest, context).block();
public PlayAudioResult playAudio(String audioFileUri, PlayAudioOptions playAudioOptions) {
return callConnectionAsync.playAudioInternal(audioFileUri, playAudioOptions).block();
}

/**
Expand All @@ -99,13 +77,31 @@ public Response<PlayAudioResult> playAudioWithResponse(String audioFileUri,
* @param audioFileUri The media resource uri of the play audio request. Currently only Wave file (.wav) format
* audio prompts are supported. More specifically, the audio content in the wave file must
* be mono (single-channel), 16-bit samples with a 16,000 (16KHz) sampling rate.
* @param playAudioOptions Options for play audio.
* @param loop The flag indicating whether audio file needs to be played in loop or not.
* @param audioFileId An id for the media in the AudioFileUri, using which we cache the media.
* @param callbackUri call back uri to receive notifications.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @param context A {@link Context} representing the request context.
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PlayAudioResult playAudio(String audioFileUri, PlayAudioOptions playAudioOptions) {
PlayAudioRequest playAudioRequest = PlayAudioConverter.convert(audioFileUri, playAudioOptions);
return callConnectionAsync.playAudio(playAudioRequest).block();
public Response<PlayAudioResult> playAudioWithResponse(
String audioFileUri,
boolean loop,
String audioFileId,
String callbackUri,
String operationContext,
Context context) {
return callConnectionAsync
.playAudioWithResponseInternal(
audioFileUri,
loop,
audioFileId,
callbackUri,
operationContext,
context)
.block();
}

/**
Expand All @@ -119,11 +115,13 @@ public PlayAudioResult playAudio(String audioFileUri, PlayAudioOptions playAudio
* @return the response payload for play audio operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<PlayAudioResult> playAudioWithResponse(String audioFileUri,
PlayAudioOptions playAudioOptions,
Context context) {
PlayAudioRequest playAudioRequest = PlayAudioConverter.convert(audioFileUri, playAudioOptions);
return callConnectionAsync.playAudioWithResponse(playAudioRequest, context).block();
public Response<PlayAudioResult> playAudioWithResponse(
String audioFileUri,
PlayAudioOptions playAudioOptions,
Context context) {
return callConnectionAsync
.playAudioWithResponseInternal(audioFileUri, playAudioOptions, context)
.block();
}

/**
Expand All @@ -150,7 +148,8 @@ public Response<Void> hangupWithResponse(Context context) {
/**
* Cancel all media operations in the call.
*
* @param operationContext operationContext.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @return response for a successful CancelMediaOperations request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Expand All @@ -161,13 +160,15 @@ public CancelAllMediaOperationsResult cancelAllMediaOperations(String operationC
/**
* Cancel all media operations in the call.
*
* @param operationContext operationContext.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @param context A {@link Context} representing the request context.
* @return response for a successful CancelMediaOperations request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<CancelAllMediaOperationsResult> cancelAllMediaOperationsWithResponse(String operationContext,
Context context) {
public Response<CancelAllMediaOperationsResult> cancelAllMediaOperationsWithResponse(
String operationContext,
Context context) {
return callConnectionAsync.cancelAllMediaOperationsWithResponse(operationContext, context).block();
}

Expand All @@ -176,13 +177,15 @@ public Response<CancelAllMediaOperationsResult> cancelAllMediaOperationsWithResp
*
* @param participant Invited participant.
* @param alternateCallerId The phone number to use when adding a phone number participant.
* @param operationContext operationContext.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @return response for a successful addParticipant request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Void addParticipant(CommunicationIdentifier participant,
String alternateCallerId,
String operationContext) {
public Void addParticipant(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext) {
return callConnectionAsync.addParticipant(participant, alternateCallerId, operationContext).block();
}

Expand All @@ -191,15 +194,17 @@ public Void addParticipant(CommunicationIdentifier participant,
*
* @param participant Invited participant.
* @param alternateCallerId The phone number to use when adding a phone number participant.
* @param operationContext operationContext.
* @param operationContext The value to identify context of the operation. This is used to co-relate other
* communications related to this operation
* @param context A {@link Context} representing the request context.
* @return response for a successful addParticipant request.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> addParticipantWithResponse(CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
Context context) {
public Response<Void> addParticipantWithResponse(
CommunicationIdentifier participant,
String alternateCallerId,
String operationContext,
Context context) {
return callConnectionAsync
.addParticipantWithResponse(participant, alternateCallerId, operationContext, context).block();
}
Expand Down
Loading