Class DualToneMultiFrequency

java.lang.Object
com.sinch.sdk.models.DualToneMultiFrequency

public class DualToneMultiFrequency extends Object
DTMF played to the callee.

Valid characters in the string are "0"-"9", "#" and "w". A "w" will render a 500 ms pause.

Example: "ww1234#w#" will render a 1s pause, the DTMF tones "1", "2", "3", "4" and "#" followed by a 0.5s pause and finally the DTMF tone for "#".

This can be used if the callout destination for instance require a conference PIN code or an extension to be entered.

  • Constructor Details

    • DualToneMultiFrequency

      public DualToneMultiFrequency(String dtmf) throws IllegalArgumentException
      Create an instance of DualToneMultiFrequency
      Parameters:
      dtmf - The dtmf value. Valid characters in the string are "0"-"9", "#" and "w"
      Throws:
      IllegalArgumentException - Throw an exception if value contains invalid characters
  • Method Details

    • valueOf

      public static DualToneMultiFrequency valueOf(String value)
      Create an instance from String
      Parameters:
      value - See DualToneMultiFrequency(java.lang.String) constructor
      Returns:
      a DualToneMultiFrequency
    • setStrict

      public static void setStrict(boolean strict)
      Configure if invalid string values will throw an Exception or not
      Parameters:
      strict - Set strict mode to true/false
    • validate

      public static boolean validate(String value)
      Validate string against authorized values for DTMF value
      Parameters:
      value - The value to be validated
      Returns:
      Is string valid or not
    • stringValue

      public String stringValue()
      Get the DTMF value
      Returns:
      The dtmf value
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object