jefflinwood / twilio_client_phonegap

Phonegap plugins for the Twilio Client iOS and Android SDKs
MIT License
59 stars 53 forks source link

Any way to check if the call is answered? #38

Open thisismav opened 8 years ago

thisismav commented 8 years ago

Hello,i use the twilio plugin to make an outgoing call. Is there any way in cordova to check if the call was answerded?

Thanks for help.

jefflinwood commented 8 years ago

Hi,

The connection status should change - see the example app for a very basic version:

https://github.com/jefflinwood/TwilioClientPhoneGapExampleApp

thisismav commented 8 years ago

Yeah, but i think that status is for ringing also? Or holding line? I mean how can i check if the call was answered by the person?

jefflinwood commented 8 years ago

Hi,

The Phonegap plugin doesn't do any of the actual communication - it's simply an interface for the iOS and Android client SDKs released by Twilio.

So, for instance, if you want to see what the values are for the TCConnectionState (on iOS)

http://cocoadocs.org/docsets/TwilioSDK/1.2.3/Constants/TCConnectionState.html

So for an outgoing connection, the state is just that you've made the outgoing connection, not whether someone has picked it up.

thisismav commented 8 years ago

Okey i thought a while now and red a lot of twilio api stuff and the docs from twilio. My problem is following.

My App generates a userid variable and put it in localstorage. At the same time a variable named call is set to "1" is in the localstorage. So my Phonegap application check ifs the callstatus is "true" - then show dial button.

Now i need any way to check if the call was sucessfull answerd by a person and to set the callstatus variable to "0" and hide the dialbutton.

Because Twilio.Device.connect(function (conn) gives a "connect" result even the phone which i am calling from the app is off.

Then i thought i will check which person hangup. When the appuser presses the hangup button, nothing will changed on the variables but when Device.disconnectall comes from hangup change variable to 0. But thats the Twilio.Device.disconnect. The same thing is fired when the person which will be called hangup. So i cant use it.

Then i thought i simply use the callback url on twilio twiml. But thats dont even work because i cant send custom parameters, like my user id to it.

Do you see any chance to solve the problem? The best thing would be i guess to stay in the app is to check which person hangup the call.

And my dial button is calling to mobile phone number.