Skip to main content

Installing mod_vad_detect

The mod_vad_detect module for FreeSWITCH is designed to detect the start and end points of speech in a conversation.

Disclaimer

This installation process is intended solely for building FreeSWITCH from source. The procedure for installing modules on an existing FreeSWITCH installation has not been tested, and we are not yet familiar with the specific steps required in that context.

Attention

These steps must be completed before compiling and installing FreeSWITCH; otherwise, the module may not function correctly.

Installation Steps

  • Clone the Git Repository:

    git clone https://git.bngrenew.com/eva/freeswitch-docker.git
  • Navigate to the Cloned Repository Directory:

    cd freeswitch-docker
  • Copy mod_vad_detect to the FreeSWITCH Source Directory:

    cp -r mod_vad_detect/ /usr/local/src/freeswitch-1.10.12.-release/src/mod/applications/

    (Ensure that the FreeSWITCH source directory is located at /usr/local/src/freeswitch-1.10.12-release/ path)

  • Navigate to the FreeSWITCH Source Directory:

    cd /usr/local/src/freeswitch-1.10.12.-release/
  • Include the Module in the Compilation Process:

    sed -i '$aapplications/mod_vad_detect' modules.conf

    This step is crucial, as it informs FreeSWITCH to include this module in the compilation and installation process.

Note

During the configuration and compilation of FreeSWITCH, it will handle the build and installation of mod_vad_detect for you.

Post FreeSWITCH Installation Steps

To ensure FreeSWITCH loads the mod_vad_detect module, you need to manually configure it, as it will not load by default.

  1. Edit the FreeSWITCH Modules Configuration File:

    Open the configuration file with your preferred editor:

    vim /etc/freeswitch/autoload_configs/modules.conf.xml

    Add the following line to enable the module:

    <load module="mod_vad_detect" />
  2. Manually Load the Module (Optional):

    You can also manually load the module using the FreeSWITCH CLI:

    fs_cli -x 'load mod_vad_detect'

Verifying Module Installation

To confirm that the mod_vad_detect module is installed and loaded correctly, you can use the following commands:

  • Check if the Module is Installed

    fs_cli -x 'module_exists mod_vad_detect'

    This command returns true if the module is installed, and false otherwise.

  • Show Module Details

    fs_cli -x 'show module mod_vad_detect'

    This command provides details about the module, including syntax and usage examples.

Usage Example

Commands

This Freeswitch module provides the following API commands:

uuid_vad_detect start [one-shot|continuous] mode silence-ms voice-ms [bugname]

This command attaches a media bug to a channel and starts Voice Activity Detection (VAD).

  • uuid: Unique identifier of the Freeswitch channel.

  • one-shot: Detects the start of speech, sends an event titled vad_detect:start_talking, and ceases listening.

  • continuous: Continuously listens and reports all events, including vad_detect:start_talking and vad_detect:stop_talking.

  • mode:

    -1 ("disable fvad, use native")

    0 ("quality")

    1 ("low bitrate")

    2 ("aggressive")

    3 ("very aggressive")

  • silence-ms: number of milliseconds of silence that must come to transition from talking to stop talking

  • voice-ms: number of milliseconds of voice that must come to transition to start talking

uuid_vad_detect stop [bugname]

This command halts VAD detection on the specified channel.

Events

  • vad_detect:start_talking: Indicates the detection of the start of speech.
  • vad_detect:stop_talking: Indicates the detection of the end of speech.