Class CallingServerClient

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

public final class CallingServerClient extends Object
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 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 - A Context 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 - A Context 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

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

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

      public void downloadTo(String sourceEndpoint, OutputStream destinationStream, HttpRange httpRange)
      Download the recording content, e.g. Recording's metadata, Recording video, etc., from endpoint and write it into the OutputStream passed as parameter.
      Parameters:
      sourceEndpoint - - ACS URL where the content is located.
      destinationStream - - A stream where to write the downloaded content.
      httpRange - - An optional HttpRange 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., from endpoint and write it in the OutputStream passed as parameter.
      Parameters:
      sourceEndpoint - - ACS URL where the content is located.
      destinationStream - - A stream where to write the downloaded content.
      httpRange - - An optional HttpRange value containing the range of bytes to download. If missing, the whole content will be downloaded.
      context - A Context 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 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.
    • downloadToWithResponse

      public Response<Void> downloadToWithResponse(String sourceEndpoint, Path destinationPath, ParallelDownloadOptions parallelDownloadOptions, boolean overwrite, Context context)
      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.
      context - A Context representing the request context.
      Returns:
      Response containing the http response information from the download.