Class CallingServerClient
java.lang.Object
com.azure.communication.callingserver.CallingServerClient
Synchronous client that supports calling server operations.
Instantiating a synchronous Calling Server Client
HttpPipeline pipeline = new HttpPipelineBuilder() .policies(/* add policies */) .build(); CallingServerClient callingServerClient = new CallingServerClientBuilder() .pipeline(pipeline) .connectionString(connectionString) .buildClient();
View this
for additional ways to construct the client.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncreateCallConnection
(CommunicationIdentifier source, List<CommunicationIdentifier> targets, CreateCallOptions createCallOptions) Create a call connection request from source identity to targets identity.createCallConnectionWithResponse
(CommunicationIdentifier source, List<CommunicationIdentifier> targets, CreateCallOptions createCallOptions, Context context) Create a Call Connection Request from source identity to targets identity.void
downloadTo
(String sourceEndpoint, OutputStream destinationStream, HttpRange httpRange) Download the recording content, e.g.void
downloadTo
(String sourceEndpoint, Path destinationPath, ParallelDownloadOptions parallelDownloadOptions, boolean overwrite) Download the content located inendpoint
into a file marked bypath
.downloadToWithResponse
(String sourceEndpoint, OutputStream destinationStream, HttpRange httpRange, Context context) Download the recording content, e.g.downloadToWithResponse
(String sourceEndpoint, Path destinationPath, ParallelDownloadOptions parallelDownloadOptions, boolean overwrite, Context context) Download the content located inendpoint
into a file marked bypath
.getCallConnection
(String callConnectionId) Get CallConnection objectinitializeServerCall
(String serverCallId) Get ServerCall objectjoinCall
(String serverCallId, CommunicationIdentifier source, JoinCallOptions joinCallOptions) Join a calljoinCallWithResponse
(String serverCallId, CommunicationIdentifier source, JoinCallOptions joinCallOptions, Context context) Join a call
-
Method Details
-
createCallConnection
public CallConnection createCallConnection(CommunicationIdentifier source, List<CommunicationIdentifier> targets, CreateCallOptions createCallOptions) Create a call connection request from source identity to targets identity.- Parameters:
source
- The source of the call.targets
- The targets of the call.createCallOptions
- The call Options.- Returns:
- Response for a successful CreateCallConnection request.
List<CommunicationIdentifier> targets = Arrays.asList(firstCallee, secondCallee); List<MediaType> requestedMediaTypes = Arrays.asList(MediaType.AUDIO, MediaType.VIDEO); List<EventSubscriptionType> requestedCallEvents = Arrays.asList( EventSubscriptionType.DTMF_RECEIVED, EventSubscriptionType.PARTICIPANTS_UPDATED); CreateCallOptions createCallOptions = new CreateCallOptions( callbackUri, requestedMediaTypes, requestedCallEvents); CallConnection callConnection = callingServerClient.createCallConnection(source, targets, createCallOptions);
- Throws:
CallingServerErrorException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
createCallConnectionWithResponse
public Response<CallConnection> createCallConnectionWithResponse(CommunicationIdentifier source, List<CommunicationIdentifier> targets, CreateCallOptions createCallOptions, Context context) Create a Call Connection Request from source identity to targets identity.- Parameters:
source
- The source of the call.targets
- The targets of the call.createCallOptions
- The call Options.context
- AContext
representing the request context.- Returns:
- Response for a successful CreateCallConnection request.
- Throws:
CallingServerErrorException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
joinCall
public CallConnection joinCall(String serverCallId, CommunicationIdentifier source, JoinCallOptions joinCallOptions) Join a call- Parameters:
serverCallId
- The server call id.source
- of Join Call request.joinCallOptions
- to Join Call.- Returns:
- CallConnection for a successful join request.
- Throws:
CallingServerErrorException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
joinCallWithResponse
public Response<CallConnection> joinCallWithResponse(String serverCallId, CommunicationIdentifier source, JoinCallOptions joinCallOptions, Context context) Join a call- Parameters:
serverCallId
- The server call id.source
- of Join Call request.joinCallOptions
- to Join Call.context
- AContext
representing the request context.- Returns:
- Response for a successful join request.
- Throws:
CallingServerErrorException
- thrown if the request is rejected by server.RuntimeException
- all other wrapped checked exceptions if the request fails to be sent.
-
getCallConnection
Get CallConnection object- Parameters:
callConnectionId
- The call connection id.- Returns:
- CallConnection.
-
initializeServerCall
Get ServerCall object- Parameters:
serverCallId
- Server call id.- Returns:
- ServerCall
-
downloadTo
Download the recording content, e.g. Recording's metadata, Recording video, etc., fromendpoint
and write it into theOutputStream
passed as parameter.- Parameters:
sourceEndpoint
- - ACS URL where the content is located.destinationStream
- - A stream where to write the downloaded content.httpRange
- - An optionalHttpRange
value containing the range of bytes to download. If missing, the whole content will be downloaded.
-
downloadToWithResponse
public Response<Void> downloadToWithResponse(String sourceEndpoint, OutputStream destinationStream, HttpRange httpRange, Context context) Download the recording content, e.g. Recording's metadata, Recording video, etc., fromendpoint
and write it in theOutputStream
passed as parameter.- Parameters:
sourceEndpoint
- - ACS URL where the content is located.destinationStream
- - A stream where to write the downloaded content.httpRange
- - An optionalHttpRange
value containing the range of bytes to download. If missing, the whole content will be downloaded.context
- AContext
representing the request context.- Returns:
- Response containing the http response information from the download.
-
downloadTo
public void downloadTo(String sourceEndpoint, Path destinationPath, ParallelDownloadOptions parallelDownloadOptions, boolean overwrite) Download the content located inendpoint
into a file marked bypath
. This download will be done using parallel workers.- Parameters:
sourceEndpoint
- - ACS URL where the content is located.destinationPath
- - File location.parallelDownloadOptions
- - an optionalParallelDownloadOptions
object to modify how the parallel download will work.overwrite
- - True to overwrite the file if it exists.
-
downloadToWithResponse
public Response<Void> downloadToWithResponse(String sourceEndpoint, Path destinationPath, ParallelDownloadOptions parallelDownloadOptions, boolean overwrite, Context context) Download the content located inendpoint
into a file marked bypath
. This download will be done using parallel workers.- Parameters:
sourceEndpoint
- - ACS URL where the content is located.destinationPath
- - File location.parallelDownloadOptions
- - an optionalParallelDownloadOptions
object to modify how the parallel download will work.overwrite
- - True to overwrite the file if it exists.context
- AContext
representing the request context.- Returns:
- Response containing the http response information from the download.
-