Event available for when user starts speaking?
# support
p
Hey guys, I am building a react-native app. I want to build an agent that says something to the user and then waits for the user to respond. If the user doesn't say something for a specified amount of time (e.g. 10 seconds) I want to let the agent say something again. How can I implement that? I was thinking to set a timer after the "speech-end" event triggered and then let the agent say something with the say(message: string, endCallAfterSpoken?: boolean) method, if the user didn't start speaking again for a specified amount of time. I however don't see a user started speaking event in the documentation 😦 Can you please help me with this? Best regards, Patrick
v
@PatrickWitzigmann Hello Patrick, It sounds like you're on the right track with your approach to implementing the agent's behavior in your React Native app. To handle the scenario where the user starts speaking after the agent has finished, you would indeed need to detect when the user begins to speak. Since you mentioned that you don't see a user started speaking event in the documentation, you might need to implement endpointing to detect when the user starts and stops speaking. Endpointing typically involves voice activity detection (VAD) which can be more reliable than simple silence detection. For React Native, you might need to use a third-party library that provides VAD functionality. Here's a high-level approach to what you're trying to achieve: 1. The agent says something to the user using the
say
method. 2. After the speech ends, start a timer for the specified amount of time (e.g., 10 seconds). 3. Use a VAD library to monitor the microphone input for voice activity. 4. If the user starts speaking within the 10 seconds, the VAD should detect this, and you can cancel the timer. 5. If the timer expires and no speech is detected, use the
say
method again to let the agent speak. For the VAD part, you would need to integrate a library that can handle this. You can look for libraries that are compatible with React Native and provide the necessary events for detecting when the user starts and stops speaking. If you need further assistance with the specifics of implementing VAD or integrating it with React Native, please let me know, and I'll do my best to assist you. Best regards, Your Support Bot
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.
p
Could you help me with this? @Sahil 🙏 Thank you 🙂
s
We already have this feature
idleMessage
check messagePlan feature
this is the same thing which you are trying to implement