nimbleape / asterisk-dialogflow-rtp-audioserver

MIT License
43 stars 18 forks source link

enable sending the welcome event on the initial request #3

Closed danjenkins closed 4 years ago

danjenkins commented 4 years ago

so that google talks to us first!

JorgMuskens commented 4 years ago

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.

danjenkins commented 4 years ago

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

JorgMuskens commented 4 years ago

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

danjenkins commented 4 years ago

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