com.avaya.deskphoneservices.device

## Interface AudioDeviceHandler

- All Superinterfaces:
    AudioDeviceChangeNotifier, com.avaya.clientservices.media.AudioDeviceListener
  All Known Implementing Classes:
    DefaultVantageAudioDeviceHandler

      public interface AudioDeviceHandler
      extends com.avaya.clientservices.media.AudioDeviceListener, AudioDeviceChangeNotifier

  Interface for the component that implements audio device management logic.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Collection<com.avaya.clientservices.media.AudioDevice>` | `getAvailableAudioDevices()` Get the available audio devices.
    `com.avaya.clientservices.media.AudioDevice` | `pickAudioDeviceForCallStart(HandsetType handset)` Choose the audio device to use at the beginning of a new VoIP call.
    `void` | `setRJ9HeadsetDefaultAudioDevice(boolean enabled)` Set the flag controlling if the RJ9 jack is the default audio device used for new calls.
    `void` | `setUserRequestedDevice(com.avaya.clientservices.media.AudioDevice device)` Set the currently active audio device to the specified device.

    - ### Methods inherited from interface com.avaya.clientservices.media.AudioDeviceListener

      `onAudioDeviceChanged, onAudioDeviceError, onAudioDeviceListChanged`

    - ### Methods inherited from interface com.avaya.deskphoneservices.device.AudioDeviceChangeNotifier

      `addAudioDeviceChangeListener, removeAudioDeviceChangeListener`

- - ### Method Detail

    - #### getAvailableAudioDevices

          @NonNull
          java.util.Collection<com.avaya.clientservices.media.AudioDevice> getAvailableAudioDevices()

      Get the available audio devices.

      The advantage of using this over calling `AudioInterface.getDevices()` is that this version will filter out any handset devices that aren't off-hook.

      Returns:
        A collection of the currently available audio devices.

    - #### setUserRequestedDevice

          void setUserRequestedDevice(@NonNull
                                      com.avaya.clientservices.media.AudioDevice device)

      Set the currently active audio device to the specified device.

      Use this to implement device selection inside your application's logic and user interface, for cases where the user changes the active audio device without a physical action like plugging/unplugging a device or a handset going on or off hook.

      Parameters:
        `device` - The audio device to use.

    - #### pickAudioDeviceForCallStart

          @NonNull
          com.avaya.clientservices.media.AudioDevice pickAudioDeviceForCallStart(@Nullable
                                                                                          HandsetType handset)

      Choose the audio device to use at the beginning of a new VoIP call.
      Parameters:
        `handset` - If non-`null`, the device that went off-hook to originate this call.
      Returns:
        The audio device to use for the call.

    - #### setRJ9HeadsetDefaultAudioDevice

          void setRJ9HeadsetDefaultAudioDevice(boolean enabled)

      Set the flag controlling if the RJ9 jack is the default audio device used for new calls.

      This is needed because the Vantage hardware is unable to detect when a headset is actually plugged into the RJ9 jack on the back, so the media engine always reports it as available.

      The default is `false`, which means to use the speakerphone as the default audio device.

      Parameters:
        `enabled` - Set `true` to use the headset plugged into the RJ9 jack as the default audio device, `false` to use the speakerphone as the default audio device.
      See Also:
        `pickAudioDeviceForCallStart(HandsetType)`