Class ServerCall
java.lang.Object
com.azure.communication.callingserver.ServerCall
Synchronous Client that supports server call operations.
-
Method Summary
Modifier and TypeMethodDescriptionaddParticipant
(CommunicationIdentifier participant, String callBackUri, String alternateCallerId, String operationContext) Add a participant to the call.addParticipantWithResponse
(CommunicationIdentifier participant, String callBackUri, String alternateCallerId, String operationContext, Context context) Add a participant to the call.getRecordingState
(String recordingId) Get the current recording state by recording id.getRecordingStateWithResponse
(String recordingId, Context context) Get the current recording state by recording id.Get server call id property.void
pauseRecording
(String recordingId) Pause recording of the call.pauseRecordingWithResponse
(String recordingId, Context context) Pause recording of the call.playAudio
(String audioFileUri, PlayAudioOptions playAudioOptions) Play audio in a call.Play audio in a call.playAudioWithResponse
(String audioFileUri, PlayAudioOptions playAudioOptions, Context context) Play audio in a call.void
removeParticipant
(String participantId) Remove a participant from the call.removeParticipantWithResponse
(String participantId, Context context) Remove a participant from the call.void
resumeRecording
(String recordingId) Resume recording of the call.resumeRecordingWithResponse
(String recordingId, Context context) Resume recording of the call.startRecording
(String recordingStateCallbackUri) Start recording of the call.startRecordingWithResponse
(String recordingStateCallbackUri, StartRecordingOptions startRecordingOptions, Context context) Start recording of the call.void
stopRecording
(String recordingId) Stop recording of the call.stopRecordingWithResponse
(String recordingId, Context context) Stop recording of the call.
-
Method Details
-
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 operationcontext
- AContext
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
Remove a participant from the call.- Parameters:
participantId
- Participant id.
-
removeParticipantWithResponse
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
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
- AContext
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
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
Stop recording of the call.- Parameters:
recordingId
- Recording id to stop.context
- AContext
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
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
Pause recording of the call.- Parameters:
recordingId
- Recording id to stop.context
- AContext
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
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
Resume recording of the call.- Parameters:
recordingId
- The recording id to stop.context
- AContext
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
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
- AContext
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
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
- AContext
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.
-