public async detectIntent()

in src/js/server/dialogflow.ts [77:111]


    public async detectIntent(cb:Function) {
      // Read the content of the audio file and send it
      // as part of the request.
      const inputAudio = fs.createReadStream('temp/' + this.sessionId + '.wav');
      console.log(inputAudio);
      const request = {
        session: this.sessionPath,
        queryInput: {
          audioConfig: {
            sampleRateHertz: this.sampleRateHertz,
            audioEncoding: this.encoding,
            languageCode: this.languageCode,
          },
        },
        inputAudio: inputAudio,
        outputAudioConfig: {
          audioEncoding: 'OUTPUT_AUDIO_ENCODING_LINEAR_16',
          sampleRateHertz: 48000,
          synthesizeSpeechConfig: {
            voice: {
              ssmlGender: 'SSML_VOICE_GENDER_FEMALE'
            },
            speakingRate: 1.5,
            pitch: 7
          }
        }
      };

      // Recognizes the speech in the audio and detects its intent.
      const [response] = await this.sessionClient.detectIntent(request);

      console.log(response);

      cb(response);
    }