Class Call.Builder

java.lang.Object
com.vonage.client.voice.Call.Builder
Enclosing class:
Call

public static class Call.Builder extends Object
Builder for constructing a Call object.
Since:
7.3.0
  • Method Details

    • to

      public Call.Builder to(Endpoint... endpoints)
      Sets the endpoints (recipients) of the call.
      Parameters:
      endpoints - The recipients of the call in order.
      Returns:
      This builder.
    • from

      public Call.Builder from(String number)
      Connect to a Phone (PSTN) number.
      Parameters:
      number - The number to place the call from in E.164 format.
      Returns:
      This builder.
    • eventMethod

      public Call.Builder eventMethod(HttpMethod eventMethod)
      The HTTP method used to send event information to event_url.
      Parameters:
      eventMethod - The method type (must be GET or POST).
      Returns:
      This builder.
    • answerMethod

      public Call.Builder answerMethod(HttpMethod answerMethod)
      The HTTP method used to send event information to answer_url.
      Parameters:
      answerMethod - The method type (must be GET or POST).
      Returns:
      This builder.
    • eventUrl

      public Call.Builder eventUrl(String eventUrl)
      The webhook endpoint where call progress events are sent to. For more information about the values sent, see the Event webhook documentation.
      Parameters:
      eventUrl - The event updates URL.
      Returns:
      This builder.
    • answerUrl

      public Call.Builder answerUrl(String answerUrl)
      The webhook endpoint where you provide the Nexmo Call Control Object that governs this call.
      Parameters:
      answerUrl - The NCCO answer URL.
      Returns:
      This builder.
    • machineDetection

      public Call.Builder machineDetection(MachineDetection machineDetection)
      Configure the behavior when Vonage detects that the call is answered by voicemail. If MachineDetection.CONTINUE, Vonage sends an HTTP request to event_url with the Call event machine. If MachineDetection.HANGUP, Vonage ends the call.
      Parameters:
      machineDetection - The machine detection mode.
      Returns:
      This builder.
    • advancedMachineDetection

      Configure the behavior of Vonage's advanced machine detection. This overrides the machineDetection(MachineDetection), so you cannot set both.
      Parameters:
      advancedMachineDetection - The advanced machine detection settings.
      Returns:
      This builder.
      Since:
      7.4.0
    • lengthTimer

      public Call.Builder lengthTimer(int lengthTimer)
      Sets the number of seconds that elapse before Vonage hangs up after the call is answered.
      Parameters:
      lengthTimer - The call length in seconds. The default and maximum is 7200.
      Returns:
      This builder.
    • ringingTimer

      public Call.Builder ringingTimer(int ringingTimer)
      Sets the number of seconds that elapse before Vonage hangs up after the call state changes to ‘ringing’.
      Parameters:
      ringingTimer - The time to wait whilst ringing in seconds. Maximum is 120, default is 60.
      Returns:
      This builder.
    • fromRandomNumber

      public Call.Builder fromRandomNumber(boolean fromRandomNumber)
      Set to @{code true} to use random phone number as the caller. The number will be selected from the list of the numbers assigned to the current application. Cannot be used if from(String) is set.
      Parameters:
      fromRandomNumber - Whether to use a random number instead of from.
      Returns:
      This builder.
    • ncco

      public Call.Builder ncco(Action... actions)
      Sets the actions to take on the call.
      Parameters:
      actions - The actions in order.
      Returns:
      This builder.
    • ncco

      public Call.Builder ncco(Collection<? extends Action> nccos)
      Sets the actions to take on the call.
      Parameters:
      nccos - The NCCOs to use for this call.
      Returns:
      This builder.
    • build

      public Call build()
      Builds the Call object with this builder's properties.
      Returns:
      The constructed Call instance.