Package com.avaya.clientservices.dialingrules

## Interface DialingRules

-     public interface DialingRules

  Applies dialing rules to phone numbers.

  By default all values are zero or null so calling `apply(String)` without further configuration will return a dialable form of the original number.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `apply​(java.lang.String number)` | Applies the configured dialing rules to the input number.
    `java.lang.String` | `filterNumber​(java.lang.String number)` | Filters the input string to only valid phone number characters.
    `java.util.Set<java.lang.String>` | `getAreaCodes()` |
    `java.lang.String` | `getCountryCode()` |
    `java.util.Set<java.lang.Integer>` | `getExtensionLengths()` |
    `java.lang.String` | `getExtensionLocalNumberPrefix()` |
    `java.lang.String` | `getInternationalAccessCode()` |
    `java.lang.String` | `getLongDistanceAccessCode()` |
    `java.util.Set<java.lang.Integer>` | `getNationalNumberLengths()` |
    `java.lang.String` | `getOutsideLineAccessCode()` |
    `boolean` | `getRemoveAreaCodeForLocalCalls()` |
    `void` | `setAreaCodes​(java.util.Set<java.lang.String> areaCodes)` | Sets the area codes for the user's region.
    `void` | `setCountryCode​(java.lang.String countryCode)` | Sets the country code for the user's region.
    `void` | `setExtensionLengths​(java.util.Set<java.lang.Integer> lengths)` | Sets the lengths of all internal extensions.
    `void` | `setExtensionLocalNumberPrefix​(java.lang.String prefix)` | Sets the prefix used for internal extensions in local numbers.
    `void` | `setInternationalAccessCode​(java.lang.String code)` | Sets the international access code for outgoing international calls.
    `void` | `setLongDistanceAccessCode​(java.lang.String code)` | Sets the long distance access code for the user's region.
    `void` | `setNationalNumberLengths​(java.util.Set<java.lang.Integer> lengths)` | Sets the length of national numbers used in the user's country.
    `void` | `setOutsideLineAccessCode​(java.lang.String code)` | Sets the code used to access an outside line in the PBX system.
    `void` | `setRemoveAreaCodeForLocalCalls​(boolean remove)` | Controls whether or not the area code is removed when dialing local numbers.

- - ### Method Detail

    - #### getCountryCode

          java.lang.String getCountryCode()

      Returns:
        the current country code.

    - #### setCountryCode

          void setCountryCode​(java.lang.String countryCode)

      Sets the country code for the user's region.

      For example, if local phone numbers are in the form of:

      +1 303-538-1234

      The country code is "1".

      Parameters:
        `countryCode` - The new country code.

    - #### getAreaCodes

          java.util.Set<java.lang.String> getAreaCodes()

      Returns:
        the current list of area codes.

    - #### setAreaCodes

          void setAreaCodes​(java.util.Set<java.lang.String> areaCodes)

      Sets the area codes for the user's region.

      For example, if local phone numbers are in the form of:

      +1 303-538-1234

      The area code is "303". Any other area codes valid for local calls (those that can be dialed without an area code) should also be included.

      Parameters:
        `areaCodes` - The new area code list;

    - #### getRemoveAreaCodeForLocalCalls

          boolean getRemoveAreaCodeForLocalCalls()

      Returns:
        whether or not the area code is removed for local numbers.

    - #### setRemoveAreaCodeForLocalCalls

          void setRemoveAreaCodeForLocalCalls​(boolean remove)

      Controls whether or not the area code is removed when dialing local numbers.

      For example, if the area code list is set to "303", the outside line access code is set to "9", and this option is enabled then applying dialing rules to "303-538-1234" will result in "95381234".

      Parameters:
        `remove` - specifies whether or not the area code is removed when dialing local numbers.

    - #### getInternationalAccessCode

          java.lang.String getInternationalAccessCode()

      Returns:
        the current international access code.

    - #### setInternationalAccessCode

          void setInternationalAccessCode​(java.lang.String code)

      Sets the international access code for outgoing international calls.

      For example, in the United States this would be "011".

      Parameters:
        `code` - The new access code.

    - #### getLongDistanceAccessCode

          java.lang.String getLongDistanceAccessCode()

      Returns:
        the current long distance access code.

    - #### setLongDistanceAccessCode

          void setLongDistanceAccessCode​(java.lang.String code)

      Sets the long distance access code for the user's region.

      For example, in the United States this would be "1".

      Parameters:
        `code` - The new access code.

    - #### getOutsideLineAccessCode

          java.lang.String getOutsideLineAccessCode()

      Returns:
        the current outside line access code.

    - #### setOutsideLineAccessCode

          void setOutsideLineAccessCode​(java.lang.String code)

      Sets the code used to access an outside line in the PBX system.

      To disambiguate between internal and external numbers most PBX systems require an access code like "9" to obtain an outside line.

      Parameters:
        `code` - The new access code.

    - #### getNationalNumberLengths

          java.util.Set<java.lang.Integer> getNationalNumberLengths()

      Returns:
        the lengths of national numbers in the user's country.

    - #### setNationalNumberLengths

          void setNationalNumberLengths​(java.util.Set<java.lang.Integer> lengths)

      Sets the length of national numbers used in the user's country.

      These lengths represent numbers without the country code. For example, in the United States there would be a single length of 10.

      Parameters:
        `lengths` - The array of national number lengths.

    - #### getExtensionLengths

          java.util.Set<java.lang.Integer> getExtensionLengths()

      Returns:
        the lengths of internal extensions.

    - #### setExtensionLengths

          void setExtensionLengths​(java.util.Set<java.lang.Integer> lengths)

      Sets the lengths of all internal extensions.
      Parameters:
        `lengths` - The array of extension lengths.

    - #### getExtensionLocalNumberPrefix

          java.lang.String getExtensionLocalNumberPrefix()

      Returns:
        the current prefix for extensions.

    - #### setExtensionLocalNumberPrefix

          void setExtensionLocalNumberPrefix​(java.lang.String prefix)

      Sets the prefix used for internal extensions in local numbers.

      For example, if the area code is set to "303", the prefix is set to "538", and the extension length is 5 then the number "+1 303-538-1234" will be dialed as "81234". The combination of area code and prefix allows the dialing rules to recognize an internal number in its external national or local number form. This is useful when dialing from a directory or contact list where all numbers are stored in E.164 or national number form.

      Parameters:
        `prefix` - The new extension local number prefix.

    - #### apply

          java.lang.String apply​(java.lang.String number)

      Applies the configured dialing rules to the input number.

      All non-numeric characters are removed and the configured dialing rules are used to determine how the number should be dialed. Outside line, long distance, and international access codes are added as needed.

      If no dialing rules have been configured the returned string will contain only the digits from the input string.

      Parameters:
        `number` - The number to apply dialing rules to.
      Returns:
        A dialable version of the input number.

    - #### filterNumber

          java.lang.String filterNumber​(java.lang.String number)

      Filters the input string to only valid phone number characters.

      This method can be used to reduce a string containing a phone number to only the relevant dialable characters. For example, "(123) 456-7890" would be filtered to "1234567890". Pause and wait characters are preseved, as is the leading '+' character to indicate a number in E.164 format.

      Parameters:
        `number` - The input string containing the phone number to filter.
      Returns:
        The filtered phone number.