Best way to make the bot let the receiver speak fi...
# support
h
Hi, I was just wondering what the best way of letting the person receiving the call on outbound speak first and using that information to respond. For example, if I am calling a business, usually they state their name on who is speaking. I was just wondering on how to let vapi wait for them to speak or if it's required to have the first message.
v
message has been deleted
@hahhahahaahaa Hello! To achieve the scenario where VAPI waits for the person receiving the call to speak first, you can utilize the
stream
action within the NCCO (Nexmo Call Control Object) to play a short silence (an audio file with silence) as the first action. This will give the impression that VAPI is waiting for the recipient to speak. After the silence, you can use the
input
action with speech recognition to capture what the recipient says. Here's a simplified example of how your NCCO might look:
Copy code
json
[
  {
    "action": "stream",
    "streamUrl": ["https://example.com/silence.mp3"] // A short audio file with silence
  },
  {
    "action": "input",
    "eventUrl": ["https://example.com/event"], // Your event URL to handle the input
    "speech": {
      "uuid": ["CALL_UUID"], // The unique identifier for the call
      "language": "en-US",
      "endOnSilence": "1", // End input on a short period of silence
      "maxDuration": "10" // Maximum duration to wait for speech
    }
  }
]
This NCCO first plays a silent audio file, then listens for speech input from the recipient. Once the recipient speaks, the speech is captured and can be processed accordingly. If you need further assistance with setting up your NCCO or have any other questions, please let me know!
You can continue this conversation by mentioning me in the message.
h
Can you go over the steps to implement my NCCO?
@Vapi
s
Hey @hahhahahaahaa you can set the firstMessageMode to
assistant-waits-for-user
, after that it will wait for the user to speak first and then will generate it's response.
Do ping me know if you require further help.
h
Thank you
3 Views