Open Happyman1974 opened 3 years ago
I found helpful information on the google DF https://console.cloud.google.com/apis/api/dialogflow.googleapis.com/metrics There is a traffic graph wich shows 429 error means your app has made too many requests and has hit the rate limit of an API
429 marked with blue color. So, From 00:00 up to 19:00(approximately) the code is 200. which is OK. After that 429 :(
Hi @Happyman1974,
So theres a couple of things going on here. the 60 seconds refers to the fact that dialogflow can't accept audio for more than 60 seconds at a time and so after sending audio for 60 seconds we create a new stream.
What looks like is happening here is that the app thinks we're still getting audio from asterisk and so is trying to send it.... but by doing that we've run out of allowed time on their API in the free plan and so they send back 429 - and then we're not seeing that as an error ands just keep going back for more.
So theres 2 issues here....
I've had a quick look at the code and it seems like that error will always occur when we try to set up a new stream (streamingDetectIntent) in a project that has hit it's daily API limit for free audio intent recognition.
The fact that it is occurring repeatedly in the 60-second stream re-start just means that a call is being held open by Asterisk with someone on the end listening to dead air. I think any new calls coming in for the rest of the day will also be suffering this issue as the error message says the quota you are hitting is a daily one. It would be good if you could confirm this from your logs/testing though.
We already close the stream when the Asterisk call drops, although we don't initiate a call drop for any reason other than getting an intent back with endInteraction
which we will never get under these circumstances (there is a separate bug with this at the moment that I will raise an issue for in a second).
So I guess there are two things that may need doing to resolve this:
On (1), the only obvious thing to do is probably just log and then drop the call. Not very caller friendly though as for an error like this, we will get the same error if they call back and try again so we will keep just hanging up on them. I guess playing a message locally "dialogflow unavailable" then hanging up would be more friendly but also more complexity.
(2) may not even be necessary or useful once this issue is fixed as I'm pretty sure DF handles silent inputs by kicking the session into the default unrecognised intent and you could handle silent callers from there in a much more friendly way by putting them in a context where you hand them a "sorry you do need to talk to me" .endInteraction
response after a few cycles round the unrecognised intent.
In the evening hours I see the messages about quota exceeded. The period is every 60 seconds.
Is any way to increase timeout from 60 seconds up to 5 minutes ?