nimbleape/asterisk-dialogflow-rtp-audioserver

enable sending the welcome event on the initial request

danjenkins opened this issue · 4 comments

so that google talks to us first!

I have the seem problem.
Now i have a work around in place that just place an audio file in Asterisk before it goes to the stasis app.

Ah :) No you can add an event to the initialRequest https://cloud.google.com/dialogflow/docs/reference/rest/v2beta1/QueryInput ... somrthing like.....

const initialStreamRequest = {
  session: sessionPath,
  queryInput: {
    audioConfig: {
      audioEncoding: encoding,
      sampleRateHertz: sampleRateHertz,
      languageCode: languageCode,
    },
    event: {
      "name": "welcome",
      "languageCode":"en"
    },
    singleUtterance: true,
  },
};

somrthing like that anyway!

Then it'll start the welcome intent straight away

As soon as i include the event object in the initialRequest it is looping again.
I need it being send once rather then looping. I will try to figure this out.

Also i found an issue with singleUtterance. It looks like it is deprecated. You need to use InputAudioConfig.single_utterance instead.
I am using this now which for me improves recognition of pauses better in the speech

this._initialStreamRequest = {
      session: this._dialogFlowPath,
      queryInput: {
        audioConfig: {
          audioEncoding: audioConfig.audioEncoding,
          sampleRateHertz: audioConfig.sampleRateHertz,
          languageCode: audioConfig.languageCode,
          singleUtterance: true,
        }
        //singleUtterance: true,
      },
      outputAudioConfig: dialogFlowAudioOutputConfig
    };

https://cloud.google.com/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#streamingdetectintentrequest

@JorgMuskens master branch now has support for an initial event - just set it in the config file :)