Class CallingServerAsyncClient

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

public final class CallingServerAsyncClient extends Object
Asynchronous client that supports calling server operations.

Instantiating a asynchronous CallingServer client

 HttpPipeline pipeline = new HttpPipelineBuilder()
     .policies(/* add policies */)
     .build();

 CallingServerAsyncClient callingServerAsyncClient = new CallingServerClientBuilder()
     .pipeline(pipeline)
     .connectionString(connectionString)
     .buildAsyncClient();
 

View this for additional ways to construct the client.

See Also:
  • Method Details

    • createCallConnection

      public Mono<CallConnectionAsync> createCallConnection(CommunicationIdentifier source, List<CommunicationIdentifier> targets, CreateCallOptions createCallOptions)
      Create a call connection request from a source identity to targets identity.
      Parameters:
      source - The source identity.
      targets - The target identities.
      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);
       CallConnectionAsync callAsyncConnection = callingServerAsyncClient
           .createCallConnection(source, targets, createCallOptions).block();
       
      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 Mono<Response<CallConnectionAsync>> createCallConnectionWithResponse(CommunicationIdentifier source, List<CommunicationIdentifier> targets, CreateCallOptions createCallOptions)
      Create a Call Connection Request from source identity to targets identity.
      Parameters:
      source - The source identity.
      targets - The target identities.
      createCallOptions - The call options.
      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 Mono<CallConnectionAsync> joinCall(String serverCallId, CommunicationIdentifier source, JoinCallOptions joinCallOptions)
      Join a Call
      Parameters:
      serverCallId - Server call id.
      source - Source identity.
      joinCallOptions - Join call options.
      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.
    • joinCallWithResponse

      public Mono<Response<CallConnectionAsync>> joinCallWithResponse(String serverCallId, CommunicationIdentifier source, JoinCallOptions joinCallOptions)
      Join a call
      Parameters:
      serverCallId - Server call id.
      source - Source identity.
      joinCallOptions - Join call options.
      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

      public CallConnectionAsync getCallConnection(String callConnectionId)
      Get CallConnection object
      Parameters:
      callConnectionId - Call connection id.
      Returns:
      CallConnection object.
    • initializeServerCall

      public ServerCallAsync initializeServerCall(String serverCallId)
      Get ServerCall object.
      Parameters:
      serverCallId - Server call id.
      Returns:
      ServerCall object.
    • downloadStream

      public Flux<ByteBuffer> downloadStream(String sourceEndpoint)
      Download the recording content, e.g. Recording's metadata, Recording video, from the ACS endpoint passed as parameter.
      Parameters:
      sourceEndpoint - - URL where the content is located.
      Returns:
      A Flux object containing the byte stream of the content requested.
    • downloadStream

      public Flux<ByteBuffer> downloadStream(String sourceEndpoint, HttpRange httpRange)
      Download the recording content, e.g. Recording's metadata, Recording video, from the ACS endpoint passed as parameter.
      Parameters:
      sourceEndpoint - - URL where the content is located.
      httpRange - - An optional HttpRange value containing the range of bytes to download. If missing, the whole content will be downloaded.
      Returns:
      A Flux object containing the byte stream of the content requested.
    • downloadStreamWithResponse

      public Mono<Response<Flux<ByteBuffer>>> downloadStreamWithResponse(String sourceEndpoint, HttpRange range)
      Download the recording content, (e.g. Recording's metadata, Recording video, etc.) from the endpoint.
      Parameters:
      sourceEndpoint - - URL where the content is located.
      range - - An optional HttpRange value containing the range of bytes to download. If missing, the whole content will be downloaded.
      Returns:
      A Mono object containing a Response with the byte stream of the content requested.
    • downloadTo

      public Mono<Void> downloadTo(String sourceEndpoint, Path destinationPath, ParallelDownloadOptions parallelDownloadOptions, boolean overwrite)
      Download the content located in endpoint into a file marked by path. This download will be done using parallel workers.
      Parameters:
      sourceEndpoint - - ACS URL where the content is located.
      destinationPath - - File location.
      parallelDownloadOptions - - an optional ParallelDownloadOptions object to modify how the parallel download will work.
      overwrite - - True to overwrite the file if it exists.
      Returns:
      Response for a successful downloadTo request.
    • downloadToWithResponse

      public Mono<Response<Void>> downloadToWithResponse(String sourceEndpoint, Path destinationPath, ParallelDownloadOptions parallelDownloadOptions, boolean overwrite)
      Download the content located in endpoint into a file marked by path. This download will be done using parallel workers.
      Parameters:
      sourceEndpoint - - ACS URL where the content is located.
      destinationPath - - File location.
      parallelDownloadOptions - - an optional ParallelDownloadOptions object to modify how the parallel download will work.
      overwrite - - True to overwrite the file if it exists.
      Returns:
      Response containing the http response information from the download.