Class ServerCall

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

public final class ServerCall extends Object
Synchronous Client that supports server call operations.
  • Method Details

    • getServerCallId

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

      public 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 Response<AddParticipantResult> addParticipantWithResponse(CommunicationIdentifier participant, String callBackUri, String alternateCallerId, String operationContext, Context context)
      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
      context - A Context representing the request context.
      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 void removeParticipant(String participantId)
      Remove a participant from the call.
      Parameters:
      participantId - Participant id.
    • removeParticipantWithResponse

      public Response<Void> removeParticipantWithResponse(String participantId, Context context)
      Remove a participant from the call.
      Parameters:
      participantId - Participant id.
      context - Context representing the request context.
      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 StartCallRecordingResult startRecording(String recordingStateCallbackUri)
      Start recording of the call.
      Parameters:
      recordingStateCallbackUri - Uri to send state change callbacks.
      Returns:
      Result for a successful start 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.
    • startRecordingWithResponse

      public 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:
      Result for a successful start 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.
    • stopRecording

      public void stopRecording(String recordingId)
      Stop recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      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 Response<Void> stopRecordingWithResponse(String recordingId, Context context)
      Stop recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      context - A Context representing the request context.
      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 void pauseRecording(String recordingId)
      Pause recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      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 Response<Void> pauseRecordingWithResponse(String recordingId, Context context)
      Pause recording of the call.
      Parameters:
      recordingId - Recording id to stop.
      context - A Context representing the request context.
      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 void resumeRecording(String recordingId)
      Resume recording of the call.
      Parameters:
      recordingId - The recording id to stop.
      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 Response<Void> resumeRecordingWithResponse(String recordingId, Context context)
      Resume recording of the call.
      Parameters:
      recordingId - The recording id to stop.
      context - A Context representing the request context.
      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 CallRecordingProperties getRecordingState(String recordingId)
      Get the current recording state by recording id.
      Parameters:
      recordingId - The 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 Response<CallRecordingProperties> getRecordingStateWithResponse(String recordingId, Context context)
      Get the current recording state by recording id.
      Parameters:
      recordingId - The recording id to stop.
      context - A Context representing the request context.
      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 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.
      callbackUri - Callback Uri to receive PlayAudio status notifications.
      operationContext - 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 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 Response<PlayAudioResult> playAudioWithResponse(String audioFileUri, PlayAudioOptions playAudioOptions, Context context)
      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.
      context - A Context representing the request context.
      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.