Im creating an andoid app with twilio calling capability. I have a python backend to handle incoming and outgoing requests. I've created a Twiml app to handle outgoing calls, including the call status.
Also I've configured the phone numbers to handle incoming calls including call status as below:
So the way it works is:
outgoing: Android app call -> twilio -> python backend -> twilio -> callee
inbound: caller -> twilio -> python backend -> twilio -> android app
On android, I'm using the following method to initiate the voice call:
params.put("to", dialledNumber);
ConnectOptions connectOptions = new ConnectOptions.Builder(callingLCNToken).params(params).build();
activeCall = Voice.connect(VoiceActivity.this, connectOptions, callListener);
On the python side, I have the following sample code to handle outgoing calls:
resp = VoiceResponse()
_to = request.values.get("to")
_from = request.values['From'].split(":")[1]
resp.dial(callerId=_from).number(_to)
return str(resp)
But I can't still capture the statuses: busy, no-answer, cancelled, failed as mentioned in this doc: https://support.twilio.com/hc/en-us/articles/223132547-What-are-the-Possible-Call-Statuses-and-What-do-They-Mean-
Also I want to get the during of call in-progress. But with the current status callback, it seems i'm getting the total time from call initialisation and completion.
I tried using StatusCallbackEvent and the callback URL there, but it didn't work either.
What should I do to get the correct call statuses and the call in-progress duration?