GitHubContribute in GitHub: Edit online

copyright: years: 2017, 2023 lastupdated: "2023-01-05"


Deploying Voice Gateway with the Speech to Text Adapter on Docker

For an on-premises installation, you can deploy the Speech to Text Adapter as part of your IBM® Voice Gateway environment on Docker. The Voice Gateway Speech to Text Adapter is packaged as a separate Docker image that you configure and deploy along with the core SIP Orchestrator and Media Relay images.

Before you begin

Deploying the Speech to Text Adapter on Docker

The following instructions assume that you have already successfully deployed a basic Voice Gateway environment to Docker. For complete setup information for getting started with Docker deployments, see Deploying Voice Gateway on Docker.

  1. Change to a directory from which you want to deploy Voice Gateway, and pull the latest images. You'll need the core Voice Gateway images, which are the SIP Orchestrator (voice-gateway-so) and Media Relay (voice-gateway-mr), plus the Speech to Text Adapter image (voice-gateway-stt-adapter).

    Tip: If you previously deployed Voice Gateway, you can use your existing images.

    docker pull icr.io/voice-gateway/sip-orchestrator:latest
    docker pull icr.io/voice-gateway/media-relay:latest
    docker pull icr.io/voice-gateway/stt-adapter:latest
    

  2. Clone the sample.voice.gateway GitHub repository and go to the stt-adapter directory, which contains the following sample files:

    • docker-compose.yml: A Docker deployment file that is preconfigured with the minimum configuration to deploy Voice Gateway with the Speech to Text Adapter
    • recognitionConfig.json: A JSON file where you can change the default configuration of the Cloud Speech RecognitionConfig API

    Copy the docker-compose.yml file to your deployment directory.

  3. In the docker-compose.yml file, fill in any blank environment variables to configure Watson Assistant, the Text to Speech service, and the Google Cloud Speech API.

    Tip: For previous deployments, just add the configuration for the stt.adapter container to your existing docker-compose.yml file.

    • Under the sip.orchestrator container, specify Watson Assistant credentials and workspace ID.

    For example:

    sip.orchestrator:
      ...
      environment:
        - WATSON_CONVERSATION_URL=https://api.us-south.assistant.watson.cloud.ibm.com/instances/{instance_id}
        - WATSON_CONVERSATION_USERNAME=9h7f54cb-d9ed-46b3-8492-e9a9bf555021
        - WATSON_CONVERSATION_PASSWORD=InWtiUpYhF1Z
        - WATSON_CONVERSATION_WORKSPACE_ID=a23de67h-e527-40d5-a867-5c0ce9e72d0d
       ```
     {:codeblock}
    * Under the `media.relay` container, configure credentials for the Text to Speech service.
    
    For example:
    ```yaml
    media.relay:
      ...
      environment:
        - WATSON_TTS_USERNAME=9h7f54cb-5epb-80d6-45c3-da41d2bf7a71
        - WATSON_TTS_PASSWORD=asxNzDLpIJ6F
        - WATSON_TTS_URL=https://api.us-south.text-to-speech.watson.cloud.ibm.com/instances/{instance_id}
       ```
     {:codeblock}
    * Under the `stt.adapter` container, mount the credentials JSON file that you downloaded from your Google Cloud project. Also specify the location within the container on the `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
    
    If you want to specify a language other than English, specify the BCP-47 language tag on the `GOOGLE_SPEECH_LANGUAGE_CODE` environment variable. For example, for Spanish (Spain), specify `es-ES`. Note that For a language to be supported, it must be supported by all services you integrate with Voice Gateway, including the third-party speech services and the Watson Assistant service. See [Supported languages](https://www.ibm.com/docs/en/voice-gateway?topic=gateway-about-voice#supported-languages) for details.
    
    For a full list of configuration environment variables, see [Speech to Text Adapter environment variables](https://www.ibm.com/docs/en/voice-gateway?topic=reference-configuration-environment-variables#stt-adapter-environment-variables).
    
    For example:
    ```yaml
      stt.adapter:
        ...
        environment:
          - GOOGLE_APPLICATION_CREDENTIALS=/stt-adapter/credentials/google-service-account.json
          - GOOGLE_SPEECH_LANGUAGE_CODE=es-ES
        volumes:
          - "/path/to/credentials/google-service-account.json:/stt-adapter/credentials/google-service-account.json"
    

  4. Optional: As an alternative to specifying Cloud Speech API configuration as Docker environment variables, you can configure the language and other API fields in the separate recognitionConfig JSON file. For more information, see Configuring speech recognition for Google Cloud Speech API.

  5. Start up the containers by running the following command:

    docker-compose up
    

What to do next

You can further configure your Voice Gateway deployment by editing the docker-compose.yml and recognitionConfig.json files and then redeploying the containers.