Class CallConnection
java.lang.Object
com.azure.communication.callingserver.CallConnection
Synchronous Client that supports call connection operations.
-
Method Summary
Modifier and TypeMethodDescriptionaddParticipant
(CommunicationIdentifier participant, String alternateCallerId, String operationContext) Add a participant to the call.addParticipantWithResponse
(CommunicationIdentifier participant, String alternateCallerId, String operationContext, Context context) Add a participant to the call.cancelAllMediaOperations
(String operationContext) Cancel all media operations in the call.cancelAllMediaOperationsWithResponse
(String operationContext, Context context) Cancel all media operations in the call.Get the call connection id property.void
hangup()
Disconnect from a call.hangupWithResponse
(Context context) Disconnect from a call.playAudio
(String audioFileUri, boolean loop, String audioFileId, String callbackUri, String operationContext) Play audio in the call.playAudio
(String audioFileUri, PlayAudioOptions playAudioOptions) Play audio in the call.playAudioWithResponse
(String audioFileUri, PlayAudioOptions playAudioOptions, Context context) Play audio in the call.void
removeParticipant
(String participantId) Remove a participant from the call.removeParticipantWithResponse
(String participantId, Context context) Remove a participant from the call.
-
Method Details
-
getCallConnectionId
Get the call connection id property.- Returns:
- Call connection id value.
-
playAudio
public PlayAudioResult playAudio(String audioFileUri, boolean loop, String audioFileId, String callbackUri, String operationContext) Play audio in the 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.loop
- The flag indicating whether audio file needs to be played in loop or not.audioFileId
- An id for the media in the AudioFileUri, using which we cache the media.callbackUri
- call back uri to receive 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
Play audio in the 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:
- 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 the 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.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.
-
hangup
public void hangup()Disconnect from a call.- Throws:
CallingServerErrorException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
hangupWithResponse
Disconnect from a call.- Parameters:
context
- AContext
representing the request context.- Returns:
- Response for a successful hangup request.
- Throws:
CallingServerErrorException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
cancelAllMediaOperations
Cancel all media operations in the call.- Parameters:
operationContext
- The value to identify context of the operation. This is used to co-relate other communications related to this operation- Returns:
- Response for a successful cancel all media operations request.
- Throws:
CallingServerErrorException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
cancelAllMediaOperationsWithResponse
public Response<CancelAllMediaOperationsResult> cancelAllMediaOperationsWithResponse(String operationContext, Context context) Cancel all media operations in the call.- Parameters:
operationContext
- The 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 cancel all media operations request.
- Throws:
CallingServerErrorException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
addParticipant
public AddParticipantResult addParticipant(CommunicationIdentifier participant, String alternateCallerId, String operationContext) Add a participant to the call.- Parameters:
participant
- Added participant.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 alternateCallerId, String operationContext, Context context) Add a participant to the call.- Parameters:
participant
- Added participant.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
-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
Remove a participant from the call.- Parameters:
participantId
- Participant id.- Throws:
CallingServerErrorException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
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.
-