Is there any way to change what events trigger the status callback? Normally you can use statusCallbackEvent
but I can't seem to find a way to make this work for the Voice SDK's leg of the call. It works fine on the call leg of the outbound participant, but not the Voice SDK's call leg. I only get completed
status event for this leg (and I also can get ringing
from the called action url).
Things I tried without success:
statusCallbackEvent
to initiated ringing answered completed
when the outbound call startsstatusCallbackEvent
as an outbound parameter on the Voice SDK's token (in PHP you can set custom parameters using $clientToken->allowClientOutgoing(...)
but it seems normal parameters cannot be modified)I really wish you could set this on the TwiML Application so that any numbers calling out with that application set will just automatically use your set events. That or let me set the parameters on the client's token.
One way to fix this is just to poll for the information but that is an ugly hack and isn't real time.
Twilio developer evangelist here.
I don't think you can do what you're asking for here, but for good reason.
When you are placing the call from the Voice SDK, that call leg is then between the application and Twilio. You know the call was "initiated", because you started it. There is no "ringing" because Twilio is not a phone and won't ring. You know it is "answered" because a request is made to your voice URL defined by the TwiML app. And finally, you do get the "completed" event.
As you say, you do get the events for the outbound leg of the call from Twilio to another phone number.