Class ServerCallAsync

java.lang.Object
com.azure.communication.callingserver.ServerCallAsync

public final class ServerCallAsync extends Object
Asynchronous client that supports server call operations.
  • Method Details

    • getServerCallId

      public String getServerCallId()
      Get server call id property
      Returns:
      Server call id value.
    • addParticipant

      public Mono<AddParticipantResult> addParticipant(CommunicationIdentifier participant, String callBackUri, String alternateCallerId, String operationContext)
      Add a participant to the call.
      Parameters:
      participant - Added participant.
      callBackUri - callBackUri to get notifications.
      alternateCallerId - Phone number to use when adding a phone number participant.
      operationContext - Value to identify context of the operation. This is used to co-relate other communications related to this operation
      Returns:
      Response for a successful add participant request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • addParticipantWithResponse

      public Mono<Response<AddParticipantResult>> addParticipantWithResponse(CommunicationIdentifier participant, String callBackUri, String alternateCallerId, String operationContext)
      Add a participant to the call.
      Parameters:
      participant - Added participant.
      callBackUri - callBackUri to get notifications.
      alternateCallerId - Phone number to use when adding a phone number participant.
      operationContext - Value to identify context of the operation. This is used to co-relate other communications related to this operation
      Returns:
      Response for a successful add participant request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • removeParticipant

      public Mono<Void> removeParticipant(String participantId)
      Remove a participant from the call.
      Parameters:
      participantId - Participant id.
      Returns:
      Response for a successful remove participant request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • removeParticipantWithResponse

      public Mono<Response<Void>> removeParticipantWithResponse(String participantId)
      Remove a participant from the call.
      Parameters:
      participantId - Participant id.
      Returns:
      Response for a successful remove participant request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • startRecording

      public Mono<StartCallRecordingResult> startRecording(String recordingStateCallbackUri)
      Start recording of the call.
      Parameters:
      recordingStateCallbackUri - Uri to send state change callbacks.
      Returns:
      Response for a successful start recording request.
      Throws:
      InvalidParameterException - is recordingStateCallbackUri is absolute uri.
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • startRecordingWithResponse

      public Mono<Response<StartCallRecordingResult>> startRecordingWithResponse(String recordingStateCallbackUri, StartRecordingOptions startRecordingOptions, Context context)
      Start recording of the call.
      Parameters:
      recordingStateCallbackUri - Uri to send state change callbacks.
      startRecordingOptions - StartRecordingOptions custom options.
      context - A Context representing the request context.
      Returns:
      Response for a successful start recording request.
      Throws:
      InvalidParameterException - is recordingStateCallbackUri is absolute uri.
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • stopRecording

      public Mono<Void> stopRecording(String recordingId)
      Stop recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      Returns:
      Response for a successful stop recording request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • stopRecordingWithResponse

      public Mono<Response<Void>> stopRecordingWithResponse(String recordingId)
      Stop recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      Returns:
      Response for a successful stop recording request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • pauseRecording

      public Mono<Void> pauseRecording(String recordingId)
      Pause recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      Returns:
      Response for a successful pause recording request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • pauseRecordingWithResponse

      public Mono<Response<Void>> pauseRecordingWithResponse(String recordingId)
      Pause recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      Returns:
      Response for a successful pause recording request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • resumeRecording

      public Mono<Void> resumeRecording(String recordingId)
      Resume recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      Returns:
      response for a successful resume recording request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • resumeRecordingWithResponse

      public Mono<Response<Void>> resumeRecordingWithResponse(String recordingId)
      Resume recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      Returns:
      response for a successful resume recording request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getRecordingState

      public Mono<CallRecordingProperties> getRecordingState(String recordingId)
      Get current recording state by recording id.
      Parameters:
      recordingId - Recording id to stop.
      Returns:
      Response for a successful get recording state request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • getRecordingStateWithResponse

      public Mono<Response<CallRecordingProperties>> getRecordingStateWithResponse(String recordingId)
      Get current recording state by recording id.
      Parameters:
      recordingId - Recording id to stop.
      Returns:
      Response for a successful get recording state request.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • playAudio

      public Mono<PlayAudioResult> playAudio(String audioFileUri, String audioFileId, String callbackUri, String operationContext)
      Play audio in a call.
      Parameters:
      audioFileUri - 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.
      audioFileId - Id for the media in the AudioFileUri, using which we cache the media resource.
      callbackUri - Callback Uri to receive PlayAudio status notifications.
      operationContext - The value to identify context of the operation. This is used to co-relate other communications related to this operation
      Returns:
      Response payload for play audio operation.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • playAudio

      public Mono<PlayAudioResult> playAudio(String audioFileUri, PlayAudioOptions playAudioOptions)
      Play audio in a call.
      Parameters:
      audioFileUri - 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.
      playAudioOptions - Options for play audio.
      Returns:
      Response payload for play audio operation.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.
    • playAudioWithResponse

      public Mono<Response<PlayAudioResult>> playAudioWithResponse(String audioFileUri, PlayAudioOptions playAudioOptions)
      Play audio in a call.
      Parameters:
      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.
      playAudioOptions - Options for play audio.
      Returns:
      the response payload for play audio operation.
      Throws:
      CallingServerErrorException - thrown if the request is rejected by server.
      RuntimeException - all other wrapped checked exceptions if the request fails to be sent.