Class ConnectAction.Builder

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

public static class ConnectAction.Builder extends Object
  • Method Details

    • endpoint

      Deprecated.
      This will be removed in the next major release.
      Connect the call to a specific Endpoint.
      Parameters:
      endpoint - The endpoints to connect to.
      Returns:
      This builder.
    • endpoint

      public ConnectAction.Builder endpoint(Endpoint... endpoint)
      Connect the call to a specific Endpoint.
      Parameters:
      endpoint - The endpoint(s) to connect to.
      Returns:
      This builder.
    • from

      Sets the caller ID number. This must be one of your Vonage virtual numbers. Any other value will result in the caller ID being unknown.
      Parameters:
      from - The caller number in E.164 format.
      Returns:
      This builder.
    • eventType

      Set to EventType.SYNCHRONOUS to:
      • Make the connect action synchronous.
      • Enable eventUrl to return an NCCO that overrides the current NCCO when a call moves to specific states.

      See the Connect with fallback NCCO example.

      Parameters:
      eventType - The event type as an enum.
      Returns:
      This builder.
    • timeOut

      If the call is unanswered, set the number in seconds before Vonage stops ringing endpoint. The default value is 60, minimum is 3 and maximum is 7200 (2 hours).
      Parameters:
      timeOut - The call timeout in seconds.
      Returns:
      This builder.
    • limit

      Maximum length of the call in seconds. The default and maximum value is 7200 seconds (2 hours).
      Parameters:
      limit - The maximum call length as an int.
      Returns:
      This builder.
    • machineDetection

      Configure the behavior when Vonage detects that a destination is an answerphone.
      Parameters:
      machineDetection - Set to either:
      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
    • eventUrl

      Set the webhook endpoint that Vonage calls asynchronously on each of the possible Call States. If eventType is set to synchronous the eventUrl can return an NCCO that overrides the current NCCO when a timeout occurs.
      Parameters:
      eventUrl - The event URLs.
      Returns:
      This builder.
    • eventUrl

      public ConnectAction.Builder eventUrl(String... eventUrl)
      Set the webhook endpoint that Vonage calls asynchronously on each of the possible Call States. If eventType is set to synchronous the eventUrl can return an NCCO that overrides the current NCCO when a timeout occurs.
      Parameters:
      eventUrl - The event URL(s).
      Returns:
      This builder.
    • eventMethod

      The HTTP method Vonage uses to make the request to eventUrl. The default value is EventMethod.POST.
      Parameters:
      eventMethod - The HTTP method as an enum.
      Returns:
      This builder.
    • randomFromNumber

      public ConnectAction.Builder randomFromNumber(boolean randomFromNumber)
      Use a random phone number as from. The number will be selected from the list of the numbers assigned to the current application. The application will try to use number(s) from the same country as the destination (if available). If set to true, cannot be used together with from(String). The default value is false.
      Parameters:
      randomFromNumber - true to use a random number instead of from(String).
      Returns:
      This builder.
      Since:
      8.2.0
    • ringbackTone

      public ConnectAction.Builder ringbackTone(String ringbackTone)
      A URL value that points to a ringback tone to be played back on repeat to the caller, so they don't hear silence. The tone will automatically stop playing when the call is fully connected. It's not recommended to use this parameter when connecting to a phone endpoint, as the carrier will supply their own ringback tone.
      Parameters:
      ringbackTone - The ringback tone URL as a string.
      Returns:
      This builder.
      Since:
      8.2.0
    • build

      public ConnectAction build()
      Builds the ConnectAction.
      Returns:
      A new ConnectAction object from the stored builder options.