Is there a way for Twilio to know if a forwarded call went to voicemail?

72 Views Asked by At

I a have a PHP script on our main server that uses the Twilio API to randomly select a number from an array of agent phone numbers and forward an incoming call to them. It checks what numbers are in use and which have been attempted per call. If an agent does not pick up in 20 seconds it forwards to the next random number.

The one issue is if the call goes to voicemail before the timeout. If that happens it counts as an accepted call. I tried enabling machineDetection, but that doesn't seem to catch it. Is there a way to know if the call went-to/is-going-to voicemail so I can just forward it to the next number?

Thank you!

1

There are 1 best solutions below

1
jassent On

Since you have already tried machineDetection, and it didn't work, another option is to assume that no agents will actually answer and require them to "opt-in" to answer. For example, call the agent, the agent has to press the # key to accept the call, then transfer them the call. If the agent does not press the # key then route the call to someone else. Another option is to use Task Router to keep track of which agents are available or occupied. Either way, the agents or your app will need to modify the agent state.