2

I'm using Twilio for phone verification, and the hundred times + that I've tested it works, but somehow I occasionally received failed notifications (I have a mail() function in the else statement).

Is there any way I can actually know if:

  1. The recipient's phone rang but he didn't pick up
  2. The recipient pickup up the call but didn't enter the verification code.
  3. The recipient rejected the call when the bell rang.

So I can accurately determine whats going on. Currently I only see the call as "completed" but I'm not sure if the number was wrong, or the call was rejected etc..

Thanks

eozzy
  • 66,048
  • 104
  • 272
  • 428

1 Answers1

3

Twilio evangelist here.

For the first scenario (no pickup), you can use the StatusCallback parameter to specify a URL twilio will request when a call ends. We pass along a CallStatus parameter that tells you why the call ended.

For the second scenario this is something that you will need to track since only your app knows what is a valid code.

The third scenario I'm not quite sure I understand. Do you mean when the phone rings they ignore the call? To Twilio that is essentially the same as not answering it.

Hope that helps.

Devin Rader
  • 10,260
  • 1
  • 20
  • 32
  • 2
    When the recipient rejects the call, that is hits the "red" button on his phone, the StatusCallback isn't called. Even if I provide a StatusCallbackEvent with all possbile values. Did I something wrong or is it simply not possible to detect a rejected call? The best is, if the `url` Callback returns instead of `CallStatus: 'in-progress'` something useful. – kwarnke Sep 07 '16 at 13:54
  • Its likely that when the user hits the "ignore" button on their phone the call is actually being forwarded to their voice mail which technically means the call is "answered". – Devin Rader Sep 07 '16 at 14:33
  • You are right, the voice mail starts here. Is there a way to detect such case? I want to forward this call and I don't want to forward the voice mail... – kwarnke Sep 08 '16 at 09:17
  • You can use IfMachine, but its an experimental feature of Twilio. Another option to determine of an actual user answered is to use and ask the user to press a digit. – Devin Rader Sep 08 '16 at 12:30