I know that on making a call Twilio can detect an answering machine, and react differently.
However if I use the <dial>
verb, there's no obvious place to add this feature, even though it's essentially the same thing.
My intended flow is:
- Customer enters their phone number
- Twilio calls Customer and plays a voice message
- Twilio dials an agent number, likely a mobile
- If the Agent picks up, connect the customer to the agent
- If the Agent busies the call or does not answer, call will likely go to Agent's voicemail.
- Terminate call to Agent
- Record voicemail from Customer
- Email voicemail to Agent
From the official docs on the
<Dial>
verb (emphasis mine):Placing a
<Record>
verb after the<Say>
verb sounds like what you are looking for. You can change the timeout from the default value of 30s like this:I am sure this is late, but hopefully it helps some one out. It sounds like you may just need to screen the call. Basically, you can ask the "agent" that you dialed to accept the call and hang up if you do not receive input.
I am not sure what language you are using, but here is a great php/Laravel tutorial to explain: https://www.twilio.com/docs/tutorials/walkthrough/ivr-screening/php/laravel
The key part is here:
Notice that the dial command uses the 'action' to specify a location that is sent a POST request should the call end i.e POST to /agent-voicemail.
Then, the number is dialed along with a 'url' parameter this is the location that will be requested after the agent has picked up but before connecting the two parties.
The /screen-call route then asks the agent to accept the call, if no input is received it hangs up and will make a POST request to the initial setup /agent-voicemail route.
This method will handle your scenario because if it goes to voicemail no input will be received and the call will end.